getComponentsWithUpdateFile() public method

Returns a list of components (core | plugin) that need to run through the upgrade process.
public getComponentsWithUpdateFile ( string[] $componentsToCheck ) : array(
$componentsToCheck string[] An array mapping component names to the latest locally available version. If the version is later than the currently installed version, the component must be upgraded. Example: `array('core' => '2.11.0')`
return array(
Exemplo n.º 1
0
 public function testUpdaterChecksCoreAndPluginCheckThatCoreIsRanFirst()
 {
     $updater = new Updater(PIWIK_INCLUDE_PATH . '/tests/resources/Updater/core/', PIWIK_INCLUDE_PATH . '/tests/resources/Updater/%s/');
     $updater->markComponentSuccessfullyUpdated('testpluginUpdates', '0.1beta');
     $updater->markComponentSuccessfullyUpdated('core', '0.1');
     $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile(array('testpluginUpdates' => '0.1', 'core' => '0.3'));
     $this->assertEquals(2, count($componentsWithUpdateFile));
     reset($componentsWithUpdateFile);
     $this->assertEquals('core', key($componentsWithUpdateFile));
 }
Exemplo n.º 2
0
 public static function getComponentUpdates(Updater $updater)
 {
     $updater->addComponentToCheck('core', Version::VERSION);
     $plugins = \Piwik\Plugin\Manager::getInstance()->getLoadedPlugins();
     foreach ($plugins as $pluginName => $plugin) {
         $updater->addComponentToCheck($pluginName, $plugin->getVersion());
     }
     $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
     if (count($componentsWithUpdateFile) == 0 && !$updater->hasNewVersion('core')) {
         return null;
     }
     return $componentsWithUpdateFile;
 }
Exemplo n.º 3
0
 public function testUpdaterChecksCoreAndPluginCheckThatCoreIsRanFirst()
 {
     $updater = new Updater();
     $updater->pathUpdateFilePlugins = PIWIK_INCLUDE_PATH . '/tests/resources/Updater/%s/';
     $updater->pathUpdateFileCore = PIWIK_INCLUDE_PATH . '/tests/resources/Updater/core/';
     $updater->recordComponentSuccessfullyUpdated('testpluginUpdates', '0.1beta');
     $updater->addComponentToCheck('testpluginUpdates', '0.1');
     $updater->recordComponentSuccessfullyUpdated('core', '0.1');
     $updater->addComponentToCheck('core', '0.3');
     $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
     $this->assertEquals(2, count($componentsWithUpdateFile));
     reset($componentsWithUpdateFile);
     $this->assertEquals('core', key($componentsWithUpdateFile));
 }
Exemplo n.º 4
0
 public static function getComponentUpdates(Updater $updater)
 {
     $updater->addComponentToCheck('core', Version::VERSION);
     $manager = \Piwik\Plugin\Manager::getInstance();
     $plugins = $manager->getLoadedPlugins();
     foreach ($plugins as $pluginName => $plugin) {
         if ($manager->isPluginInstalled($pluginName)) {
             $updater->addComponentToCheck($pluginName, $plugin->getVersion());
         }
     }
     $columnsVersions = ColumnsUpdater::getAllVersions();
     foreach ($columnsVersions as $component => $version) {
         $updater->addComponentToCheck($component, $version);
     }
     $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
     if (count($componentsWithUpdateFile) == 0) {
         ColumnsUpdater::onNoUpdateAvailable($columnsVersions);
         if (!$updater->hasNewVersion('core')) {
             return null;
         }
     }
     return $componentsWithUpdateFile;
 }