public function test_updaterChecksCoreAndPlugin_checkThatCoreIsRanFirst() { $updater = new Piwik_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->assertTrue(count($componentsWithUpdateFile) == 2); reset($componentsWithUpdateFile); $this->assertTrue(key($componentsWithUpdateFile) == 'core'); }
/** * Installation Step 5: Table Creation */ function tablesCreation() { $this->checkPreviousStepIsValid( __FUNCTION__ ); $view = new Piwik_Installation_View( $this->pathView . 'tablesCreation.tpl', $this->getInstallationSteps(), __FUNCTION__ ); $this->skipThisStep( __FUNCTION__ ); $this->createDbFromSessionInformation(); if(Piwik_Common::getRequestVar('deleteTables', 0, 'int') == 1) { Piwik::dropTables(); $view->existingTablesDeleted = true; // when the user decides to drop the tables then we dont skip the next steps anymore // workaround ZF-1743 $tmp = $this->session->skipThisStep; $tmp['firstWebsiteSetup'] = false; $tmp['displayJavascriptCode'] = false; $this->session->skipThisStep = $tmp; } $tablesInstalled = Piwik::getTablesInstalled(); $tablesToInstall = Piwik::getTablesNames(); $view->tablesInstalled = ''; if(count($tablesInstalled) > 0) { // we have existing tables $view->tablesInstalled = implode(', ', $tablesInstalled); $view->someTablesInstalled = true; $minimumCountPiwikTables = 18; $baseTablesInstalled = preg_grep('/archive_numeric|archive_blob/', $tablesInstalled, PREG_GREP_INVERT); Piwik::createAccessObject(); Piwik::setUserIsSuperUser(); if(count($baseTablesInstalled) >= $minimumCountPiwikTables && count(Piwik_SitesManager_API::getInstance()->getAllSitesId()) > 0 && count(Piwik_UsersManager_API::getInstance()->getUsers()) > 0) { $view->showReuseExistingTables = true; // when the user reuses the same tables we skip the website creation step // workaround ZF-1743 $tmp = $this->session->skipThisStep; $tmp['firstWebsiteSetup'] = true; $tmp['displayJavascriptCode'] = true; $this->session->skipThisStep = $tmp; } } else { Piwik::createTables(); Piwik::createAnonymousUser(); $updater = new Piwik_Updater(); $updater->recordComponentSuccessfullyUpdated('core', Piwik_Version::VERSION); $view->tablesCreated = true; $view->showNextStep = true; } $this->session->currentStepDone = __FUNCTION__; echo $view->render(); }
function tablesCreation() { $this->checkPreviousStepIsValid(__FUNCTION__); $view = new Piwik_Installation_View($this->pathView . 'tablesCreation.tpl', $this->getInstallationSteps(), __FUNCTION__); $session = new Zend_Session_Namespace("Installation"); $this->skipThisStep(__FUNCTION__); $this->createDbFromSessionInformation(); if (Piwik_Common::getRequestVar('deleteTables', 0, 'int') == 1) { Piwik::dropTables(); $view->existingTablesDeleted = true; // when the user decides to drop the tables then we dont skip the next steps anymore $session->skipThisStep['firstWebsiteSetup'] = false; $session->skipThisStep['displayJavascriptCode'] = false; } $tablesInstalled = Piwik::getTablesInstalled(); $tablesToInstall = Piwik::getTablesNames(); $view->tablesInstalled = ''; if (count($tablesInstalled) > 0) { $view->tablesInstalled = implode(", ", $tablesInstalled); $view->someTablesInstalled = true; $minimumCountPiwikTables = 14; if (count($tablesInstalled) >= $minimumCountPiwikTables) { $view->showReuseExistingTables = true; // when the user reuses the same tables we skip the website creation step $session->skipThisStep['firstWebsiteSetup'] = true; $session->skipThisStep['displayJavascriptCode'] = true; } } else { Piwik::createTables(); Piwik::createAnonymousUser(); require_once "Updater.php"; $updater = new Piwik_Updater(); $updater->recordComponentSuccessfullyUpdated('core', Piwik_Version::VERSION); $view->tablesCreated = true; $view->showNextStep = true; } if (isset($session->databaseCreated) && $session->databaseCreated === true) { $view->databaseName = $session->db_infos['dbname']; $view->databaseCreated = true; unset($session->databaseCreated); } $session->currentStepDone = __FUNCTION__; echo $view->render(); }