Skip to content

Commit

Permalink
Check if plugin is Warpdrive in upgrader_post_install (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thaillie authored Jul 25, 2018
1 parent 3dea764 commit 18b4071
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/class-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ public function get_plugin_info( $result, $action, $args ) {
public function upgrader_post_install( $response, $hook_extra, $result ) {
global $wp_filesystem;

// Skip if not Warpdrive
if ( empty( $hook_extra ) || Updater::NAME !== $hook_extra['plugin'] ) {
return $result;
}

// Move & Activate
$wp_filesystem->move( $result['destination'], Updater::DIR );
$result['destination'] = Updater::DIR;
Expand Down
2 changes: 1 addition & 1 deletion tests/savvii/class-updater-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function test_upgrader_post_install() {
);

$updater = $this->instantiate_updater();
$proper_destination = $updater->upgrader_post_install( true, [], [ 'destination' => $destination ] );
$proper_destination = $updater->upgrader_post_install( true, [ 'plugin' => Savvii\Updater::NAME ], [ 'destination' => $destination ] );

$this->assertEquals( [ 'destination' => $destination ] , $proper_destination );
}
Expand Down
2 changes: 1 addition & 1 deletion warpdrive.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin name: Warpdrive
* Plugin URI: https://github.com/Savvii/warpdrive
* Description: Hosting plugin for Savvii
* Version: 2.9.2
* Version: 2.9.3
* Author: Savvii <support@savvii.com>
* Author URI: https://www.savvii.com
* License: GPL-3.0-only
Expand Down

0 comments on commit 18b4071

Please sign in to comment.