Commit e6bdcad0 authored by lucha's avatar lucha

consolidated 3 differen disable updates plugins into a single one

we had 3 plugins disabling core, themes, and plugins updates. They
were unmentioned. Now we have a single one, which is being maintained,
derived from the previous 3.
parent 7ff31b50
<?php
/**
* The main plugin file
*
* @package WordPress_Plugins
* @subpackage OS_Disable_WordPress_Updates
*/
/*
Plugin Name: Disable All WordPress Updates
Description: Disables the theme, plugin and core update checking, the related cronjobs and notification system.
Plugin URI: https://wordpress.org/plugins/disable-wordpress-updates/
Version: 1.5.0
Author: Oliver Schlöbe
Author URI: https://www.schloebe.de/
License: GPL2
Copyright 2013-2017 Oliver Schlöbe (email : scripts@schloebe.de)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Define the plugin version
*/
define("OSDWPUVERSION", "1.5.0");
/**
* The OS_Disable_WordPress_Updates class
*
* @package WordPress_Plugins
* @subpackage OS_Disable_WordPress_Updates
* @since 1.3
* @author scripts@schloebe.de
*/
class OS_Disable_WordPress_Updates {
private $__pluginsFiles;
private $__themeFiles;
/**
* The OS_Disable_WordPress_Updates class constructor
* initializing required stuff for the plugin
*
* PHP 5 Constructor
*
* @since 1.3
* @author scripts@schloebe.de
*/
function __construct() {
$this->__pluginsFiles = array();
$this->__themeFiles = array();
add_action( 'admin_init', array(&$this, 'admin_init') );
/*
* Disable Theme Updates
* 2.8 to 3.0
*/
add_filter( 'pre_transient_update_themes', array($this, 'last_checked_themes') );
/*
* 3.0
*/
add_filter( 'pre_site_transient_update_themes', array($this, 'last_checked_themes') );
/*
* Disable Plugin Updates
* 2.8 to 3.0
*/
add_action( 'pre_transient_update_plugins', array(&$this, 'last_checked_plugins') );
/*
* 3.0
*/
add_filter( 'pre_site_transient_update_plugins', array($this, 'last_checked_plugins') );
/*
* Disable Core Updates
* 2.8 to 3.0
*/
add_filter( 'pre_transient_update_core', array($this, 'last_checked_core') );
/*
* 3.0
*/
add_filter( 'pre_site_transient_update_core', array($this, 'last_checked_core') );
/*
* Disable All Automatic Updates
* 3.7+
*
* @author sLa NGjI's @ slangji.wordpress.com
*/
add_filter( 'auto_update_translation', '__return_false' );
add_filter( 'automatic_updater_disabled', '__return_true' );
add_filter( 'allow_minor_auto_core_updates', '__return_false' );
add_filter( 'allow_major_auto_core_updates', '__return_false' );
add_filter( 'allow_dev_auto_core_updates', '__return_false' );
add_filter( 'auto_update_core', '__return_false' );
add_filter( 'wp_auto_update_core', '__return_false' );
add_filter( 'auto_core_update_send_email', '__return_false' );
add_filter( 'send_core_update_notification_email', '__return_false' );
add_filter( 'auto_update_plugin', '__return_false' );
add_filter( 'auto_update_theme', '__return_false' );
add_filter( 'automatic_updates_send_debug_email', '__return_false' );
add_filter( 'automatic_updates_is_vcs_checkout', '__return_true' );
add_filter( 'automatic_updates_send_debug_email ', '__return_false', 1 );
if( !defined( 'AUTOMATIC_UPDATER_DISABLED' ) ) define( 'AUTOMATIC_UPDATER_DISABLED', true );
if( !defined( 'WP_AUTO_UPDATE_CORE') ) define( 'WP_AUTO_UPDATE_CORE', false );
add_filter( 'pre_http_request', array($this, 'block_request'), 10, 3 );
}
/**
* Initialize and load the plugin stuff
*
* @since 1.3
* @author scripts@schloebe.de
*/
function admin_init() {
if ( !function_exists("remove_action") ) return;
/*
* Hide maintenance and update nag
*/
remove_action( 'admin_notices', 'update_nag', 3 );
remove_action( 'network_admin_notices', 'update_nag', 3 );
remove_action( 'admin_notices', 'maintenance_nag' );
remove_action( 'network_admin_notices', 'maintenance_nag' );
/*
* Filter schedule checks
*
* @link https://wordpress.org/support/topic/possible-performance-improvement/#post-8970451
*/
add_action('schedule_event', array($this, 'filter_cron_events'));
/*
* Disable Theme Updates
* 2.8 to 3.0
*/
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'admin_init', '_maybe_update_themes' );
remove_action( 'wp_update_themes', 'wp_update_themes' );
wp_clear_scheduled_hook( 'wp_update_themes' );
/*
* 3.0
*/
remove_action( 'load-update-core.php', 'wp_update_themes' );
wp_clear_scheduled_hook( 'wp_update_themes' );
/*
* Disable Plugin Updates
* 2.8 to 3.0
*/
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'admin_init', '_maybe_update_plugins' );
remove_action( 'wp_update_plugins', 'wp_update_plugins' );
wp_clear_scheduled_hook( 'wp_update_plugins' );
/*
* 3.0
*/
remove_action( 'load-update-core.php', 'wp_update_plugins' );
wp_clear_scheduled_hook( 'wp_update_plugins' );
/*
* Disable Core Updates
* 2.8 to 3.0
*/
add_action( 'init', create_function( '', 'remove_action( \'init\', \'wp_version_check\' );' ), 2 );
add_filter( 'pre_option_update_core', '__return_null' );
remove_action( 'wp_version_check', 'wp_version_check' );
remove_action( 'admin_init', '_maybe_update_core' );
wp_clear_scheduled_hook( 'wp_version_check' );
/*
* 3.0
*/
wp_clear_scheduled_hook( 'wp_version_check' );
/*
* 3.7+
*/
remove_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
remove_action( 'admin_init', 'wp_maybe_auto_update' );
remove_action( 'admin_init', 'wp_auto_update_core' );
wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
}
/**
* Check the outgoing request
*
* @since 1.4.4
*/
public function block_request($pre, $args, $url) {
/* Empty url */
if( empty( $url ) ) {
return $pre;
}
/* Invalid host */
if( !$host = parse_url($url, PHP_URL_HOST) ) {
return $pre;
}
$url_data = parse_url( $url );
/* block request */
if( false !== stripos( $host, 'api.wordpress.org' ) && (false !== stripos( $url_data['path'], 'update-check' ) || false !== stripos( $url_data['path'], 'browse-happy' )) ) {
return true;
}
return $pre;
}
/**
* Filter cron events
*
* @since 1.5.0
*/
public function filter_cron_events($event) {
$ignore = array(
'wp_version_check',
'wp_update_plugins',
'wp_update_themes',
'wp_maybe_auto_update'
);
if( in_array($event->hook, $ignore) ) {
return false;
}
return $event;
}
/**
* Override core version check info
*
* @since 1.4.3
*/
public function last_checked_core() {
global $wp_version;
return (object) array(
'last_checked' => time(),
'updates' => array(),
'version_checked' => $wp_version
);
}
/**
* Override themes version check info
*
* @since 1.4.3
*/
public function last_checked_themes() {
global $wp_version;
if( count( wp_get_themes() ) > 0 ) foreach( wp_get_themes() as $theme ) $this->__themeFiles[$theme->get_stylesheet()] = $theme->get('Version');
return (object) array(
'last_checked' => time(),
'updates' => array(),
'version_checked' => $wp_version,
'checked' => $this->__themeFiles
);
}
/**
* Override plugins version check info
*
* @since 1.4.3
*/
public function last_checked_plugins() {
global $wp_version;
if( !function_exists( 'get_plugins' ) ) require_once ABSPATH . 'wp-admin/includes/plugin.php';
if( count( get_plugins() ) > 0 ) foreach( get_plugins() as $file => $pl ) $this->__pluginsFiles[$file] = $pl['Version'];
return (object) array(
'last_checked' => time(),
'updates' => array(),
'version_checked' => $wp_version,
'checked' => $this->__pluginsFiles
);
}
}
if ( class_exists('OS_Disable_WordPress_Updates') ) {
$OS_Disable_WordPress_Updates = new OS_Disable_WordPress_Updates();
}
?>
\ No newline at end of file
<?php
/*
Plugin Name: Disable WordPress Core Updates
Description: Disables WordPress core update checks and notifications.
Plugin URI: https://lud.icro.us/disable-wordpress-core-update/
Version: 1.5
Author: John Blackbourn
Author URI: https://johnblackbourn.com/
License: GPL v2 or later
Network: true
Props: Matt Mullenweg, _ck_, miqrogroove
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
# 2.3 to 2.7:
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
# 2.8+:
remove_action( 'wp_version_check', 'wp_version_check' );
remove_action( 'admin_init', '_maybe_update_core' );
add_filter( 'pre_transient_update_core', create_function( '$a', "return null;" ) );
# 3.0+:
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
=== Disable WordPress Core Updates ===
Contributors: johnbillion
Tags: disable, core update
Requires at least: 2.3
Tested up to: 3.7
Stable tag: trunk
Disables WordPress core update checks and notifications.
== Description ==
Completely disables the core update checking system in WordPress. This prevents WordPress from checking for core updates, and prevents any notifications from being displayed in the admin area. Ideal for administrators of multiple WordPress installations.
= Please note! =
It's *very* important that you keep your WordPress installation(s) up to date. If you don't, your blog or website could be susceptible to security vulnerabilities or performance issues. If you use this plugin, you must make sure you keep yourself informed of new WordPress releases and update your WordPress installation(s) as new versions are released.
See also: [Disable WordPress plugin updates](http://wordpress.org/plugins/disable-wordpress-plugin-updates/) and [Disable WordPress theme updates](http://wordpress.org/plugins/disable-wordpress-theme-updates/).
== Installation ==
1. Unzip the ZIP file and drop the folder straight into your `wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
== Frequently Asked Questions ==
= Why would I want to disable the core update system? =
Most people will not want to (and should not) disable this feature. It's a fantastic feature of WordPress and I'm fully in support of it. However, administrators who maintain multiple installations of WordPress on behalf of other people (eg. clients) may not want update notifications to be shown to the users of these installations. This plugin is for them.
= Does this plugin disable the automatic updates in WordPress 3.7 and higher? =
Yes, this plugin completely disables all core update checks, so the automatic update system will be disabled too.
= Can I disable the plugin update notifications too? =
Yes. See the [Disable WordPress Plugin Updates](http://wordpress.org/extend/plugins/disable-wordpress-plugin-updates/) plugin.
= Can I disable the theme update notifications too? =
Yes. See the [Disable WordPress Theme Updates](http://wordpress.org/extend/plugins/disable-wordpress-theme-updates/) plugin.
== Changelog ==
= 1.5 =
* Force the plugin to be network enabled.
= 1.4 =
* Support for WordPress 3.0.
= 1.3 =
* Support for WordPress 2.8.
= 1.2 =
* Bugfix to completely prevent any communication with api.wordpress.org.
= 1.1 =
* Initial release.
<?php
/*
Plugin Name: Disable WordPress Plugin Updates
Description: Disables the plugin update checking and notification system.
Plugin URI: http://lud.icro.us/disable-wordpress-plugin-updates/
Version: 1.4
Author: John Blackbourn
Author URI: http://johnblackbourn.com/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
# 2.3 to 2.7:
add_action( 'admin_menu', create_function( '$a', "remove_action( 'load-plugins.php', 'wp_update_plugins' );") );
# Why use the admin_menu hook? It's the only one available between the above hook being added and being applied
add_action( 'admin_init', create_function( '$a', "remove_action( 'admin_init', 'wp_update_plugins' );"), 2 );
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_update_plugins' );"), 2 );
add_filter( 'pre_option_update_plugins', create_function( '$a', "return null;" ) );
# 2.8 to 3.0:
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'admin_init', '_maybe_update_plugins' );
remove_action( 'wp_update_plugins', 'wp_update_plugins' );
add_filter( 'pre_transient_update_plugins', create_function( '$a', "return null;" ) );
# 3.0:
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
?>
\ No newline at end of file
=== Disable WordPress Plugin Updates ===
Contributors: johnbillion
Donate link: http://lud.icro.us/donations/
Tags: disable, plugin, updates
Requires at least: 2.3
Tested up to: 3.0
Stable tag: trunk
Disables the plugin update checking and notification system.
== Description ==
Completely disables the plugin update checking system in WordPress. The plugin prevents WordPress from checking for updates, and prevents any notifications from being displayed on the Plugins page. Ideal for administrators of multiple WordPress installations.
= Please note! =
It's *very* important that you keep your WordPress plugins up to date. If you don't, your blog or website could be susceptible to security vulnerabilities or performance issues. If you use this plugin, you must make sure you keep yourself up to date with new releases of your active plugins and update them as new versions are released.
== Installation ==
1. Unzip the ZIP file and drop the folder straight into your `wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
== Frequently Asked Questions ==
= Why would I want to disable the plugin update system? =
Most people will not want to (and should not) disable this feature. It's a fantastic feature WordPress and I'm fully in support of it. However, administrators who maintain multiple installations of WordPress on behalf of other people (eg. clients) may not want plugin update notifications to be shown to the users of these installations. This plugin is for them.
= Can I disable the WordPress core update notifications too? =
Yes. Please see the [Disable WordPress Core Update](http://wordpress.org/extend/plugins/disable-wordpress-core-update/) plugin.
= Can I disable the theme update notifications too? =
Yes. Please see the [Disable WordPress Theme Updates](http://wordpress.org/extend/plugins/disable-wordpress-theme-updates/) plugin.
== Changelog ==
= 1.4 =
* Preemptive support for WordPress 3.0.
= 1.3 =
* Support for WordPress 2.8.
= 1.2 =
* Support for WordPress 2.6.
= 1.0 =
* Initial release.
<?php
/*
Plugin Name: Disable WordPress Theme Updates
Description: Disables the theme update checking and notification system.
Plugin URI: http://lud.icro.us/wordpress-plugin-disable-theme-updates/
Version: 1.1
Author: John Blackbourn
Author URI: http://johnblackbourn.com/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
# 2.8 to 3.0:
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'admin_init', '_maybe_update_themes' );
remove_action( 'wp_update_themes', 'wp_update_themes' );
add_filter( 'pre_transient_update_themes', create_function( '$a', "return null;" ) );
# 3.0:
remove_action( 'load-update-core.php', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
?>
\ No newline at end of file
=== Disable WordPress Theme Updates ===
Contributors: johnbillion
Donate link: http://lud.icro.us/donations/
Tags: disable, theme, updates
Requires at least: 2.8
Tested up to: 3.4
Stable tag: trunk
Disables the theme update checking and notification system.
== Description ==
Completely disables the theme update checking system in WordPress 2.8 and later. The plugin prevents WordPress from checking for updates, and prevents any notifications from being displayed on the Themes page. Ideal for administrators of multiple WordPress installations.
= Please note! =
It's important that you keep your WordPress themes up to date. If you don't, your blog or website could be susceptible to security vulnerabilities or performance issues. If you use this plugin, you must make sure you keep yourself up to date with new releases of your themes and update them as new versions are released.
== Installation ==
1. Unzip the ZIP file and drop the folder straight into your `wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
== Frequently Asked Questions ==
= Why would I want to disable the theme update system? =
Most people will not want to (and should not) disable this feature. It's a fantastic feature of WordPress and I'm fully in support of it. However, administrators who maintain multiple installations of WordPress on behalf of other people (eg. clients) may not want theme update notifications to be shown to the users of these installations. This plugin is for them.
= Can I disable the plugin update notifications too? =
Yes. Please see the [Disable WordPress Plugin Updates](http://wordpress.org/extend/plugins/disable-wordpress-plugin-updates/) plugin.
= Can I disable the WordPress core update notifications too? =
Yes. Please see the [Disable WordPress Core Update](http://wordpress.org/extend/plugins/disable-wordpress-core-update/) plugin.
== Changelog ==
= 1.1 =
* Preemptive support for WordPress 3.0.
= 1.0 =
* Initial release.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment