本文整理汇总了PHP中Piwik_Updater类的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Updater类的具体用法?PHP Piwik_Updater怎么用?PHP Piwik_Updater使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_Updater类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
function dispatch()
{
$language = Piwik_Common::getRequestVar('language', '', 'string');
if($language != '')
{
$updaterController = new Piwik_CoreUpdater_Controller();
$updaterController->saveLanguage();
exit;
}
$updater = new Piwik_Updater();
$updater->addComponentToCheck('core', Piwik_Version::VERSION);
$plugins = Piwik_PluginsManager::getInstance()->getInstalledPlugins();
foreach($plugins as $pluginName => $plugin)
{
$updater->addComponentToCheck($pluginName, $plugin->getVersion());
}
$componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
if(count($componentsWithUpdateFile) == 0)
{
return;
}
$updaterController = new Piwik_CoreUpdater_Controller();
$updaterController->runUpdaterAndExit($updater, $componentsWithUpdateFile);
}
示例2: update
static function update()
{
try {
Piwik_Updater::updateDatabase(__FILE__, self::getSql());
} catch (Exception $e) {
}
}
示例3: update
static function update()
{
if(Piwik::isTimezoneSupportEnabled())
{
Piwik_Updater::updateDatabase(__FILE__, self::getSql());
}
}
示例4: update
static function update()
{
Piwik_Updater::updateDatabase(__FILE__, array(
'ALTER TABLE `'. Piwik::prefixTable('user_dashboard') .'`
CHANGE `layout` `layout` TEXT NOT NULL' => false,
));
}
示例5: update
static function update()
{
// first we disable the plugins and keep an array of warnings messages
$pluginsToDisableMessage = array(
'SearchEnginePosition' => "SearchEnginePosition plugin was disabled, because it is not compatible with the new Piwik 0.6. \n You can download the latest version of the plugin, compatible with Piwik 0.6.\n<a target='_blank' href='?module=Proxy&action=redirect&url=http://dev.piwik.org/trac/ticket/502'>Click here.</a>",
'GeoIP' => "GeoIP plugin was disabled, because it is not compatible with the new Piwik 0.6. \nYou can download the latest version of the plugin, compatible with Piwik 0.6.\n<a target='_blank' href='?module=Proxy&action=redirect&url=http://dev.piwik.org/trac/ticket/45'>Click here.</a>"
);
$disabledPlugins = array();
foreach($pluginsToDisableMessage as $pluginToDisable => $warningMessage)
{
if(Piwik_PluginsManager::getInstance()->isPluginActivated($pluginToDisable))
{
Piwik_PluginsManager::getInstance()->deactivatePlugin($pluginToDisable);
$disabledPlugins[] = $warningMessage;
}
}
// Run the SQL
Piwik_Updater::updateDatabase(__FILE__, self::getSql());
// Outputs warning message, pointing users to the plugin download page
if(!empty($disabledPlugins))
{
throw new Exception("The following plugins were disabled during the upgrade:"
."<ul><li>" .
implode('</li><li>', $disabledPlugins) .
"</li></ul>");
}
}
示例6: update
static function update()
{
$salt = Piwik_Common::generateUniqId();
if (!isset(Piwik_Config::getInstance()->superuser['salt'])) {
try {
if (is_writable(Piwik_Config::getLocalConfigPath())) {
Piwik_Config::getInstance()->setConfigOption('superuser', 'salt', $salt);
Piwik_Config::getInstance()->forceSave();
} else {
throw new Exception('mandatory update failed');
}
} catch (Exception $e) {
throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = {$salt}</code>");
}
}
$plugins = Piwik_Config::getInstance()->Plugins;
if (!in_array('MultiSites', $plugins)) {
try {
if (is_writable(Piwik_Config::getLocalConfigPath())) {
$plugins[] = 'MultiSites';
Piwik_Config::getInstance()->setConfigSection('Plugins', $plugins);
Piwik_Config::getInstance()->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!");
}
}
Piwik_Updater::updateDatabase(__FILE__, self::getSql());
}
示例7: update
static function update()
{
$sqlarray = array(
'ALTER TABLE `'. Piwik::prefixTable('log_visit') .'`
ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false,
// 0.2.27 [826]
'ALTER IGNORE TABLE `'. Piwik::prefixTable('log_visit') .'`
CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false,
);
$tables = Piwik::getTablesCreateSql();
$sqlarray[ $tables['log_conversion'] ] = false;
$sqlarray[ $tables['goal'] ] = false;
$tables = Piwik::getTablesInstalled();
foreach($tables as $tableName)
{
if(preg_match('/archive_/', $tableName) == 1)
{
$sqlarray[ 'CREATE INDEX index_all ON '. $tableName .' (`idsite`,`date1`,`date2`,`name`,`ts_archived`)' ] = false;
}
}
Piwik_Updater::updateDatabase(__FILE__, $sqlarray);
}
示例8: update
static function update()
{
$config = Zend_Registry::get('config');
$dbInfos = $config->database->toArray();
if(!isset($dbInfos['schema']))
{
try {
if(is_writable( Piwik_Config::getDefaultUserConfigPath() ))
{
$dbInfos['schema'] = 'Myisam';
$config->database = $dbInfos;
$config->__destruct();
Piwik::createConfigObject();
}
else
{
throw new Exception('mandatory update failed');
}
} catch(Exception $e) {
throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>");
}
}
Piwik_Updater::updateDatabase(__FILE__, self::getSql());
}
示例9: update
static function update()
{
Piwik_Updater::updateDatabase(__FILE__, self::getSql());
try {
Piwik_PluginsManager::getInstance()->activatePlugin('Transitions');
} catch (Exception $e) {
}
}
示例10: update
static function update()
{
Piwik_Updater::updateDatabase(__FILE__, array('ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
ADD `config_java` TINYINT(1) NOT NULL AFTER `config_flash`' => '/1060/', 'ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
ADD `config_quicktime` TINYINT(1) NOT NULL AFTER `config_director`' => '/1060/', 'ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
ADD `config_gears` TINYINT(1) NOT NULL AFTER `config_windowsmedia`,
ADD `config_silverlight` TINYINT(1) NOT NULL AFTER `config_gears`' => false));
}
示例11: update
static function update()
{
Piwik_Updater::updateDatabase(__FILE__, array(
'DELETE FROM `'. Piwik::prefixTable('user_dashboard') ."`
WHERE layout LIKE '%.getLastVisitsGraph%'
OR layout LIKE '%.getLastVisitsReturningGraph%'" => false,
));
}
示例12: update
static function update()
{
Piwik_Updater::updateDatabase(__FILE__, array('UPDATE `' . Piwik::prefixTable('log_visit') . '`
SET location_ip=location_ip+CAST(POW(2,32) AS UNSIGNED) WHERE location_ip < 0' => false, 'ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
CHANGE `location_ip` `location_ip` BIGINT UNSIGNED NOT NULL' => false, 'UPDATE `' . Piwik::prefixTable('logger_api_call') . '`
SET caller_ip=caller_ip+CAST(POW(2,32) AS UNSIGNED) WHERE caller_ip < 0' => false, 'ALTER TABLE `' . Piwik::prefixTable('logger_api_call') . '`
CHANGE `caller_ip` `caller_ip` BIGINT UNSIGNED' => false));
}
示例13: update
static function update()
{
// manually remove ExampleFeedburner column
Piwik_Updater::updateDatabase(__FILE__, self::getSql());
// remove ExampleFeedburner plugin
$pluginToDelete = 'ExampleFeedburner';
self::deletePluginFromConfigFile($pluginToDelete);
}
示例14: update
static function update()
{
$tables = Piwik::getTablesCreateSql();
Piwik_Updater::updateDatabase(__FILE__, array(
'DROP TABLE IF EXISTS `'. Piwik::prefixTable('option') .'`' => false,
$tables['option'] => false,
));
}
示例15: dispatch
function dispatch()
{
$module = Piwik_Common::getRequestVar('module', '', 'string');
$updater = new Piwik_Updater();
$updater->addComponentToCheck('core', Piwik_Version::VERSION);
$updates = $updater->getComponentsWithNewVersion();
if (!empty($updates)) {
Piwik::deleteAllCacheOnUpdate();
}
if (self::getComponentUpdates($updater) !== null && $module != 'CoreUpdater' && $module != 'Proxy') {
if (Piwik_FrontController::shouldRethrowException()) {
throw new Exception("Piwik and/or some plugins have been upgraded to a new version. Please run the update process first. See documentation: http://piwik.org/docs/update/");
} else {
Piwik::redirectToModule('CoreUpdater');
}
}
}