From a3b498bb1e92befeae59fe614892b479ce7c8c34 Mon Sep 17 00:00:00 2001 From: oskosk Date: Fri, 6 Apr 2018 16:49:53 -0300 Subject: [PATCH 1/3] Add ability to launch with wp-downgrade installed WP Downgrade adds the ability to install an old version of WordPress --- features/wp-downgrade.php | 40 +++++++++++++++++++++++++++++++++++++++ lib/stuff.php | 1 + 2 files changed, 41 insertions(+) create mode 100644 features/wp-downgrade.php diff --git a/features/wp-downgrade.php b/features/wp-downgrade.php new file mode 100644 index 0000000..2649fb4 --- /dev/null +++ b/features/wp-downgrade.php @@ -0,0 +1,40 @@ + false, + ]; + + add_action( 'jurassic_ninja_add_features_before_auto_login', function( &$app, $features, $domain ) use ( $defaults ) { + $features = array_merge( $defaults, $features ); + if ( $features['wp-downgrade'] ) { + debug( '%s: Adding WP Downgrade', $domain ); + add_wp_downgrade_plugin(); + } + }, 10, 3 ); + + add_filter( 'jurassic_ninja_rest_feature_defaults', function( $defaults ) { + return array_merge( $defaults, [ + 'wp-downgrade' => false, + ] ); + } ); + + add_filter( 'jurassic_ninja_rest_create_request_features', function( $features, $json_params ) { + if ( isset( $json_params['wp-downgrade'] ) ) { + $features['wp-downgrade'] = $json_params['wp-downgrade']; + } + return $features; + }, 10, 2 ); +} ); + +/** + * Installs and activates WP Downgrade on the site. + */ +function add_wp_downgrade_plugin() { + $cmd = 'wp plugin install wp-downgrade --activate' ; + add_filter( 'jurassic_ninja_feature_command', function ( $s ) use ( $cmd ) { + return "$s && $cmd"; + } ); +} diff --git a/lib/stuff.php b/lib/stuff.php index f4f80f2..7eae0eb 100644 --- a/lib/stuff.php +++ b/lib/stuff.php @@ -68,6 +68,7 @@ function require_feature_files() { '/features/wordpress-beta-tester.php', '/features/wp-debug-log.php', '/features/wp-log-viewer.php', + '/features/wp-downgrade.php', '/features/wp-rollback.php', ]; From 1d7bde182badc262088329b994af02f58c1fcd48 Mon Sep 17 00:00:00 2001 From: oskosk Date: Fri, 6 Apr 2018 16:50:58 -0300 Subject: [PATCH 2/3] Fix case in WP Rollback --- features/wp-rollback.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/wp-rollback.php b/features/wp-rollback.php index cd2e891..d122bda 100644 --- a/features/wp-rollback.php +++ b/features/wp-rollback.php @@ -10,7 +10,7 @@ add_action( 'jurassic_ninja_add_features_before_auto_login', function( &$app, $features, $domain ) use ( $defaults ) { $features = array_merge( $defaults, $features ); if ( $features['wp-rollback'] ) { - debug( '%s: Adding Wp Rollback', $domain ); + debug( '%s: Adding WP Rollback', $domain ); add_wp_rollback_plugin(); } }, 10, 3 ); @@ -30,7 +30,7 @@ } ); /** - * Installs and activates Wp Rollback on the site. + * Installs and activates WP Rollback on the site. */ function add_wp_rollback_plugin() { $cmd = 'wp plugin install wp-rollback --activate' ; From b1a31e1f42ebf34e579d7f83be0abb7c5298eca6 Mon Sep 17 00:00:00 2001 From: oskosk Date: Fri, 6 Apr 2018 16:55:30 -0300 Subject: [PATCH 3/3] Bump to 3.2 --- jurassic.ninja.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jurassic.ninja.php b/jurassic.ninja.php index dd7896e..74474b0 100644 --- a/jurassic.ninja.php +++ b/jurassic.ninja.php @@ -3,7 +3,7 @@ /* * Plugin Name: Jurassic Ninja * Description: Launch ephemeral instances of WordPress + Jetpack using ServerPilot and an Ubuntu Box. - * Version: 3.1 + * Version: 3.2 * Author: Osk **/