Do not enable auto-update if Patchstack is active on the site
This commit is contained in:
@@ -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,
|
* On activation of this plugin, set auto-update option for core,
|
||||||
* plus enable auto-updates for installed plugins and themes.
|
* plus enable auto-updates for installed plugins and themes.
|
||||||
|
*
|
||||||
|
* This is skipped if Patchstack is active on the site.
|
||||||
*/
|
*/
|
||||||
public function activation_hook() {
|
public function activation_hook() {
|
||||||
|
if ( $this->is_patchstack_active() ) {
|
||||||
|
// In case Patchstack is active, do not continue.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Auto-update WordPress core.
|
// Auto-update WordPress core.
|
||||||
update_site_option( 'auto_update_core_major', 'enabled' );
|
update_site_option( 'auto_update_core_major', 'enabled' );
|
||||||
|
|
||||||
@@ -86,8 +102,15 @@ class HostingSupport1984 {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* On plugin activation, add to auto-updated list of plugins.
|
* 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 ) {
|
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 = (array) get_site_option( 'auto_update_plugins', array() );
|
||||||
$auto_updated_plugins[] = $plugin;
|
$auto_updated_plugins[] = $plugin;
|
||||||
|
|
||||||
@@ -96,8 +119,15 @@ class HostingSupport1984 {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* On theme switch, enable auto-update for all themes.
|
* 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 ) {
|
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();
|
$all_themes = wp_get_themes();
|
||||||
update_site_option( 'auto_update_themes', array_keys( $all_themes ) );
|
update_site_option( 'auto_update_themes', array_keys( $all_themes ) );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user