From c7b3019ca9b476a8705704cc8e1ff1e55b89fa4b Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Sat, 14 Dec 2024 18:36:08 +0000 Subject: [PATCH 1/9] Rector: Ignore config from production distribution --- .distignore | 1 + .gitattributes | 1 + 2 files changed, 2 insertions(+) diff --git a/.distignore b/.distignore index 8a6ee45..06f366e 100644 --- a/.distignore +++ b/.distignore @@ -9,4 +9,5 @@ /package.json /package-lock.json /phpunit.xml.dist +/rector.php /tests diff --git a/.gitattributes b/.gitattributes index 683ce81..60b89b6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,6 +13,7 @@ /.phpcs.xml.dist export-ignore /CHANGELOG.md export-ignore /phpunit.xml.dist export-ignore +/rector.php export-ignore # Auto detect text files and perform LF normalization # https://pablorsk.medium.com/be-a-git-ninja-the-gitattributes-file-e58c07c9e915 From 6160d125dbee3a35c95366061734f577b3b0bc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Thu, 26 Dec 2024 12:50:12 +0100 Subject: [PATCH 2/9] Fix typos --- maintenance-mode.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maintenance-mode.php b/maintenance-mode.php index d2ff31f..ff4b59f 100644 --- a/maintenance-mode.php +++ b/maintenance-mode.php @@ -147,7 +147,7 @@ function vip_maintenance_mode_restrict_rest_api( $result ) { } $error_message = apply_filters( 'vip_maintenance_mode_rest_api_error_message', __( 'REST API access is currently restricted while this site is undergoing maintenance.', 'maintenance-mode' ) ); - $maintenace_rest_error = new WP_Error( + $maintenance_rest_error = new WP_Error( 'vip_maintenance_mode_rest_error', $error_message, array( @@ -156,11 +156,11 @@ function vip_maintenance_mode_restrict_rest_api( $result ) { ); if ( ! is_user_logged_in() ) { - return $maintenace_rest_error; + return $maintenance_rest_error; } if ( ! vip_maintenance_mode_current_user_can_bypass() ) { - return $maintenace_rest_error; + return $maintenance_rest_error; } return $result; From 160d90a87316042daca27527edc9824a835b67c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Thu, 26 Dec 2024 12:51:49 +0100 Subject: [PATCH 3/9] Fix a typo in vipgo-helper --- vipgo-helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vipgo-helper.php b/vipgo-helper.php index b6b39ef..693ef1f 100644 --- a/vipgo-helper.php +++ b/vipgo-helper.php @@ -17,7 +17,7 @@ * This function sets the filter response that Maintenance Mode uses to determine if it should set the 503 status header or not. * * @param bool $should_set_503 Whether Maintenance Mode should set a 503 header. - * @return bool Indiciate whether a Maintenance Mode sets a 503 header. + * @return bool Indicate whether a Maintenance Mode sets a 503 header. */ function vip_maintenance_mode_do_not_respond_503_for_services( $should_set_503 ): bool { $user_agent = filter_input( INPUT_SERVER, 'HTTP_USER_AGENT', FILTER_SANITIZE_SPECIAL_CHARS ); From f67daa125dc7e744366fafffff9c4adc4a14ad52 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Sun, 29 Dec 2024 11:29:00 +0000 Subject: [PATCH 4/9] chore(Composer): Add Rector and rector command --- composer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/composer.json b/composer.json index b22c69d..c43f67f 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "php-parallel-lint/php-parallel-lint": "^1.0", "phpcompatibility/phpcompatibility-wp": "^2.1", "phpunit/phpunit": "^9", + "rector/rector": "^1", "wp-coding-standards/wpcs": "^3", "yoast/phpunit-polyfills": "^1.1" }, @@ -38,6 +39,9 @@ "prepare": [ "bash bin/install-wp-tests.sh wordpress_test root root localhost" ], + "rector": [ + "@php ./vendor/bin/rector" + ], "test": [ "@php ./vendor/bin/phpunit --testsuite WP_Tests" ], From f5bf7e44b4502a0a6947aaa2f64b8eb6199a7980 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Sun, 29 Dec 2024 11:52:17 +0000 Subject: [PATCH 5/9] style: Fix CS issue --- maintenance-mode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintenance-mode.php b/maintenance-mode.php index ff4b59f..b707d65 100644 --- a/maintenance-mode.php +++ b/maintenance-mode.php @@ -146,7 +146,7 @@ function vip_maintenance_mode_restrict_rest_api( $result ) { return $result; } - $error_message = apply_filters( 'vip_maintenance_mode_rest_api_error_message', __( 'REST API access is currently restricted while this site is undergoing maintenance.', 'maintenance-mode' ) ); + $error_message = apply_filters( 'vip_maintenance_mode_rest_api_error_message', __( 'REST API access is currently restricted while this site is undergoing maintenance.', 'maintenance-mode' ) ); $maintenance_rest_error = new WP_Error( 'vip_maintenance_mode_rest_error', $error_message, From a7ceedca2b615bd187458ed182b237f823251ee0 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Sun, 29 Dec 2024 12:13:22 +0000 Subject: [PATCH 6/9] ci: Install subversion --- .github/workflows/integrations.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/integrations.yml b/.github/workflows/integrations.yml index 7a445a1..1905916 100644 --- a/.github/workflows/integrations.yml +++ b/.github/workflows/integrations.yml @@ -68,6 +68,11 @@ jobs: - name: Start MySQL Service run: sudo systemctl start mysql.service + - name: Install Subversion + run: | + sudo apt-get update + sudo apt-get install subversion + - name: Prepare environment for integration tests run: composer prepare ${{ matrix.wordpress }} From 1e9ef5d9e7fc2e93f3a1d422a2a594de19057366 Mon Sep 17 00:00:00 2001 From: Carlos Faria Date: Mon, 27 Jan 2025 17:58:31 +0100 Subject: [PATCH 7/9] Don't load template twice If there is a template-maintenance-mode.php in the theme, get_template_part returns null when loaded, and this is treated as a falsy value resulting in loading the default template-maintenance-mode.php too. --- maintenance-mode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintenance-mode.php b/maintenance-mode.php index b707d65..08d44b6 100644 --- a/maintenance-mode.php +++ b/maintenance-mode.php @@ -120,7 +120,7 @@ function vip_maintenance_mode_template_redirect(): void { */ $defaults = apply_filters( 'vip_maintenance_mode_template_args', $defaults ); - if ( ! get_template_part( $defaults['slug'], $defaults['name'], $defaults['args'] ) ) { + if ( false === get_template_part( $defaults['slug'], $defaults['name'], $defaults['args'] ) ) { include __DIR__ . '/template-maintenance-mode.php'; } From 6b0399a8d54360a2ee7515ddd690399e1ebde120 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Mon, 27 Jan 2025 20:56:24 +0000 Subject: [PATCH 8/9] Docs: Changes for 0.3.2 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1c3b03..c1b64dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.2] - 2025-01-27 + +### Fixed +* Don't load template twice by @cfaria in https://github.com/Automattic/maintenance-mode-wp/pull/70 + +### Maintenance +* Fix typos by @szepeviktor in https://github.com/Automattic/maintenance-mode-wp/pull/67 +* Add Rector and rector command by @GaryJones in https://github.com/Automattic/maintenance-mode-wp/pull/68 +* CI: Install subversion by @GaryJones in https://github.com/Automattic/maintenance-mode-wp/pull/69 + ## [0.3.1] - 2024-12-14 ### Maintenance @@ -93,6 +103,7 @@ Predominantly a maintenance release, though it does include a couple of added ch ## 0.1.0 - 2017-02-16 - Initial release. +[0.3.2]: https://github.com/automattic/maintenance-mode-wp/compare/0.3.1...0.3.2 [0.3.1]: https://github.com/automattic/maintenance-mode-wp/compare/0.3.0...0.3.1 [0.3.0]: https://github.com/automattic/maintenance-mode-wp/compare/0.2.2...0.3.0 [0.2.2]: https://github.com/automattic/maintenance-mode-wp/compare/0.2.1...0.2.2 From 39f3376700f7f10ac846754a2818ccc3e6d340d2 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Mon, 27 Jan 2025 20:57:08 +0000 Subject: [PATCH 9/9] Version 0.3.2 --- README.md | 2 +- maintenance-mode.php | 2 +- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 22213ab..7c0f1a6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Maintenance Mode -Stable tag: 0.3.1 +Stable tag: 0.3.2 Requires at least: 5.9 Tested up to: 6.7 License: GPLv2 or later diff --git a/maintenance-mode.php b/maintenance-mode.php index 08d44b6..6dddfd0 100644 --- a/maintenance-mode.php +++ b/maintenance-mode.php @@ -11,7 +11,7 @@ * Plugin Name: Maintenance Mode * Plugin URI: https://github.com/Automattic/maintenance-mode-wp * Description: Shut down your site for a little while and do some maintenance on it! - * Version: 0.3.1 + * Version: 0.3.2 * Requires at least: 5.9 * Requires PHP: 7.4 * Author: WordPress VIP, Automattic diff --git a/package-lock.json b/package-lock.json index 31963d3..23a93d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "maintenance-mode-wp", - "version": "0.3.1", + "version": "0.3.2", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index c6c1c4c..31e4f50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "maintenance-mode-wp", - "version": "0.3.1", + "version": "0.3.2", "description": "Shut down your site for a little while and do some maintenance on it!", "license": "GPL-2.0-or-later", "private": true,