Source of file CleanupGeneratedPdfDailyTask.php
Size: 1,137 Bytes - Last Modified: 2021-12-24T06:43:17+00:00
/var/www/docs.ssmods.com/process/src/src/Tasks/CleanupGeneratedPdfDailyTask.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 | <?php namespace CWP\PDFExport\Tasks; use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Injector\Injector; use SilverStripe\CronTask\Interfaces\CronTask; if (!interface_exists(CronTask::class)) { return; } /** * If the silverstripe/crontask module is installed, this will enable the PDF cleanup task to be run on a schedule */ class CleanupGeneratedPdfDailyTask implements CronTask { use Configurable; /** * The cron schedule for this task (default: midnight every day) * * @config * @var string */ private static $schedule = '0 0 * * *'; /** * Whether this task is enabled (default false) * * @config * @return bool */ private static $enabled = false; private static $segment = 'CleanupGeneratedPdfDailyTask'; public function getSchedule() { return $this->config()->get('schedule'); } public function process() { if (!$this->config()->get('enabled')) { return; } $task = Injector::inst()->create(CleanupGeneratedPdfBuildTask::class); $task->run(null); } } |