[wordpress] - comment provided configuration about auto-updater - disable auto-updater on default configuration

Remi Collet remi at fedoraproject.org
Fri Jan 24 19:17:39 UTC 2014


commit 814a0b32a570d9a9099af7720606f8acaef6542e
Author: Remi Collet <remi at fedoraproject.org>
Date:   Fri Jan 24 20:17:57 2014 +0100

    - comment provided configuration about auto-updater
    - disable auto-updater on default configuration #1057521
    - switch some sed to patch (more robust)

 wordpress-3.8.1-config.patch   |   33 +++++++++++++++++
 wordpress-3.8.1-noupdate.patch |   76 ++++++++++++++++++++++++++++++++++++++++
 wordpress.spec                 |   40 +++++++++++++++------
 3 files changed, 137 insertions(+), 12 deletions(-)
---
diff --git a/wordpress-3.8.1-config.patch b/wordpress-3.8.1-config.patch
new file mode 100644
index 0000000..2447c5a
--- /dev/null
+++ b/wordpress-3.8.1-config.patch
@@ -0,0 +1,33 @@
+--- wp-config.php.old	2014-01-24 19:43:02.483075882 +0100
++++ wp-config.php	2014-01-24 19:52:30.401841036 +0100
+@@ -72,6 +72,21 @@
+ define('WPLANG', '');
+ 
+ /**
++ * See http://make.wordpress.org/core/2013/10/25/the-definitive-guide-to-disabling-auto-updates-in-wordpress-3-7
++ */
++
++/* Disable all file change, as RPM base installation are read-only */
++define('DISALLOW_FILE_MODS', true);
++
++/* Disable automatic updater, in case you want to allow 
++   above FILE_MODS for plugins, themes, ... */
++define('AUTOMATIC_UPDATER_DISABLED', true);
++
++/* Disable change of core, in case you really want to
++   enable AUTOMATIC_UPDATER above, core is manage by package updates */
++define('WP_AUTO_UPDATE_CORE', false);
++
++/**
+  * For developers: WordPress debugging mode.
+  *
+  * Change this to true to enable the display of notices during development.
+@@ -84,7 +99,7 @@
+ 
+ /** Absolute path to the WordPress directory. */
+ if ( !defined('ABSPATH') )
+-	define('ABSPATH', dirname(__FILE__) . '/');
++	define('ABSPATH', '/usr/share/wordpress');
+ 
+ /** Sets up WordPress vars and included files. */
+ require_once(ABSPATH . 'wp-settings.php');
diff --git a/wordpress-3.8.1-noupdate.patch b/wordpress-3.8.1-noupdate.patch
new file mode 100644
index 0000000..58f5d97
--- /dev/null
+++ b/wordpress-3.8.1-noupdate.patch
@@ -0,0 +1,76 @@
+diff -up wordpress/wp-admin/includes/class-wp-upgrader.php.nop wordpress/wp-admin/includes/class-wp-upgrader.php
+--- wordpress/wp-admin/includes/class-wp-upgrader.php.nop	2014-01-24 20:07:50.969565823 +0100
++++ wordpress/wp-admin/includes/class-wp-upgrader.php	2014-01-24 20:08:07.431612588 +0100
+@@ -1640,7 +1640,7 @@ class WP_Automatic_Updater {
+ 	 */
+ 	public function is_disabled() {
+ 		// Background updates are disabled if you don't want file changes.
+-		if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
++		if ( !defined( 'DISALLOW_FILE_MODS' ) || DISALLOW_FILE_MODS )
+ 			return true;
+ 
+ 		if ( defined( 'WP_INSTALLING' ) )
+diff -up wordpress/wp-admin/includes/update.php.nop wordpress/wp-admin/includes/update.php
+--- wordpress/wp-admin/includes/update.php.nop	2014-01-24 19:54:56.488272053 +0100
++++ wordpress/wp-admin/includes/update.php	2014-01-24 19:57:08.816663110 +0100
+@@ -216,8 +216,6 @@ function update_nag() {
+ 	}
+ 	echo "<div class='update-nag'>$msg</div>";
+ }
+-add_action( 'admin_notices', 'update_nag', 3 );
+-add_action( 'network_admin_notices', 'update_nag', 3 );
+ 
+ // Called directly from dashboard
+ function update_right_now_message() {
+@@ -227,7 +225,7 @@ function update_right_now_message() {
+ 		$cur = get_preferred_from_update_core();
+ 
+ 		if ( isset( $cur->response ) && $cur->response == 'upgrade' )
+-			$msg .= " <a href='" . network_admin_url( 'update-core.php' ) . "' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
++			$msg .= '';
+ 	}
+ 
+ 	echo "<span id='wp-version-message'>$msg</span>";
+diff -up wordpress/wp-includes/capabilities.php.nop wordpress/wp-includes/capabilities.php
+--- wordpress/wp-includes/capabilities.php.nop	2014-01-24 20:06:55.607405027 +0100
++++ wordpress/wp-includes/capabilities.php	2014-01-24 20:07:29.225504605 +0100
+@@ -1251,7 +1251,7 @@ function map_meta_cap( $cap, $user_id )
+ 		// Disallow the file editors.
+ 		if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
+ 			$caps[] = 'do_not_allow';
+-		elseif ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
++		elseif ( !defined( 'DISALLOW_FILE_MODS' ) || DISALLOW_FILE_MODS )
+ 			$caps[] = 'do_not_allow';
+ 		elseif ( is_multisite() && ! is_super_admin( $user_id ) )
+ 			$caps[] = 'do_not_allow';
+@@ -1267,7 +1267,7 @@ function map_meta_cap( $cap, $user_id )
+ 	case 'update_core':
+ 		// Disallow anything that creates, deletes, or updates core, plugin, or theme files.
+ 		// Files in uploads are excepted.
+-		if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
++		if ( !defined( 'DISALLOW_FILE_MODS' ) || DISALLOW_FILE_MODS )
+ 			$caps[] = 'do_not_allow';
+ 		elseif ( is_multisite() && ! is_super_admin( $user_id ) )
+ 			$caps[] = 'do_not_allow';
+diff -up wordpress/wp-includes/update.php.nop wordpress/wp-includes/update.php
+--- wordpress/wp-includes/update.php.nop	2014-01-24 19:53:55.978094909 +0100
++++ wordpress/wp-includes/update.php	2014-01-24 19:56:38.817574394 +0100
+@@ -574,9 +574,6 @@ function _maybe_update_themes() {
+  * @since 3.1.0
+  */
+ function wp_schedule_update_checks() {
+-	if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )
+-		wp_schedule_event(time(), 'twicedaily', 'wp_version_check');
+-
+ 	if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
+ 		wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
+ 
+@@ -602,8 +599,6 @@ if ( ( ! is_main_site() && ! is_network_
+ 	return;
+ 
+ add_action( 'admin_init', '_maybe_update_core' );
+-add_action( 'wp_version_check', 'wp_version_check' );
+-add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
+ 
+ add_action( 'load-plugins.php', 'wp_update_plugins' );
+ add_action( 'load-update.php', 'wp_update_plugins' );
diff --git a/wordpress.spec b/wordpress.spec
index eceea7c..ce754b6 100644
--- a/wordpress.spec
+++ b/wordpress.spec
@@ -36,6 +36,14 @@ Patch3: wordpress-3.6-tinymce_noflash.patch
 # changes 'plugins:["flash,"silverlight","youtube","vimeo"]' to
 # 'plugins:["youtube","vimeo"]'
 Patch4: wordpress-3.6-mediaelement-noflash_silverlight.patch
+# RPM configuration:
+# Path to installation
+# Disable auto-updater
+Patch5: wordpress-3.8.1-config.patch
+# RPM are readonly
+# disable version check and updated
+# change DISALLOW_FILE_MODS default value to true
+Patch6: wordpress-3.8.1-noupdate.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch: noarch
@@ -118,31 +126,34 @@ rm -f wp-includes/js/plupload/plupload.flash.js
 rm -rf wp-includes/js/swfupload
 
 %patch0 -p1 -b .dolly
-#%patch1 -p1 -b .rhbz522897
+#patch1 -p1 -b .rhbz522897
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
 
-# disable wp_version_check, updates are always installed via rpm
-sed -i -e "s,\(.*\)'wp_version_check'\(.*\),#\1'wp_version_check'\2,g" \
-	wp-includes/update.php
-# disable update_nag() function
-sed -i -e "s,\(.*\)'update_nag'\(.*\),#\1'update_nag'\2,g; \
-	s,\(.*\)\$msg .=\(.*\),\1\$msg .= '';,g;" \
-	wp-admin/includes/update.php
+# Create RPM configuration
+cp wp-config-sample.php wp-config.php
+%patch5 -p0
+%patch6 -p1
+
 # fix file encoding
 sed -i -e 's/\r//' license.txt
 
+
 %build
 
 %install
-mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/wordpress
-mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/wordpress
+# Apache configuration
 install -m 0644 -D -p %{SOURCE1} ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d/wordpress.conf
+
+# Application
+mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/wordpress
 cp -pr * ${RPM_BUILD_ROOT}%{_datadir}/wordpress
-cat wp-config-sample.php | sed -e "s|dirname(__FILE__).'/'|'/usr/share/wordpress/'|g" > \
-	${RPM_BUILD_ROOT}%{_sysconfdir}/wordpress/wp-config.php
+
+# Configuration
+install -m 0644 -D wp-config.php ${RPM_BUILD_ROOT}%{_sysconfdir}/wordpress/wp-config.php
 /bin/ln -sf ../../../etc/wordpress/wp-config.php ${RPM_BUILD_ROOT}%{_datadir}/wordpress/wp-config.php
+
 /bin/cp %{SOURCE2} ./README.fedora
 /bin/cp %{SOURCE3} ./README.fedora-multiuser
 
@@ -224,6 +235,11 @@ rm -rf ${RPM_BUILD_ROOT}
 %dir %{_sysconfdir}/wordpress
 
 %changelog
+* Sat Jan 24 2014 Remi Collet <remi at fedoraproject.org> - 3.8.1-2
+- comment provided configuration about auto-updater
+- disable auto-updater on default configuration #1057521
+- switch some sed to patch (more robust)
+
 * Thu Jan 23 2014 Adam Williamson <awilliam at redhat.com> - 3.8.1-1
 - new upstream release 3.8.1 (bugfixes)
 


More information about the scm-commits mailing list