WordPress.org

Make WordPress Core

Ticket #31410: 31410.patch

File 31410.patch, 2.7 KB (added by elusiveunit, 6 years ago)
Line 
1Index: wp-admin/menu.php
2===================================================================
3--- wp-admin/menu.php   (revision 31466)
4+++ wp-admin/menu.php   (working copy)
5@@ -33,7 +33,7 @@
6 if ( ! is_multisite() || is_super_admin() )
7        $update_data = wp_get_update_data();
8
9-if ( ! is_multisite() ) {
10+if ( ! is_multisite() && ! ( defined( 'DISABLE_UPDATES' ) && DISABLE_UPDATES ) ) {
11        if ( current_user_can( 'update_core' ) )
12                $cap = 'update_core';
13        elseif ( current_user_can( 'update_plugins' ) )
14Index: wp-includes/update.php
15===================================================================
16--- wp-includes/update.php      (revision 31466)
17+++ wp-includes/update.php      (working copy)
18@@ -21,7 +21,7 @@
19  * @return null|false Returns null if update is unsupported. Returns false if check is too soon.
20  */
21 function wp_version_check( $extra_stats = array(), $force_check = false ) {
22-       if ( defined('WP_INSTALLING') )
23+       if ( defined( 'WP_INSTALLING' ) || ( defined( 'DISABLE_UPDATES' ) && DISABLE_UPDATES ) )
24                return;
25
26        global $wpdb, $wp_local_package;
27@@ -185,7 +185,7 @@
28 function wp_update_plugins( $extra_stats = array() ) {
29        include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
30
31-       if ( defined('WP_INSTALLING') )
32+       if ( defined( 'WP_INSTALLING' ) || ( defined( 'DISABLE_UPDATES' ) && DISABLE_UPDATES ) )
33                return false;
34
35        // If running blog-side, bail unless we've not checked in the last 12 hours
36@@ -339,7 +339,7 @@
37 function wp_update_themes( $extra_stats = array() ) {
38        include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
39
40-       if ( defined( 'WP_INSTALLING' ) )
41+       if ( defined( 'WP_INSTALLING' ) || ( defined( 'DISABLE_UPDATES' ) && DISABLE_UPDATES ) )
42                return false;
43
44        $installed_themes = wp_get_themes();
45@@ -624,6 +624,9 @@
46  * @since 3.1.0
47  */
48 function wp_schedule_update_checks() {
49+       if ( defined( 'DISABLE_UPDATES' ) && DISABLE_UPDATES )
50+               return;
51+
52        if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )
53                wp_schedule_event(time(), 'twicedaily', 'wp_version_check');
54Index: wp-admin/update-core.php
55===================================================================
56--- wp-admin/update-core.php    (revision 31466)
57+++ wp-admin/update-core.php    (working copy)
58@@ -21,6 +21,8 @@
59
60 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
61        wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
62+elseif ( defined( 'DISABLE_UPDATES' ) && DISABLE_UPDATES )
63+       wp_die( __( 'Updates for this site are disabled with the <code>DISABLE_UPDATES</code> constant in <code>wp-config.php</code>.' ) );
64
65 function list_core_update( $update ) {
66        global $wp_local_package, $wpdb, $wp_version;