Source of file GenerateSiteMapJob.php
Size: 1,259 Bytes - Last Modified: 2021-12-23T10:03:02+00:00
/var/www/docs.ssmods.com/process/src/code/jobs/GenerateSiteMapJob.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 | <?php /** * @author Kirk Mayo <kirk.mayo@solnet.co.nz> * * A job for generating a XML sitemap */ class GenerateSiteMapJob extends AbstractQueuedJob { /** * @var int * Rerun the job each day */ private static $regenerate_time = 86400; public function __construct() { $this->currentStep = 0; } public function getJobType() { return QueuedJob::QUEUED; } /** * @return string */ public function getTitle() { return 'A job for generating a XML sitemap'; } /** * Return a signature for this queued job * * @return string */ public function getSignature() { return md5(get_class($this)); } public function process() { $sitemap = singleton('SiteMapXMLController'); $sitemap->generateSiteMap(ASSETS_PATH . '/sitemap.xml'); $this->completeJob(); return; } /** * Setup the next cron job */ protected function completeJob() { $this->isComplete = true; $nextgeneration = new GenerateSiteMapJob(); singleton('QueuedJobService') ->queueJob($nextgeneration, date('Y-m-d H:i:s', time() + self::$regenerate_time)); } } |