Source of file PurgeURLTask.php
Size: 1,126 Bytes - Last Modified: 2021-12-23T10:20:53+00:00
/var/www/docs.ssmods.com/process/src/src/PurgeURLTask.php
123456789101112131415161718192021222324252627282930313233343536373839404142 | <?php namespace Symbiote\Cloudflare; class PurgeURLTask extends \SilverStripe\Dev\BuildTask { use PurgeTask; protected $title = 'Cloudflare Purge: URL'; protected $description = 'Purges a single or multiple URLs, with an absolute or relative URL (ie. url="admin/,Security/" or url="http://myproductionsite.com/admin, http://myproductionsite.com/Security")'; protected $param_url = array(); public function run($request) { $url = $request->getVar('purge_url'); if (!$url) { $this->log('Missing "purge_url" parameter.'); return; } // Allow multiple URLs $urlList = explode(',', $url); foreach ($urlList as $i => $url) { $url = trim($url); // Remove URL if it's a blank string, this allows trailing commas if (!$url) { unset($urlList[$i]); } } $this->param_url = $urlList; return $this->endRun($request); } public function callPurgeFunction(Cloudflare $client) { return $client->purgeURLs($this->param_url); } } |