public function upgradePlugin($pluginSlug, $pluginPath, Errors &$errors)
    {
        $log = "";

        $plugin = $this->PluginService->getBySlug($pluginSlug);
        $existingPriority = $plugin->Priority;

        if (empty($plugin) || !$plugin->isInstalled()) {
            $log .= "Plugin is not installed.";
            return array($log, 'fail');
        }

        $log .= "Upgrading plugin [$pluginSlug]...\n";

        $xml = $this->loadXML($plugin->Path);
        $originalVersion = $plugin->Version;

        $plugin = $this->SystemXMLConverter->xmlToPlugin($plugin, $xml);
        $plugin->Priority = $existingPriority;
        $plugin->ModifiedDate = $this->DateFactory->newStorageDate(filemtime($pluginPath.'/plugin.xml'));
        $plugin->Md5 = md5_file($pluginPath.'/plugin.xml');

        $this->PluginService->edit($plugin);

        $plugin = $this->PluginService->getBySlug($pluginSlug);


        $this->processAspects($plugin, $log);

        foreach($this->ElementService->findAll()->getResults() as $element)
            $this->NodeService->createDBSchema($element);

        $this->processPluginXML($plugin, $errors, $log, $xml);


        $errors->throwOnError();

        $this->processUpgradeScript($plugin, $log, $originalVersion);


        $this->ApplicationContext->clearContextFiles();

        return array($log, strpos($log, 'WARNING')=== FALSE?'success':'warn');
    }
public function upgradePlugin($pluginSlug, $pluginPath, Errors &$errors)
    {
        $log = "";

        $plugin = $this->PluginService->getBySlug($pluginSlug);
        $existingPriority = $plugin->Priority;

        if (empty($plugin) || !$plugin->isInstalled()) {
            $log .= "Plugin is not installed.";
            return array($log, 'fail');
        }

        $log .= "Upgrading plugin [$pluginSlug]...\n";

        $xml = $this->loadXML($plugin->Path);
        $originalVersion = $plugin->Version;

        $plugin = $this->SystemXMLConverter->xmlToPlugin($plugin, $xml);
        $plugin->Priority = $existingPriority;
        $plugin->ModifiedDate = $this->DateFactory->newStorageDate(filemtime($pluginPath.'/plugin.xml'));
        $plugin->Md5 = md5_file($pluginPath.'/plugin.xml');

        $this->PluginService->edit($plugin);

        $plugin = $this->PluginService->getBySlug($pluginSlug);


        $this->processAspects($plugin, $log);

        foreach($this->ElementService->findAll()->getResults() as $element)
            $this->NodeService->createDBSchema($element);

        $this->processPluginXML($plugin, $errors, $log, $xml);


        $errors->throwOnError();

        $this->processUpgradeScript($plugin, $log, $originalVersion);


        $this->ApplicationContext->clearContextFiles();

        return array($log, strpos($log, 'WARNING')=== FALSE?'success':'warn');
    }
public function upgradePlugin ( $ pluginSlug , $ pluginPath , Errors & $ errors ) { $ log = "" ; $ plugin = $ this -> PluginService -> getBySlug ( $ pluginSlug ) ; $ existingPriority = $ plugin -> Priority ; if ( empty ( $ plugin ) || ! $ plugin -> isInstalled ( ) ) { $ log .= "Plugin is not installed." ; return array ( $ log , 'fail' ) ; } $ log .= "Upgrading plugin [$pluginSlug]...\n" ; $ xml = $ this -> loadXML ( $ plugin -> Path ) ; $ originalVersion = $ plugin -> Version ; $ plugin = $ this -> SystemXMLConverter -> xmlToPlugin ( $ plugin , $ xml ) ; $ plugin -> Priority = $ existingPriority ; $ plugin -> ModifiedDate = $ this -> DateFactory -> newStorageDate ( filemtime ( $ pluginPath . '/plugin.xml' ) ) ; $ plugin -> Md5 = md5_file ( $ pluginPath . '/plugin.xml' ) ; $ this -> PluginService -> edit ( $ plugin ) ; $ plugin = $ this -> PluginService -> getBySlug ( $ pluginSlug ) ; $ this -> processAspects ( $ plugin , $ log ) ; foreach ( $ this -> ElementService -> findAll ( ) -> getResults ( ) as $ element ) $ this -> NodeService -> createDBSchema ( $ element ) ; $ this -> processPluginXML ( $ plugin , $ errors , $ log , $ xml ) ; $ errors -> throwOnError ( ) ; $ this -> processUpgradeScript ( $ plugin , $ log , $ originalVersion ) ; $ this -> ApplicationContext -> clearContextFiles ( ) ; return array ( $ log , strpos ( $ log , 'WARNING' ) === FALSE ? 'success' : 'warn' ) ; }
Force an upgrade of the specified plugin

@param string $pluginSlug The slug for the installed plugin
@param string $pluginPath The path to the plugin
@param Errors &$errors    An errors object to update on error

@return array 2 items in this array. First, the log, second is a boolean indicating success (true on successful install)
Force an upgrade of the specified plugin