diff --git a/src/Job/StaticCacheFullBuildJob.php b/src/Job/StaticCacheFullBuildJob.php index cfbc20b0..cef22d58 100644 --- a/src/Job/StaticCacheFullBuildJob.php +++ b/src/Job/StaticCacheFullBuildJob.php @@ -117,6 +117,7 @@ protected function getAllLivePageURLs(): array $urls = []; $this->extend('beforeGetAllLivePageURLs', $urls); $livePages = Versioned::get_by_stage(SiteTree::class, Versioned::LIVE); + foreach ($livePages as $page) { if ($page->hasExtension(PublishableSiteTree::class) || $page instanceof StaticallyPublishable) { $urls = array_merge($urls, $page->urlsToCache()); @@ -124,10 +125,12 @@ protected function getAllLivePageURLs(): array } $this->extend('afterGetAllLivePageURLs', $urls); + // @TODO look here when integrating subsites // if (class_exists(Subsite::class)) { // Subsite::disable_subsite_filter(true); // } + return $urls; } diff --git a/src/Task/StaticCacheFullBuildTask.php b/src/Task/StaticCacheFullBuildTask.php index 975ef451..9c9c58c3 100644 --- a/src/Task/StaticCacheFullBuildTask.php +++ b/src/Task/StaticCacheFullBuildTask.php @@ -2,6 +2,7 @@ namespace SilverStripe\StaticPublishQueue\Task; +use DateTime; use SilverStripe\Control\Director; use SilverStripe\Control\HTTPRequest; use SilverStripe\Core\Injector\Injector; @@ -15,6 +16,8 @@ class StaticCacheFullBuildTask extends BuildTask { + protected $title = 'Static Cache Full Build'; + /** * Queue up a StaticCacheFullBuildJob * Check for startAfter param and do some sanity checking @@ -45,6 +48,7 @@ public function run($request) $existing->Created, $existing->StartAfter ? 'and set to start after ' . $existing->StartAfter : '' )); + return false; } @@ -61,12 +65,14 @@ public function run($request) $timestamp = strtotime($today . ' ' . $startTime); $dayWord = 'today'; } - $startAfter = (new \DateTime())->setTimestamp($timestamp); - $thisTimeTomorrow = (new \DateTime())->setTimestamp(strtotime($now . ' +1 day'))->getTimestamp(); + + $startAfter = (new DateTime())->setTimestamp($timestamp); + $thisTimeTomorrow = (new DateTime())->setTimestamp(strtotime($now . ' +1 day'))->getTimestamp(); // sanity check that we are in the next 24 hours - prevents some weird stuff sneaking through if ($startAfter->getTimestamp() > $thisTimeTomorrow || $startAfter->getTimestamp() < $now->getTimestamp()) { $this->log('Invalid startAfter parameter passed. Please ensure the time format is HHmm e.g. 1300'); + return false; }