From 214d27df3ef2fc3e9d182c8053465f5ecb419769 Mon Sep 17 00:00:00 2001 From: lucha <lucha@paranoici.org> Date: Fri, 22 May 2020 16:25:17 -0700 Subject: [PATCH] wordpress-disable-patches The patch is taken from the git repo noblogs-wp. It does not apply cleany (yet), since there is an annoying issue with mu-plugins. They have to be single files, but they are not distributed as single files. There is a tool which auto-loads them, but I think the mismatch in the directories still causes the patch do not apply nicely. We have few mu-plugins and we do not update them often, we could think of some solution specific to this problem later. --- composer.json | 13 ++- composer.lock | 74 ++++++++++++++- composer.patches.json | 4 +- ...Updates-to-run-checks-during-cron-jo.patch | 95 +++++++++++++++++++ 4 files changed, 179 insertions(+), 7 deletions(-) create mode 100644 patches/0001-Patched-Disable-Updates-to-run-checks-during-cron-jo.patch diff --git a/composer.json b/composer.json index e6720284..e4dee522 100644 --- a/composer.json +++ b/composer.json @@ -19,19 +19,24 @@ "require": { "php": ">=7.1", "composer/installers": "^1.8", - "bjornjohansen/wplang": "^0.1.1", + "cweagans/composer-patches": "^1.6", "johnpbloch/wordpress": "^5.4", - "cweagans/composer-patches": "^1.6" + "bjornjohansen/wplang": "^0.1.1", + "lkwdwrd/wp-muplugin-loader": "^1.0", + "wpackagist-plugin/disable-wordpress-updates": "^1.6" }, "extra": { "wordpress-install-dir": "web/wp", - "installer-paths": { + "installer-paths": { "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"], "web/app/plugins/{$name}/": ["type:wordpress-plugin"], "web/app/themes/{$name}/": ["type:wordpress-theme"] }, "wordpress-language-dir": "web/app/languages", "wordpress-languages": [ "en_GB", "it_IT" ], - "patches-file": "composer.patches.json" + "patches-file": "composer.patches.json", + "force-mu": [ + "disable-wordpress-updates" + ] } } diff --git a/composer.lock b/composer.lock index fe55c538..c919239b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "78de47021de3f6d73ac952f29753b897", + "content-hash": "c11b8cb708d8b64038e9a413cd8f254c", "packages": [ { "name": "bjornjohansen/wplang", @@ -343,6 +343,78 @@ "wordpress" ], "time": "2018-11-09T20:10:38+00:00" + }, + { + "name": "lkwdwrd/wp-muplugin-loader", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/lkwdwrd/wp-muplugin-loader.git", + "reference": "aed228e0037fc243c116a0d2d69076db5ed7d96b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lkwdwrd/wp-muplugin-loader/zipball/aed228e0037fc243c116a0d2d69076db5ed7d96b", + "reference": "aed228e0037fc243c116a0d2d69076db5ed7d96b", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "10up/wp_mock": "dev-dev", + "codeclimate/php-test-reporter": "^0.4.4", + "phpunit/phpunit": "^7.1.4" + }, + "type": "composer-plugin", + "extra": { + "class": "LkWdwrd\\Composer\\MULoaderPlugin" + }, + "autoload": { + "psr-4": { + "LkWdwrd\\Composer\\": "src/lkwdwrd/Composer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Luke Woodward", + "email": "woodward.lucas@gmail.com" + } + ], + "description": "A drop-in MU Plugin loader for WordPress", + "keywords": [ + "loader", + "muplugin", + "wordpress" + ], + "time": "2018-04-20T22:09:51+00:00" + }, + { + "name": "wpackagist-plugin/disable-wordpress-updates", + "version": "1.6.6", + "source": { + "type": "svn", + "url": "https://plugins.svn.wordpress.org/disable-wordpress-updates/", + "reference": "tags/1.6.6" + }, + "dist": { + "type": "zip", + "url": "https://downloads.wordpress.org/plugin/disable-wordpress-updates.1.6.6.zip", + "reference": null, + "shasum": null + }, + "require": { + "composer/installers": "~1.0" + }, + "type": "wordpress-muplugin", + "extra": { + "patches_applied": [] + }, + "homepage": "https://wordpress.org/plugins/disable-wordpress-updates/" } ], "packages-dev": [], diff --git a/composer.patches.json b/composer.patches.json index 190b7fea..3ef90353 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -1,7 +1,7 @@ { "patches": { - "vendor/project": { - "Patch title": "patches/patch.patch" + "wpackagist-plugin/disable-wordpress-updates": { + "Patch title": "patches/0001-Patched-Disable-Updates-to-run-checks-during-cron-jo.patch" } } } diff --git a/patches/0001-Patched-Disable-Updates-to-run-checks-during-cron-jo.patch b/patches/0001-Patched-Disable-Updates-to-run-checks-during-cron-jo.patch new file mode 100644 index 00000000..22c407ae --- /dev/null +++ b/patches/0001-Patched-Disable-Updates-to-run-checks-during-cron-jo.patch @@ -0,0 +1,95 @@ +From a4968df0b59c116fb8118fd625c5ed12e5e53d6d Mon Sep 17 00:00:00 2001 +From: lucha <lucha@paranoici.org> +Date: Wed, 19 Apr 2017 14:44:43 +0200 +Subject: [PATCH] Patched Disable Updates to run checks during cron jobs + +--- + wp-content/mu-plugins/disable-updates.php | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/wp-content/mu-plugins/disable-updates.php b/wp-content/mu-plugins/disable-updates.php +index e3139547..dd58cca5 100644 +--- a/wp-content/mu-plugins/disable-updates.php ++++ b/wp-content/mu-plugins/disable-updates.php +@@ -59,6 +59,8 @@ class OS_Disable_WordPress_Updates { + * @author scripts@schloebe.de + */ + function __construct() { ++ if (!defined('AI_CRON_SCRIPT')) { ++ + add_action( 'admin_init', array(&$this, 'admin_init') ); + + /* +@@ -92,8 +94,8 @@ class OS_Disable_WordPress_Updates { + * 3.0 + */ + add_filter( 'pre_site_transient_update_core', array($this, 'last_checked_atm') ); +- +- ++ ++ + /* + * Filter schedule checks + * +@@ -129,6 +131,7 @@ class OS_Disable_WordPress_Updates { + if( !defined( 'WP_AUTO_UPDATE_CORE') ) define( 'WP_AUTO_UPDATE_CORE', false ); + + add_filter( 'pre_http_request', array($this, 'block_request'), 10, 3 ); ++ } + } + + +@@ -140,13 +143,13 @@ class OS_Disable_WordPress_Updates { + */ + function admin_init() { + if ( !function_exists("remove_action") ) return; +- ++ + /* + * Remove 'update plugins' option from bulk operations select list + */ + global $current_user; + $current_user->allcaps['update_plugins'] = 0; +- ++ + /* + * Hide maintenance and update nag + */ +@@ -154,7 +157,7 @@ class OS_Disable_WordPress_Updates { + remove_action( 'network_admin_notices', 'update_nag', 3 ); + remove_action( 'admin_notices', 'maintenance_nag' ); + remove_action( 'network_admin_notices', 'maintenance_nag' ); +- ++ + + /* + * Disable Theme Updates +@@ -263,8 +266,8 @@ class OS_Disable_WordPress_Updates { + } + return $event; + } +- +- ++ ++ + /** + * Override version check info + * +@@ -272,12 +275,12 @@ class OS_Disable_WordPress_Updates { + */ + public function last_checked_atm( $t ) { + include( ABSPATH . WPINC . '/version.php' ); +- ++ + $current = new stdClass; + $current->updates = array(); + $current->version_checked = $wp_version; + $current->last_checked = time(); +- ++ + return $current; + } + } +-- +2.17.1 + -- GitLab