silverstripe /
silverstripe-staticpublishqueue
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SilverStripe\StaticPublishQueue\Job; |
||
| 4 | |||
| 5 | use SilverStripe\StaticPublishQueue\Job; |
||
| 6 | use SilverStripe\StaticPublishQueue\Publisher; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class DeleteStaticCacheJob |
||
| 10 | * remove pages from static cache based on list of URLs |
||
| 11 | * |
||
| 12 | * @package SilverStripe\StaticPublishQueue\Job |
||
| 13 | */ |
||
| 14 | class DeleteStaticCacheJob extends Job |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | * @config |
||
| 19 | */ |
||
| 20 | private static $chunk_size = 2000; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 21 | |||
| 22 | /** |
||
| 23 | * @return string |
||
| 24 | */ |
||
| 25 | public function getTitle(): string |
||
| 26 | { |
||
| 27 | return 'Remove a set of static pages from the cache'; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string $url |
||
| 32 | * @param int $priority |
||
| 33 | */ |
||
| 34 | protected function processUrl(string $url, int $priority): void |
||
| 35 | { |
||
| 36 | $meta = Publisher::singleton()->purgeURL($url); |
||
| 37 | $meta = is_array($meta) ? $meta : []; |
||
| 38 | |||
| 39 | if (array_key_exists('success', $meta) && $meta['success']) { |
||
| 40 | $this->markUrlAsProcessed($url); |
||
| 41 | |||
| 42 | return; |
||
| 43 | } |
||
| 44 | |||
| 45 | $this->handleFailedUrl($url, $meta); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |