Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #111 from oskosk/add/wp-downgrade-feature
Browse files Browse the repository at this point in the history
 Add ability to launch with wp-downgrade installed
  • Loading branch information
oskosk authored Apr 6, 2018
2 parents f10d758 + b1a31e1 commit dc67268
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
40 changes: 40 additions & 0 deletions features/wp-downgrade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace jn;

add_action( 'jurassic_ninja_init', function() {
$defaults = [
'wp-downgrade' => 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";
} );
}
4 changes: 2 additions & 2 deletions features/wp-rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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' ;
Expand Down
2 changes: 1 addition & 1 deletion jurassic.ninja.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
**/

Expand Down
1 change: 1 addition & 0 deletions lib/stuff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

Expand Down

0 comments on commit dc67268

Please sign in to comment.