Make WordPress Core

Ticket #28660: disable-wporg-updates.txt

File disable-wporg-updates.txt, 1.9 KB (added by DavidAnderson, 10 years ago)

Provide header to allow plugin developer to indicate plugin should not be updated via wordpress.org

Line 
1Index: wp-admin/includes/plugin.php
2===================================================================
3--- wp-admin/includes/plugin.php        (revision 28667)
4+++ wp-admin/includes/plugin.php        (working copy)
5@@ -47,6 +47,7 @@
6  *             'TextDomain' - Plugin's text domain for localization.
7  *             'DomainPath' - Plugin's relative directory path to .mo files.
8  *             'Network' - Boolean. Whether the plugin can only be activated network wide.
9+ *             'WordPressOrgUpdate' - Boolean. Whether the plugin should be updated from wordpress.org. Defaults to true.
10  *
11  * Some users have issues with opening large files and manipulating the contents
12  * for want is usually the first 1kiB or 2kiB. This function stops pulling in
13@@ -81,6 +82,7 @@
14                'TextDomain' => 'Text Domain',
15                'DomainPath' => 'Domain Path',
16                'Network' => 'Network',
17+               'WordPressOrgUpdate' => 'WordPress.Org Update',
18                // Site Wide Only is deprecated in favor of Network.
19                '_sitewide' => 'Site Wide Only',
20        );
21@@ -93,6 +95,7 @@
22                $plugin_data['Network'] = $plugin_data['_sitewide'];
23        }
24        $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
25+       $plugin_data['WordPressOrgUpdate'] = ( '0' != $plugin_data['WordPressOrgUpdate'] && 'false' != strtolower( $plugin_data['WordPressOrgUpdate'] ) );
26        unset( $plugin_data['_sitewide'] );
27 
28        if ( $markup || $translate ) {
29Index: wp-includes/update.php
30===================================================================
31--- wp-includes/update.php      (revision 28667)
32+++ wp-includes/update.php      (working copy)
33@@ -228,6 +228,11 @@
34        if ( $time_not_changed && ! $extra_stats ) {
35                $plugin_changed = false;
36                foreach ( $plugins as $file => $p ) {
37+                       if ( false == $p['WordPressOrgUpdate'] ) {
38+                               unset( $plugins[ $file ] );
39+                               continue;
40+                       }
41+
42                        $new_option->checked[ $file ] = $p['Version'];
43 
44                        if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )