Closte.php
4 years ago
Cloudways.php
4 years ago
DreamHost.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
3 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
3 years ago
GoDaddyWPaaS.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | namespace NitroPack\Integration\Hosting; |
| 4 | |
| 5 | class GoDaddyWPaaS extends Hosting { |
| 6 | const STAGE = "early"; |
| 7 | |
| 8 | public static function detect() { |
| 9 | return class_exists('\WPaaS\Plugin'); |
| 10 | } |
| 11 | |
| 12 | public function init($stage) { |
| 13 | if ($this->getHosting() == "godaddy_wpaas") { |
| 14 | add_action('nitropack_execute_purge_url', [$this, 'purgeUrl']); |
| 15 | add_action('nitropack_execute_purge_all', [$this, 'purgeAll']); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | public function purgeUrl($url) { |
| 20 | if (class_exists('\WPaaS\Plugin')) { |
| 21 | update_option( 'gd_system_last_cache_flush', time() ); |
| 22 | $hosts = [\WPaaS\Plugin::vip()]; |
| 23 | $url = preg_replace("/^https:\/\//", "http://", $url); |
| 24 | $purger = new \NitroPack\SDK\Integrations\Varnish($hosts, 'BAN'); |
| 25 | $purger->purge($url); |
| 26 | return true; |
| 27 | } |
| 28 | |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | public function purgeAll() { |
| 33 | $siteConfig = nitropack_get_site_config(); |
| 34 | if ($siteConfig && !empty($siteConfig["home_url"])) { |
| 35 | return $this->purgeUrl($siteConfig["home_url"]); |
| 36 | } |
| 37 | return false; |
| 38 | } |
| 39 | } |
| 40 |