php Piwik-Updater类(方法)实例源码

下面列出了php Piwik-Updater 类(方法)源码代码实例,从而了解它的用法。

作者:piwi    项目:piwi   
public function doUpdate(Updater $updater)
 {
     // delete schema version_
     Option::delete('version_Referers');
     $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
     // old plugins deleted in 2.0-a17 update file
 }

作者:piwi    项目:piwi   
public function doUpdate(Updater $updater)
 {
     $salt = Common::generateUniqId();
     $config = Config::getInstance();
     $superuser = $config->superuser;
     if (!isset($superuser['salt'])) {
         try {
             if (is_writable(Config::getLocalConfigPath())) {
                 $superuser['salt'] = $salt;
                 $config->superuser = $superuser;
                 $config->forceSave();
             } else {
                 throw new \Exception('mandatory update failed');
             }
         } catch (\Exception $e) {
             throw new \Piwik\UpdaterErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = {$salt}</code>");
         }
     }
     $plugins = $config->Plugins;
     if (!in_array('MultiSites', $plugins)) {
         try {
             if (is_writable(Config::getLocalConfigPath())) {
                 $plugins[] = 'MultiSites';
                 $config->Plugins = $plugins;
                 $config->forceSave();
             } else {
                 throw new \Exception('optional update failed');
             }
         } catch (\Exception $e) {
             throw new \Exception("You can now enable the new MultiSites plugin in the Plugins screen in the Piwik admin!");
         }
     }
     $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
 }

作者:piwi    项目:piwi   
public function dispatch()
 {
     $module = Common::getRequestVar('module', '', 'string');
     $action = Common::getRequestVar('action', '', 'string');
     if ($module == 'CoreUpdater' || $module == 'Proxy' || $module == 'Installation' || $module == 'LanguagesManager' && $action == 'saveLanguage') {
         return;
     }
     $updater = new PiwikCoreUpdater();
     $updates = $updater->getComponentsWithNewVersion(array('core' => Version::VERSION));
     if (!empty($updates)) {
         Filesystem::deleteAllCacheOnUpdate();
     }
     if ($updater->getComponentUpdates() !== null) {
         if (FrontController::shouldRethrowException()) {
             throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n");
         } elseif ($module === 'API') {
             $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $_GET + $_POST));
             $response = new ResponseBuilder($outputFormat);
             $e = new Exception('Database Upgrade Required. Your Piwik database is out-of-date, and must be upgraded before you can continue.');
             echo $response->getResponseException($e);
             Common::sendResponseCode(503);
             exit;
         } else {
             Piwik::redirectToModule('CoreUpdater');
         }
     }
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     try {
         $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
     } catch (\Exception $e) {
     }
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
     try {
         \Piwik\Plugin\Manager::getInstance()->activatePlugin('Events');
     } catch (\Exception $e) {
     }
 }

作者:piwi    项目:piwi   
private function getNamespace($component)
 {
     $updater = new Updater();
     $className = $updater->getUpdateClassName($component, 'xx');
     $className = str_replace('Updates_xx', '', $className);
     $className = trim($className, '\\');
     return $className;
 }

作者:piwi    项目:piwi   
public function doUpdate(Updater $updater)
 {
     // manually remove ExampleFeedburner column
     $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
     // remove ExampleFeedburner plugin
     $pluginToDelete = 'ExampleFeedburner';
     self::deletePluginFromConfigFile($pluginToDelete);
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     $pluginManager = \Piwik\Plugin\Manager::getInstance();
     try {
         $pluginManager->activatePlugin('UserLanguage');
     } catch (\Exception $e) {
     }
     $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
     self::updateIPAnonymizationSettings();
     try {
         Manager::getInstance()->activatePlugin('TestRunner');
     } catch (\Exception $e) {
     }
 }

作者:piwi    项目:piwi   
public function doUpdate(Updater $updater)
 {
     $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
     try {
         self::migrateConfigSuperUserToDb();
     } catch (\Exception $e) {
         throw new UpdaterErrorException($e->getMessage());
     }
 }

