Closte.php
4 years ago
Cloudways.php
4 years ago
Flywheel.php
4 years ago
GoDaddyWPaaS.php
4 years ago
GridPane.php
4 years ago
Hosting.php
4 years ago
Kinsta.php
4 years ago
Pagely.php
4 years ago
PagelyCachePurge.php
4 years ago
Pressable.php
4 years ago
RocketNet.php
4 years ago
Savvii.php
4 years ago
SiteGround.php
4 years ago
Vimexx.php
4 years ago
WPEngine.php
4 years ago
WPX.php
4 years ago
Vimexx.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | namespace NitroPack\Integration\Hosting; |
| 4 | |
| 5 | class Vimexx extends Hosting { |
| 6 | const STAGE = "very_early"; |
| 7 | |
| 8 | public static function detect() { |
| 9 | $hostname = gethostname(); |
| 10 | return (!empty($hostname) && strpos($hostname, 'zxcs') !== false) || !empty($_SERVER['HTTP_X_ZXCS_VHOST']); |
| 11 | } |
| 12 | |
| 13 | public function init($stage) { |
| 14 | if ($this->getHosting() == "vimexx") { |
| 15 | add_action('nitropack_execute_purge_url', [$this, 'purgeUrl']); |
| 16 | add_action('nitropack_execute_purge_all', [$this, 'purgeAll']); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | public function purgeUrl($url) { |
| 21 | try { |
| 22 | $http = new \NitroPack\HttpClient($url); |
| 23 | $http->setHeader("X-Purge-ZXCS", "true"); |
| 24 | $http->setHeader("host-ZXCS", $_SERVER['HTTP_HOST']); |
| 25 | |
| 26 | $http->fetch(false, "PURGE"); |
| 27 | } catch (\Exception $e) { |
| 28 | // Exception |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | public function purgeAll() { |
| 33 | try { |
| 34 | $siteConfig = nitropack_get_site_config(); |
| 35 | |
| 36 | if(!empty($siteConfig['home_url'])) { |
| 37 | $homepage = $siteConfig['home_url']; |
| 38 | $this->purgeUrl(nitropack_trailingslashit($homepage) . '?purgeAll'); |
| 39 | } |
| 40 | } catch (\Exception $e) { |
| 41 | // Exception |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 |