2 Commits
1.0 ... 1.0.1

View File

@@ -2,7 +2,7 @@
/*
* Plugin Name: 1984 Hosting Support
* Version: 1.0
* Version: 1.0.1
* Author: 1984 ehf
* Author URI: https://1984.hosting
* Description: Support plugin for 1984 Hosting customers.
@@ -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 ) );
}