src/UpdateWatcher.php
public function filterUpgraderPostInstall($true, $hookExtra, $result) {
        $this->updatePluginData();
        $wasPluginActive = is_plugin_active($this->pluginBaseName);

        global $wp_filesystem;
        $pluginFolder = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . dirname($this->pluginBaseName);
        $wp_filesystem->move($result['destination'], $pluginFolder);
        $result['destination'] = $pluginFolder;
        
        if ($wasPluginActive) {
            $activation = activate_plugin($this->pluginBaseName);
            if (is_wp_error($activation)) {
                throw new \Exception('Unable to reactivate plugin: ' . $activation->get_error_message());
            }
        }
        
        return $result;
    }
public function filterUpgraderPostInstall($true, $hookExtra, $result) {
        $this->updatePluginData();
        $wasPluginActive = is_plugin_active($this->pluginBaseName);

        global $wp_filesystem;
        $pluginFolder = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . dirname($this->pluginBaseName);
        $wp_filesystem->move($result['destination'], $pluginFolder);
        $result['destination'] = $pluginFolder;
        
        if ($wasPluginActive) {
            $activation = activate_plugin($this->pluginBaseName);
            if (is_wp_error($activation)) {
                throw new \Exception('Unable to reactivate plugin: ' . $activation->get_error_message());
            }
        }
        
        return $result;
    }
public function filterUpgraderPostInstall ( $ true , $ hookExtra , $ result ) { $ this -> updatePluginData ( ) ; $ wasPluginActive = is_plugin_active ( $ this -> pluginBaseName ) ; global $ wp_filesystem ; $ pluginFolder = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . dirname ( $ this -> pluginBaseName ) ; $ wp_filesystem -> move ( $ result [ 'destination' ] , $ pluginFolder ) ; $ result [ 'destination' ] = $ pluginFolder ; if ( $ wasPluginActive ) { $ activation = activate_plugin ( $ this -> pluginBaseName ) ; if ( is_wp_error ( $ activation ) ) { throw new \ Exception ( 'Unable to reactivate plugin: ' . $ activation -> get_error_message ( ) ) ; } } return $ result ; }
Handles the post upgrade moving of files and what not

@param $true
@param $hookExtra
@param $result
@return mixed
@throws \Exception
Handles the post upgrade moving of files and what not