From e2050f5b11bde0f56bd7c3fcff595143a3c57572 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 25 Jan 2014 08:14:31 +0100 Subject: [PATCH] update to 3.8.1 + disable auto-updater --- .gitignore | 1 + sources | 2 +- wordpress-3.8.1-config.patch | 32 +++++++++++++ wordpress-3.8.1-noupdate.patch | 86 ++++++++++++++++++++++++++++++++++ wordpress.spec | 51 ++++++++++++++------ 5 files changed, 157 insertions(+), 15 deletions(-) create mode 100644 wordpress-3.8.1-config.patch create mode 100644 wordpress-3.8.1-noupdate.patch diff --git a/.gitignore b/.gitignore index 2dc89cd..fb01b80 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ clog /wordpress-3.7.tar.gz /wordpress-3.7.1.tar.gz /wordpress-3.8.tar.gz +/wordpress-3.8.1.tar.gz diff --git a/sources b/sources index bcc3eca..f55410e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0999d444137ecc4a36355403a67096e4 wordpress-3.8.tar.gz +6da5f73a2c7a46457b6ceb20fb6166c2 wordpress-3.8.1.tar.gz diff --git a/wordpress-3.8.1-config.patch b/wordpress-3.8.1-config.patch new file mode 100644 index 0000000..9f50f11 --- /dev/null +++ b/wordpress-3.8.1-config.patch @@ -0,0 +1,32 @@ +diff -up wordpress/wp-config.php.old wordpress/wp-config.php +--- wordpress/wp-config.php.old 2014-01-25 07:47:17.622959116 +0100 ++++ wordpress/wp-config.php 2014-01-25 07:54:06.816454385 +0100 +@@ -72,6 +72,19 @@ $table_prefix = 'wp_'; + 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); ++ ++/* Core update is always disabled, WP_AUTO_UPDATE_CORE value is ignore */ ++ ++/** + * For developers: WordPress debugging mode. + * + * Change this to true to enable the display of notices during development. +@@ -84,7 +97,7 @@ define('WP_DEBUG', false); + + /** 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..c2b2f6f --- /dev/null +++ b/wordpress-3.8.1-noupdate.patch @@ -0,0 +1,86 @@ +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 2013-12-11 20:49:11.000000000 +0100 ++++ wordpress/wp-admin/includes/class-wp-upgrader.php 2014-01-25 07:51:32.794892043 +0100 +@@ -1479,6 +1479,9 @@ class Core_Upgrader extends WP_Upgrader + } + } + ++ // RPM: nether allow core update ++ return false; ++ + // 1: If we're already on that version, not much point in updating? + if ( $offered_ver == $wp_version ) + return false; +@@ -1640,7 +1643,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 2013-12-02 22:55:10.000000000 +0100 ++++ wordpress/wp-admin/includes/update.php 2014-01-25 07:48:42.202268342 +0100 +@@ -216,8 +216,6 @@ function update_nag() { + } + echo "
$msg
"; + } +-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 .= " " . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . ''; ++ $msg .= ''; + } + + echo "$msg"; +diff -up wordpress/wp-includes/capabilities.php.nop wordpress/wp-includes/capabilities.php +--- wordpress/wp-includes/capabilities.php.nop 2013-11-13 05:39:08.000000000 +0100 ++++ wordpress/wp-includes/capabilities.php 2014-01-25 07:48:42.202268342 +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 2013-11-15 04:04:10.000000000 +0100 ++++ wordpress/wp-includes/update.php 2014-01-25 07:48:42.202268342 +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 76585f9..bbd213a 100644 --- a/wordpress.spec +++ b/wordpress.spec @@ -10,9 +10,9 @@ Summary: Blog tool and publishing platform URL: http://www.wordpress.org Name: wordpress -Version: 3.8 +Version: 3.8.1 Group: Applications/Publishing -Release: 1%{?dist} +Release: 3%{?dist} License: GPLv2 Source0: http://wordpress.org/%{name}-%{version}.tar.gz @@ -36,6 +36,15 @@ 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 +# ignore WP_AUTO_UPDATE_CORE (always false) +Patch6: wordpress-3.8.1-noupdate.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -118,31 +127,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 -p1 +%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 +236,17 @@ rm -rf ${RPM_BUILD_ROOT} %dir %{_sysconfdir}/wordpress %changelog +* Sat Jan 25 2014 Remi Collet - 3.8.1-3 +- ignore WP_AUTO_UPDATE_CORE (always false) + +* Fri Jan 24 2014 Remi Collet - 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 - 3.8.1-1 +- new upstream release 3.8.1 (bugfixes) + * Mon Dec 16 2013 Remi Collet - 3.8-1 - update to 3.8 “Parker” #1043104 - link to README.fedora in package description