diff --git a/changelog.md b/changelog.md index 2aa35bb..b19b9ee 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,10 @@ 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). +# [1.6.1] - 2024-04-19 +* Change - the `airplane-mode` command now installs the plugin in the must-use plugins directory instead of the plugins directory. +* Fixed - `.bat` file now uses the correct path to the `slic` executable on Windows. + # [1.6.0] - 2024-04-10 * Added - The `slic update-dump` command to update a dump file for the current project, with an optional WordPress version update, e.g. `slic update-dump tests/_data/dump.sql latest`. diff --git a/slic.bat b/slic.bat index 2385086..6844533 100644 --- a/slic.bat +++ b/slic.bat @@ -4,4 +4,4 @@ if "%PHP_PEAR_PHP_BIN%" neq "" ( set PHPBIN=%PHP_PEAR_PHP_BIN% ) else set PHPBIN=php -"%PHPBIN%" "slic" %* +"%PHPBIN%" "%~dp0\slic.php" %* diff --git a/slic.php b/slic.php index fe057b4..b15660a 100644 --- a/slic.php +++ b/slic.php @@ -34,7 +34,7 @@ ] ); $cli_name = 'slic'; -const CLI_VERSION = '1.6.0'; +const CLI_VERSION = '1.6.1'; // If the run-time option `-q`, for "quiet", is specified, then do not print the header. if ( in_array( '-q', $argv, true ) || ( in_array( 'exec', $argv, true ) && ! in_array( 'help', $argv, true ) ) ) { diff --git a/src/commands/airplane-mode.php b/src/commands/airplane-mode.php index 8960e2b..647de93 100644 --- a/src/commands/airplane-mode.php +++ b/src/commands/airplane-mode.php @@ -42,8 +42,19 @@ setup_id(); ensure_wordpress_ready(); -$ensure_airplane_mode_plugin = static function () { - $plugin_dir = slic_plugins_dir( 'airplane-mode' ); +$ensure_airplane_mode_plugin_present = static function () { + $mu_plugins_dir = slic_mu_plugins_dir(); + $plugin_dir = $mu_plugins_dir . DIRECTORY_SEPARATOR . 'airplane-mode'; + + if ( + ! is_dir( dirname( $mu_plugins_dir ) ) + && ! mkdir( $concurrentDirectory = dirname( $mu_plugins_dir ), 0755, true ) + && ! is_dir( $concurrentDirectory ) + ) { + echo magenta( "Failed to create mu-plugins directory {$mu_plugins_dir}." ); + exit( 1 ); + } + if ( ! is_dir( $plugin_dir ) ) { $cloned = process_realtime( 'git clone https://github.com/norcross/airplane-mode ' . $plugin_dir ); if ( $cloned !== 0 ) { @@ -51,19 +62,51 @@ exit( 1 ); } } + + if ( + is_file( $mu_plugins_dir . DIRECTORY_SEPARATOR . 'airplane-mode.php' ) + && ! unlink( $mu_plugins_dir . DIRECTORY_SEPARATOR . 'airplane-mode.php' ) + ) { + echo magenta( "Failed to remove the airplane-mode plugin." ); + exit( 1 ); + } + + $loader_code = <<< PHP +