Source of file DbFailedJobProvider.php
Size: 1,404 Bytes - Last Modified: 2021-12-23T10:38:27+00:00
/var/www/docs.ssmods.com/process/src/src/Failed/DbFailedJobProvider.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | <?php namespace StudioBonito\SilverStripe\Queue\Failed; use StudioBonito\SilverStripe\Queue\Models\FailedJob; class DbFailedJobProvider implements FailedJobProviderInterface { /** * Log a failed job into storage. * * @param string $connection * @param string $queue * @param string $payload * * @return void */ public function log($connection, $queue, $payload) { $failed = \SS_Datetime::now(); FailedJob::create(array('Queue' => $queue, 'Payload' => $payload, 'Failed' => $failed))->write(); } /** * Get a list of all of the failed jobs. * * @return array */ public function all() { return FailedJob::get()->sort('ID DESC')->toArray(); } /** * Get a single failed job. * * @param mixed $id * * @return array */ public function find($id) { return FailedJob::get()->filter('ID', $id)->first()->toMap(); } /** * Delete a single failed job from storage. * * @param mixed $id * * @return bool */ public function forget($id) { return FailedJob::get()->filter('ID', $id)->removeAll()->count() == 0; } /** * Flush all of the failed jobs from storage. * * @return void */ public function flush() { FailedJob::get()->removeAll(); } } |