作者:FluentDevelopmen    项目:piwi   
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));
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
     $obsoleteDirectories = array('/plugins/AdminHome', '/plugins/Home', '/plugins/PluginsAdmin');
     foreach ($obsoleteDirectories as $dir) {
         if (file_exists(PIWIK_INCLUDE_PATH . $dir)) {
             Filesystem::unlinkRecursive(PIWIK_INCLUDE_PATH . $dir, true);
         }
     }
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
     // DeviceDetection upgrade in beta1 timed out on demo #6750
     $archiveBlobTables = self::getAllArchiveBlobTables();
     foreach ($archiveBlobTables as $table) {
         self::updateBrowserArchives($table);
         self::updateOsArchives($table);
     }
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     try {
         self::enableMaintenanceMode();
         $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
         self::disableMaintenanceMode();
     } catch (\Exception $e) {
         self::disableMaintenanceMode();
         throw $e;
     }
 }

作者:piwi    项目:piwi   
public function doUpdate(Updater $updater)
 {
     $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
     $this->migratePluginEmailUpdateSetting();
     // added .woff and woff2 whitelisted file for apache webserver
     ServerFilesGenerator::deleteHtAccessFiles();
     ServerFilesGenerator::createHtAccessFiles();
     // Renamed plugin ExampleRssWidget -> RssWidget
     \Piwik\Plugin\Manager::getInstance()->activatePlugin('RssWidget');
     \Piwik\Plugin\Manager::getInstance()->deactivatePlugin('ExampleRssWidget');
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     // delete schema version_
     Option::delete('version_Referers');
     $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
     // old plugins deleted in 2.0-a17 update file
     try {
         \Piwik\Plugin\Manager::getInstance()->activatePlugin('Referrers');
     } catch (\Exception $e) {
     }
     try {
         \Piwik\Plugin\Manager::getInstance()->activatePlugin('ScheduledReports');
     } catch (\Exception $e) {
     }
 }

作者:brienomatt    项目:elmsl   
static function update()
 {
     try {
         Updater::updateDatabase(__FILE__, self::getSql());
     } catch (\Exception $e) {
     }
 }

作者:FluentDevelopmen    项目:piwi   
public function doUpdate(Updater $updater)
 {
     try {
         $dashboards = Db::fetchAll('SELECT * FROM `' . Common::prefixTable('user_dashboard') . '`');
         foreach ($dashboards as $dashboard) {
             $idDashboard = $dashboard['iddashboard'];
             $login = $dashboard['login'];
             $layout = $dashboard['layout'];
             $layout = html_entity_decode($layout);
             $layout = str_replace("\\\"", "\"", $layout);
             Db::query('UPDATE `' . Common::prefixTable('user_dashboard') . '` SET layout = ? WHERE iddashboard = ? AND login = ?', array($layout, $idDashboard, $login));
         }
         $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
     } catch (\Exception $e) {
     }
 }

作者:KiwiJuice    项目:handball-dacha   
static function update()
 {
     Updater::updateDatabase(__FILE__, self::getSql());
     try {
         \Piwik\Plugin\Manager::getInstance()->activatePlugin('Events');
     } catch (\Exception $e) {
     }
 }

作者:CaptainShar    项目:SSAD_Projec   
public function dispatch()
 {
     $module = Common::getRequestVar('module', '', 'string');
     $action = Common::getRequestVar('action', '', 'string');
     $updater = new PiwikCoreUpdater();
     $updates = $updater->getComponentsWithNewVersion(array('core' => Version::VERSION));
     if (!empty($updates)) {
         Filesystem::deleteAllCacheOnUpdate();
     }
     if ($updater->getComponentUpdates() !== null && $module != 'CoreUpdater' && $module != 'Proxy' && $module != 'Installation' && !($module == 'LanguagesManager' && $action == 'saveLanguage')) {
         if (FrontController::shouldRethrowException()) {
             throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n");
         } else {
             Piwik::redirectToModule('CoreUpdater');
         }
     }
 }


问题


面经


文章

微信
公众号

扫码关注公众号