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
SiteGround.php
4 years ago
WPEngine.php
4 years ago
Flywheel.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | namespace NitroPack\Integration\Hosting; |
| 4 | |
| 5 | class Flywheel extends Hosting { |
| 6 | const STAGE = "early"; |
| 7 | |
| 8 | public static function detect() { |
| 9 | return defined("FLYWHEEL_PLUGIN_DIR"); |
| 10 | } |
| 11 | |
| 12 | public function init($stage) { |
| 13 | if ($this->getHosting() == "flywheel") { |
| 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 | try { |
| 21 | $purger = new \NitroPack\SDK\Integrations\Varnish(array("127.0.0.1"), "PURGE"); |
| 22 | $purger->purge($url); |
| 23 | } catch (\Exception $e) { |
| 24 | // Breeze exception |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | public function purgeAll() { |
| 29 | try { |
| 30 | if (function_exists("get_home_url")) { |
| 31 | $home = get_home_url(); |
| 32 | } else { |
| 33 | $siteConfig = nitropack_get_site_config(); |
| 34 | $home = "/"; |
| 35 | if ($siteConfig && !empty($siteConfig["home_url"])) { |
| 36 | $home = $siteConfig["home_url"]; |
| 37 | } |
| 38 | } |
| 39 | $purger = new \NitroPack\SDK\Integrations\Varnish(array("127.0.0.1"), "PURGE"); |
| 40 | $purger->purge($home); |
| 41 | } catch (\Exception $e) { |
| 42 | // Exception |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 |