Source of file HostCachePurgeJob.php
Size: 0,979 Bytes - Last Modified: 2021-12-23T10:07:25+00:00
/var/www/docs.ssmods.com/process/src/src/Jobs/HostCachePurgeJob.php
1234567891011121314151617181920212223242526272829303132333435 | <?php namespace NSWDPC\Utilities\Cloudflare; use SilverStripe\Core\Injector\Injector; use Symbiote\Cloudflare\Cloudflare; use Symbiote\Cloudflare\CloudflareResult; /** * Purge cache by host or hosts * Note: requires a CF Enterprise account * @author James Ellis <james.ellis@dpc.nsw.gov.au> */ class HostCachePurgeJob extends AbstractRecordCachePurgeJob { public function getTitle() { return parent::getTitle() . " - " . _t(__CLASS__ . '.JOB_TITLE', 'CF purge host(s)'); } /** * Process the job */ public function process() { try { $values = $this->checkRecordForErrors('hosts'); $this->checkPurgeResult( $this->getPurgeClient()->purgeHosts($values['hosts']) ); } catch (\Exception $e) { $this->addMessage("Cloudflare: failed to purge hosts with error=" . $e->getMessage() . " of type " . get_class($e)); $this->isComplete = false; } return false; } } |