本文整理汇总了PHP中Piwik\Updater类的典型用法代码示例。如果您正苦于以下问题:PHP Updater类的具体用法?PHP Updater怎么用?PHP Updater使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Updater类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doUpdate
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
}
示例2: doUpdate
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));
}
示例3: dispatch
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');
}
}
}
示例4: doUpdate
public function doUpdate(Updater $updater)
{
try {
$updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
} catch (\Exception $e) {
}
}
示例5: doUpdate
public function doUpdate(Updater $updater)
{
$updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
try {
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Events');
} catch (\Exception $e) {
}
}
示例6: getNamespace
private function getNamespace($component)
{
$updater = new Updater();
$className = $updater->getUpdateClassName($component, 'xx');
$className = str_replace('Updates_xx', '', $className);
$className = trim($className, '\\');
return $className;
}
示例7: doUpdate
public function doUpdate(Updater $updater)
{
// manually remove ExampleFeedburner column
$updater->executeMigrations(__FILE__, $this->getMigrations($updater));
// remove ExampleFeedburner plugin
$pluginToDelete = 'ExampleFeedburner';
self::deletePluginFromConfigFile($pluginToDelete);
}
示例8: doUpdate
public function doUpdate(Updater $updater)
{
$pluginManager = \Piwik\Plugin\Manager::getInstance();
try {
$pluginManager->activatePlugin('UserLanguage');
} catch (\Exception $e) {
}
$updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
}
示例9: doUpdate
public function doUpdate(Updater $updater)
{
$updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
self::updateIPAnonymizationSettings();
try {
Manager::getInstance()->activatePlugin('TestRunner');
} catch (\Exception $e) {
}
}
示例10: doUpdate
public function doUpdate(Updater $updater)
{
$updater->executeMigrations(__FILE__, $this->getMigrations($updater));
try {
self::migrateConfigSuperUserToDb();
} catch (\Exception $e) {
throw new UpdaterErrorException($e->getMessage());
}
}
示例11: testUpdaterChecksCoreAndPluginCheckThatCoreIsRanFirst
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));
}
示例12: doUpdate
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);
}
}
}
示例13: doUpdate
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);
}
}
示例14: doUpdate
public function doUpdate(Updater $updater)
{
try {
self::enableMaintenanceMode();
$updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
self::disableMaintenanceMode();
} catch (\Exception $e) {
self::disableMaintenanceMode();
throw $e;
}
}
示例15: doUpdate
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');
}