diff --git a/1984-hosting-support.php b/1984-hosting-support.php index 9bf63fd..eb1ab4b 100644 --- a/1984-hosting-support.php +++ b/1984-hosting-support.php @@ -66,11 +66,27 @@ class HostingSupport1984 { ); } + /** + * Check if Patchstack is enabled. + * + * @return Boolean + */ + public function is_patchstack_active() { + return is_plugin_active( 'patchstack/patchstack.php' ); + } + /** * On activation of this plugin, set auto-update option for core, * plus enable auto-updates for installed plugins and themes. + * + * This is skipped if Patchstack is active on the site. */ public function activation_hook() { + if ( $this->is_patchstack_active() ) { + // In case Patchstack is active, do not continue. + return; + } + // Auto-update WordPress core. update_site_option( 'auto_update_core_major', 'enabled' ); @@ -86,8 +102,15 @@ class HostingSupport1984 { /** * On plugin activation, add to auto-updated list of plugins. + * + * This is skipped if Patchstack is active on the site. */ public function plugin_activation_hook( $plugin ) { + if ( $this->is_patchstack_active() ) { + // In case Patchstack is active, do not continue. + return; + } + $auto_updated_plugins = (array) get_site_option( 'auto_update_plugins', array() ); $auto_updated_plugins[] = $plugin; @@ -96,8 +119,15 @@ class HostingSupport1984 { /** * On theme switch, enable auto-update for all themes. + * + * This is skipped if Patchstack is active on the site. */ public function theme_switch_hook( $theme ) { + if ( $this->is_patchstack_active() ) { + // In case Patchstack is active, do not continue. + return; + } + $all_themes = wp_get_themes(); update_site_option( 'auto_update_themes', array_keys( $all_themes ) ); }