本文整理汇总了PHP中Piwik\Updater::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Updater::update方法的具体用法?PHP Updater::update怎么用?PHP Updater::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Updater
的用法示例。
在下文中一共展示了Updater::update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateComponents
public static function updateComponents(Updater $updater, $componentsWithUpdateFile)
{
$warnings = array();
$errors = array();
$deactivatedPlugins = array();
$coreError = false;
if (!empty($componentsWithUpdateFile)) {
$currentAccess = Access::getInstance();
$hasSuperUserAccess = $currentAccess->hasSuperUserAccess();
if (!$hasSuperUserAccess) {
$currentAccess->setSuperUserAccess(true);
}
// if error in any core update, show message + help message + EXIT
// if errors in any plugins updates, show them on screen, disable plugins that errored + CONTINUE
// if warning in any core update or in any plugins update, show message + CONTINUE
// if no error or warning, success message + CONTINUE
foreach ($componentsWithUpdateFile as $name => $filenames) {
try {
$warnings = array_merge($warnings, $updater->update($name));
} catch (UpdaterErrorException $e) {
$errors[] = $e->getMessage();
if ($name == 'core') {
$coreError = true;
break;
} elseif (\Piwik\Plugin\Manager::getInstance()->isPluginActivated($name)) {
\Piwik\Plugin\Manager::getInstance()->deactivatePlugin($name);
$deactivatedPlugins[] = $name;
}
}
}
if (!$hasSuperUserAccess) {
$currentAccess->setSuperUserAccess(false);
}
}
Filesystem::deleteAllCacheOnUpdate();
$result = array('warnings' => $warnings, 'errors' => $errors, 'coreError' => $coreError, 'deactivatedPlugins' => $deactivatedPlugins);
/**
* Triggered after Piwik has been updated.
*/
Piwik::postEvent('CoreUpdater.update.end');
return $result;
}