add icons for Character groups
This commit is contained in:
commit
2d9a41a5fe
3461 changed files with 594457 additions and 0 deletions
62
www/analytics/plugins/CoreUpdater/Commands/Update.php
Normal file
62
www/analytics/plugins/CoreUpdater/Commands/Update.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\CoreUpdater\Commands;
|
||||
|
||||
use Piwik\Plugin\ConsoleCommand;
|
||||
use Piwik\Plugins\CoreUpdater\Controller;
|
||||
use Piwik\Plugins\CoreUpdater\NoUpdatesFoundException;
|
||||
use Piwik\Plugins\UserCountry\LocationProvider;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* @package CloudAdmin
|
||||
*/
|
||||
class Update extends ConsoleCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('core:update');
|
||||
|
||||
$this->setDescription('Triggers upgrades. Use it after Piwik core or any plugin files have been updated.');
|
||||
|
||||
$this->addOption('dry-run', null, InputOption::VALUE_NONE, 'Only prints out the SQL requests that would be executed during the upgrade');
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute command like: ./console core:update --dry-run
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$doDryRun = $input->getOption('dry-run');
|
||||
|
||||
try {
|
||||
$this->makeUpdate($input, $output, $doDryRun);
|
||||
} catch(NoUpdatesFoundException $e) {
|
||||
// Do not fail if no updates were found
|
||||
$output->writeln("<info>".$e->getMessage()."</info>");
|
||||
} catch (\Exception $e) {
|
||||
// Fail in case of any other error during upgrade
|
||||
$output->writeln("<error>" . $e->getMessage() . "</error>");
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
protected function makeUpdate(InputInterface $input, OutputInterface $output, $doDryRun)
|
||||
{
|
||||
$this->checkAllRequiredOptionsAreNotEmpty($input);
|
||||
|
||||
$updateController = new Controller();
|
||||
echo $updateController->runUpdaterAndExit($doDryRun);
|
||||
}
|
||||
}
|
||||
432
www/analytics/plugins/CoreUpdater/Controller.php
Normal file
432
www/analytics/plugins/CoreUpdater/Controller.php
Normal file
|
|
@ -0,0 +1,432 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\CoreUpdater;
|
||||
|
||||
use Exception;
|
||||
use Piwik\ArchiveProcessor\Rules;
|
||||
use Piwik\Common;
|
||||
use Piwik\Config;
|
||||
use Piwik\DbHelper;
|
||||
use Piwik\Filechecks;
|
||||
use Piwik\Filesystem;
|
||||
use Piwik\Http;
|
||||
use Piwik\Option;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin;
|
||||
use Piwik\Plugins\CorePluginsAdmin\Marketplace;
|
||||
use Piwik\Plugins\LanguagesManager\LanguagesManager;
|
||||
use Piwik\SettingsPiwik;
|
||||
use Piwik\SettingsServer;
|
||||
use Piwik\Unzip;
|
||||
use Piwik\UpdateCheck;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Version;
|
||||
use Piwik\View;
|
||||
use Piwik\View\OneClickDone;
|
||||
use Piwik\Plugin\Manager as PluginManager;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Controller extends \Piwik\Plugin\Controller
|
||||
{
|
||||
const CONFIG_FILE_BACKUP = '/config/global.ini.auto-backup-before-update.php';
|
||||
const PATH_TO_EXTRACT_LATEST_VERSION = '/tmp/latest/';
|
||||
|
||||
private $coreError = false;
|
||||
private $warningMessages = array();
|
||||
private $errorMessages = array();
|
||||
private $deactivatedPlugins = array();
|
||||
private $pathPiwikZip = false;
|
||||
private $newVersion;
|
||||
|
||||
static protected function getLatestZipUrl($newVersion)
|
||||
{
|
||||
if (@Config::getInstance()->Debug['allow_upgrades_to_beta']) {
|
||||
return 'http://builds.piwik.org/piwik-' . $newVersion . '.zip';
|
||||
}
|
||||
return Config::getInstance()->General['latest_version_url'];
|
||||
}
|
||||
|
||||
public function newVersionAvailable()
|
||||
{
|
||||
Piwik::checkUserHasSuperUserAccess();
|
||||
|
||||
$newVersion = $this->checkNewVersionIsAvailableOrDie();
|
||||
|
||||
$view = new View('@CoreUpdater/newVersionAvailable');
|
||||
|
||||
$view->piwik_version = Version::VERSION;
|
||||
$view->piwik_new_version = $newVersion;
|
||||
|
||||
$incompatiblePlugins = $this->getIncompatiblePlugins($newVersion);
|
||||
|
||||
$marketplacePlugins = array();
|
||||
try {
|
||||
if (!empty($incompatiblePlugins)) {
|
||||
$marketplace = new Marketplace();
|
||||
$marketplacePlugins = $marketplace->getAllAvailablePluginNames();
|
||||
}
|
||||
} catch (\Exception $e) {}
|
||||
|
||||
$view->marketplacePlugins = $marketplacePlugins;
|
||||
$view->incompatiblePlugins = $incompatiblePlugins;
|
||||
$view->piwik_latest_version_url = self::getLatestZipUrl($newVersion);
|
||||
$view->can_auto_update = Filechecks::canAutoUpdate();
|
||||
$view->makeWritableCommands = Filechecks::getAutoUpdateMakeWritableMessage();
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
public function oneClickUpdate()
|
||||
{
|
||||
Piwik::checkUserHasSuperUserAccess();
|
||||
$this->newVersion = $this->checkNewVersionIsAvailableOrDie();
|
||||
|
||||
SettingsServer::setMaxExecutionTime(0);
|
||||
|
||||
$url = self::getLatestZipUrl($this->newVersion);
|
||||
$steps = array(
|
||||
array('oneClick_Download', Piwik::translate('CoreUpdater_DownloadingUpdateFromX', $url)),
|
||||
array('oneClick_Unpack', Piwik::translate('CoreUpdater_UnpackingTheUpdate')),
|
||||
array('oneClick_Verify', Piwik::translate('CoreUpdater_VerifyingUnpackedFiles')),
|
||||
array('oneClick_CreateConfigFileBackup', Piwik::translate('CoreUpdater_CreatingBackupOfConfigurationFile', self::CONFIG_FILE_BACKUP))
|
||||
);
|
||||
$incompatiblePlugins = $this->getIncompatiblePlugins($this->newVersion);
|
||||
if (!empty($incompatiblePlugins)) {
|
||||
$namesToDisable = array();
|
||||
foreach ($incompatiblePlugins as $incompatiblePlugin) {
|
||||
$namesToDisable[] = $incompatiblePlugin->getPluginName();
|
||||
}
|
||||
$steps[] = array('oneClick_DisableIncompatiblePlugins', Piwik::translate('CoreUpdater_DisablingIncompatiblePlugins', implode(', ', $namesToDisable)));
|
||||
}
|
||||
|
||||
$steps[] = array('oneClick_Copy', Piwik::translate('CoreUpdater_InstallingTheLatestVersion'));
|
||||
$steps[] = array('oneClick_Finished', Piwik::translate('CoreUpdater_PiwikUpdatedSuccessfully'));
|
||||
|
||||
$errorMessage = false;
|
||||
$messages = array();
|
||||
foreach ($steps as $step) {
|
||||
try {
|
||||
$method = $step[0];
|
||||
$message = $step[1];
|
||||
$this->$method();
|
||||
$messages[] = $message;
|
||||
} catch (Exception $e) {
|
||||
$errorMessage = $e->getMessage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$view = new OneClickDone(Piwik::getCurrentUserTokenAuth());
|
||||
$view->coreError = $errorMessage;
|
||||
$view->feedbackMessages = $messages;
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
public function oneClickResults()
|
||||
{
|
||||
$view = new View('@CoreUpdater/oneClickResults');
|
||||
$view->coreError = Common::getRequestVar('error', '', 'string', $_POST);
|
||||
$view->feedbackMessages = safe_unserialize(Common::unsanitizeInputValue(Common::getRequestVar('messages', '', 'string', $_POST)));
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
protected function redirectToDashboardWhenNoError($updater)
|
||||
{
|
||||
if (count($updater->getSqlQueriesToExecute()) == 1
|
||||
&& !$this->coreError
|
||||
&& empty($this->warningMessages)
|
||||
&& empty($this->errorMessages)
|
||||
&& empty($this->deactivatedPlugins)
|
||||
) {
|
||||
Piwik::redirectToModule('CoreHome');
|
||||
}
|
||||
}
|
||||
|
||||
protected static function clearPhpCaches()
|
||||
{
|
||||
if (function_exists('apc_clear_cache')) {
|
||||
apc_clear_cache(); // clear the system (aka 'opcode') cache
|
||||
}
|
||||
|
||||
if (function_exists('opcache_reset')) {
|
||||
opcache_reset(); // reset the opcode cache (php 5.5.0+)
|
||||
}
|
||||
}
|
||||
|
||||
private function checkNewVersionIsAvailableOrDie()
|
||||
{
|
||||
$newVersion = UpdateCheck::isNewestVersionAvailable();
|
||||
if (!$newVersion) {
|
||||
throw new Exception(Piwik::translate('CoreUpdater_ExceptionAlreadyLatestVersion', Version::VERSION));
|
||||
}
|
||||
return $newVersion;
|
||||
}
|
||||
|
||||
private function oneClick_Download()
|
||||
{
|
||||
$pathPiwikZip = PIWIK_USER_PATH . self::PATH_TO_EXTRACT_LATEST_VERSION . 'latest.zip';
|
||||
$this->pathPiwikZip = SettingsPiwik::rewriteTmpPathWithHostname($pathPiwikZip);
|
||||
|
||||
Filechecks::dieIfDirectoriesNotWritable(array(self::PATH_TO_EXTRACT_LATEST_VERSION));
|
||||
|
||||
// we catch exceptions in the caller (i.e., oneClickUpdate)
|
||||
$url = self::getLatestZipUrl($this->newVersion) . '?cb=' . $this->newVersion;
|
||||
|
||||
Http::fetchRemoteFile($url, $this->pathPiwikZip);
|
||||
}
|
||||
|
||||
private function oneClick_Unpack()
|
||||
{
|
||||
$pathExtracted = PIWIK_USER_PATH . self::PATH_TO_EXTRACT_LATEST_VERSION;
|
||||
$pathExtracted = SettingsPiwik::rewriteTmpPathWithHostname($pathExtracted);
|
||||
|
||||
$this->pathRootExtractedPiwik = $pathExtracted . 'piwik';
|
||||
|
||||
if (file_exists($this->pathRootExtractedPiwik)) {
|
||||
Filesystem::unlinkRecursive($this->pathRootExtractedPiwik, true);
|
||||
}
|
||||
|
||||
$archive = Unzip::factory('PclZip', $this->pathPiwikZip);
|
||||
|
||||
if (0 == ($archive_files = $archive->extract($pathExtracted))) {
|
||||
throw new Exception(Piwik::translate('CoreUpdater_ExceptionArchiveIncompatible', $archive->errorInfo()));
|
||||
}
|
||||
|
||||
if (0 == count($archive_files)) {
|
||||
throw new Exception(Piwik::translate('CoreUpdater_ExceptionArchiveEmpty'));
|
||||
}
|
||||
unlink($this->pathPiwikZip);
|
||||
}
|
||||
|
||||
private function oneClick_Verify()
|
||||
{
|
||||
$someExpectedFiles = array(
|
||||
'/config/global.ini.php',
|
||||
'/index.php',
|
||||
'/core/Piwik.php',
|
||||
'/piwik.php',
|
||||
'/plugins/API/API.php'
|
||||
);
|
||||
foreach ($someExpectedFiles as $file) {
|
||||
if (!is_file($this->pathRootExtractedPiwik . $file)) {
|
||||
throw new Exception(Piwik::translate('CoreUpdater_ExceptionArchiveIncomplete', $file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function oneClick_CreateConfigFileBackup()
|
||||
{
|
||||
$configFileBefore = PIWIK_USER_PATH . '/config/global.ini.php';
|
||||
$configFileAfter = PIWIK_USER_PATH . self::CONFIG_FILE_BACKUP;
|
||||
Filesystem::copy($configFileBefore, $configFileAfter);
|
||||
}
|
||||
|
||||
private function oneClick_DisableIncompatiblePlugins()
|
||||
{
|
||||
$plugins = $this->getIncompatiblePlugins($this->newVersion);
|
||||
|
||||
foreach ($plugins as $plugin) {
|
||||
PluginManager::getInstance()->deactivatePlugin($plugin->getPluginName());
|
||||
}
|
||||
}
|
||||
|
||||
private function oneClick_Copy()
|
||||
{
|
||||
/*
|
||||
* Make sure the execute bit is set for this shell script
|
||||
*/
|
||||
if (!Rules::isBrowserTriggerEnabled()) {
|
||||
@chmod($this->pathRootExtractedPiwik . '/misc/cron/archive.sh', 0755);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy all files to PIWIK_INCLUDE_PATH.
|
||||
* These files are accessed through the dispatcher.
|
||||
*/
|
||||
Filesystem::copyRecursive($this->pathRootExtractedPiwik, PIWIK_INCLUDE_PATH);
|
||||
|
||||
/*
|
||||
* These files are visible in the web root and are generally
|
||||
* served directly by the web server. May be shared.
|
||||
*/
|
||||
if (PIWIK_INCLUDE_PATH !== PIWIK_DOCUMENT_ROOT) {
|
||||
/*
|
||||
* Copy PHP files that expect to be in the document root
|
||||
*/
|
||||
$specialCases = array(
|
||||
'/index.php',
|
||||
'/piwik.php',
|
||||
'/js/index.php',
|
||||
);
|
||||
|
||||
foreach ($specialCases as $file) {
|
||||
Filesystem::copy($this->pathRootExtractedPiwik . $file, PIWIK_DOCUMENT_ROOT . $file);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the non-PHP files (e.g., images, css, javascript)
|
||||
*/
|
||||
Filesystem::copyRecursive($this->pathRootExtractedPiwik, PIWIK_DOCUMENT_ROOT, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Config files may be user (account) specific
|
||||
*/
|
||||
if (PIWIK_INCLUDE_PATH !== PIWIK_USER_PATH) {
|
||||
Filesystem::copyRecursive($this->pathRootExtractedPiwik . '/config', PIWIK_USER_PATH . '/config');
|
||||
}
|
||||
|
||||
Filesystem::unlinkRecursive($this->pathRootExtractedPiwik, true);
|
||||
|
||||
self::clearPhpCaches();
|
||||
}
|
||||
|
||||
private function oneClick_Finished()
|
||||
{
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$language = Common::getRequestVar('language', '');
|
||||
if (!empty($language)) {
|
||||
LanguagesManager::setLanguageForSession($language);
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->runUpdaterAndExit();
|
||||
} catch(NoUpdatesFoundException $e) {
|
||||
Piwik::redirectToModule('CoreHome');
|
||||
}
|
||||
}
|
||||
|
||||
public function runUpdaterAndExit($doDryRun = null)
|
||||
{
|
||||
$updater = new Updater();
|
||||
$componentsWithUpdateFile = CoreUpdater::getComponentUpdates($updater);
|
||||
if (empty($componentsWithUpdateFile)) {
|
||||
throw new NoUpdatesFoundException("Everything is already up to date.");
|
||||
}
|
||||
|
||||
SettingsServer::setMaxExecutionTime(0);
|
||||
|
||||
$cli = Common::isPhpCliMode() ? '_cli' : '';
|
||||
$welcomeTemplate = '@CoreUpdater/runUpdaterAndExit_welcome' . $cli;
|
||||
$doneTemplate = '@CoreUpdater/runUpdaterAndExit_done' . $cli;
|
||||
$viewWelcome = new View($welcomeTemplate);
|
||||
$viewDone = new View($doneTemplate);
|
||||
$doExecuteUpdates = Common::getRequestVar('updateCorePlugins', 0, 'integer') == 1;
|
||||
|
||||
if(is_null($doDryRun)) {
|
||||
$doDryRun = !$doExecuteUpdates;
|
||||
}
|
||||
|
||||
if($doDryRun) {
|
||||
$viewWelcome->queries = $updater->getSqlQueriesToExecute();
|
||||
$viewWelcome->isMajor = $updater->hasMajorDbUpdate();
|
||||
$this->doWelcomeUpdates($viewWelcome, $componentsWithUpdateFile);
|
||||
return $viewWelcome->render();
|
||||
}
|
||||
|
||||
// CLI
|
||||
if (Common::isPhpCliMode()) {
|
||||
$this->doWelcomeUpdates($viewWelcome, $componentsWithUpdateFile);
|
||||
$output = $viewWelcome->render();
|
||||
|
||||
// Proceed with upgrade in CLI only if user specifically asked for it, or if running console command
|
||||
$isUpdateRequested = Common::isRunningConsoleCommand() || Piwik::getModule() == 'CoreUpdater';
|
||||
|
||||
if (!$this->coreError && $isUpdateRequested) {
|
||||
$this->doExecuteUpdates($viewDone, $updater, $componentsWithUpdateFile);
|
||||
$output .= $viewDone->render();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Web
|
||||
if ($doExecuteUpdates) {
|
||||
$this->warningMessages = array();
|
||||
$this->doExecuteUpdates($viewDone, $updater, $componentsWithUpdateFile);
|
||||
|
||||
$this->redirectToDashboardWhenNoError($updater);
|
||||
|
||||
return $viewDone->render();
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
private function doWelcomeUpdates($view, $componentsWithUpdateFile)
|
||||
{
|
||||
$view->new_piwik_version = Version::VERSION;
|
||||
$view->commandUpgradePiwik = "<br /><code>php " . Filesystem::getPathToPiwikRoot() . "/console core:update </code>";
|
||||
$pluginNamesToUpdate = array();
|
||||
$coreToUpdate = false;
|
||||
|
||||
// handle case of existing database with no tables
|
||||
if (!DbHelper::isInstalled()) {
|
||||
$this->errorMessages[] = Piwik::translate('CoreUpdater_EmptyDatabaseError', Config::getInstance()->database['dbname']);
|
||||
$this->coreError = true;
|
||||
$currentVersion = 'N/A';
|
||||
} else {
|
||||
$this->errorMessages = array();
|
||||
try {
|
||||
$currentVersion = Option::get('version_core');
|
||||
} catch (Exception $e) {
|
||||
$currentVersion = '<= 0.2.9';
|
||||
}
|
||||
|
||||
foreach ($componentsWithUpdateFile as $name => $filenames) {
|
||||
if ($name == 'core') {
|
||||
$coreToUpdate = true;
|
||||
} else {
|
||||
$pluginNamesToUpdate[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check file integrity
|
||||
$integrityInfo = Filechecks::getFileIntegrityInformation();
|
||||
if (isset($integrityInfo[1])) {
|
||||
if ($integrityInfo[0] == false) {
|
||||
$this->warningMessages[] = Piwik::translate('General_FileIntegrityWarningExplanation');
|
||||
}
|
||||
$this->warningMessages = array_merge($this->warningMessages, array_slice($integrityInfo, 1));
|
||||
}
|
||||
Filesystem::deleteAllCacheOnUpdate();
|
||||
|
||||
$view->coreError = $this->coreError;
|
||||
$view->warningMessages = $this->warningMessages;
|
||||
$view->errorMessages = $this->errorMessages;
|
||||
$view->current_piwik_version = $currentVersion;
|
||||
$view->pluginNamesToUpdate = $pluginNamesToUpdate;
|
||||
$view->coreToUpdate = $coreToUpdate;
|
||||
}
|
||||
|
||||
private function doExecuteUpdates($view, $updater, $componentsWithUpdateFile)
|
||||
{
|
||||
$result = CoreUpdater::updateComponents($updater, $componentsWithUpdateFile);
|
||||
|
||||
$this->coreError = $result['coreError'];
|
||||
$this->warningMessages = $result['warnings'];
|
||||
$this->errorMessages = $result['errors'];
|
||||
$this->deactivatedPlugins = $result['deactivatedPlugins'];
|
||||
$view->coreError = $this->coreError;
|
||||
$view->warningMessages = $this->warningMessages;
|
||||
$view->errorMessages = $this->errorMessages;
|
||||
$view->deactivatedPlugins = $this->deactivatedPlugins;
|
||||
}
|
||||
|
||||
private function getIncompatiblePlugins($piwikVersion)
|
||||
{
|
||||
return PluginManager::getInstance()->getIncompatiblePlugins($piwikVersion);
|
||||
}
|
||||
|
||||
}
|
||||
160
www/analytics/plugins/CoreUpdater/CoreUpdater.php
Normal file
160
www/analytics/plugins/CoreUpdater/CoreUpdater.php
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\CoreUpdater;
|
||||
|
||||
use Exception;
|
||||
use Piwik\Common;
|
||||
use Piwik\Filesystem;
|
||||
use Piwik\FrontController;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\ScheduledTask;
|
||||
use Piwik\ScheduledTime;
|
||||
use Piwik\UpdateCheck;
|
||||
use Piwik\Updater;
|
||||
use Piwik\UpdaterErrorException;
|
||||
use Piwik\Version;
|
||||
use Piwik\Access;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CoreUpdater extends \Piwik\Plugin
|
||||
{
|
||||
/**
|
||||
* @see Piwik\Plugin::getListHooksRegistered
|
||||
*/
|
||||
public function getListHooksRegistered()
|
||||
{
|
||||
$hooks = array(
|
||||
'Request.dispatchCoreAndPluginUpdatesScreen' => 'dispatch',
|
||||
'Platform.initialized' => 'updateCheck',
|
||||
'TaskScheduler.getScheduledTasks' => 'getScheduledTasks',
|
||||
);
|
||||
return $hooks;
|
||||
}
|
||||
|
||||
public function getScheduledTasks(&$tasks)
|
||||
{
|
||||
$sendUpdateNotification = new ScheduledTask($this,
|
||||
'sendNotificationIfUpdateAvailable',
|
||||
null,
|
||||
ScheduledTime::factory('daily'),
|
||||
ScheduledTask::LOWEST_PRIORITY);
|
||||
$tasks[] = $sendUpdateNotification;
|
||||
}
|
||||
|
||||
public function sendNotificationIfUpdateAvailable()
|
||||
{
|
||||
$coreUpdateCommunication = new UpdateCommunication();
|
||||
if ($coreUpdateCommunication->isEnabled()) {
|
||||
$coreUpdateCommunication->sendNotificationIfUpdateAvailable();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
} else {
|
||||
\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
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getComponentUpdates(Updater $updater)
|
||||
{
|
||||
$updater->addComponentToCheck('core', Version::VERSION);
|
||||
$plugins = \Piwik\Plugin\Manager::getInstance()->getLoadedPlugins();
|
||||
foreach ($plugins as $pluginName => $plugin) {
|
||||
$updater->addComponentToCheck($pluginName, $plugin->getVersion());
|
||||
}
|
||||
|
||||
$componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
|
||||
if (count($componentsWithUpdateFile) == 0 && !$updater->hasNewVersion('core')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $componentsWithUpdateFile;
|
||||
}
|
||||
|
||||
public function dispatch()
|
||||
{
|
||||
$module = Common::getRequestVar('module', '', 'string');
|
||||
$action = Common::getRequestVar('action', '', 'string');
|
||||
|
||||
$updater = new Updater();
|
||||
$updater->addComponentToCheck('core', Version::VERSION);
|
||||
$updates = $updater->getComponentsWithNewVersion();
|
||||
if (!empty($updates)) {
|
||||
Filesystem::deleteAllCacheOnUpdate();
|
||||
}
|
||||
if (self::getComponentUpdates($updater) !== null
|
||||
&& $module != 'CoreUpdater'
|
||||
// Proxy module is used to redirect users to piwik.org, should still work when Piwik must be updated
|
||||
&& $module != 'Proxy'
|
||||
// Do not show update page during installation.
|
||||
&& $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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateCheck()
|
||||
{
|
||||
UpdateCheck::check();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\CoreUpdater;
|
||||
|
||||
class NoUpdatesFoundException extends \Exception {
|
||||
|
||||
}
|
||||
157
www/analytics/plugins/CoreUpdater/UpdateCommunication.php
Normal file
157
www/analytics/plugins/CoreUpdater/UpdateCommunication.php
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\CoreUpdater;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\Mail;
|
||||
use Piwik\Option;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\SettingsPiwik;
|
||||
use Piwik\UpdateCheck;
|
||||
use Piwik\Plugins\UsersManager\API as UsersManagerApi;
|
||||
|
||||
/**
|
||||
* Class to check and notify users via email if there is a core update available.
|
||||
*/
|
||||
class UpdateCommunication
|
||||
{
|
||||
|
||||
/**
|
||||
* Checks whether update communciation in general is enabled or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
$isEnabled = Config::getInstance()->General['enable_update_communication'];
|
||||
|
||||
return !empty($isEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a notification email to all super users if there is a core update available but only if we haven't notfied
|
||||
* them about a specific new version yet.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function sendNotificationIfUpdateAvailable()
|
||||
{
|
||||
if (!$this->isNewVersionAvailable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->hasNotificationAlreadyReceived()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setHasLatestUpdateNotificationReceived();
|
||||
$this->sendNotifications();
|
||||
}
|
||||
|
||||
protected function sendNotifications()
|
||||
{
|
||||
$latestVersion = $this->getLatestVersion();
|
||||
|
||||
$host = SettingsPiwik::getPiwikUrl();
|
||||
|
||||
$subject = Piwik::translate('CoreUpdater_NotificationSubjectAvailableCoreUpdate', $latestVersion);
|
||||
$message = Piwik::translate('ScheduledReports_EmailHello');
|
||||
$message .= "\n\n";
|
||||
$message .= Piwik::translate('CoreUpdater_ThereIsNewVersionAvailableForUpdate');
|
||||
$message .= "\n\n";
|
||||
$message .= Piwik::translate('CoreUpdater_YouCanUpgradeAutomaticallyOrDownloadPackage', $latestVersion);
|
||||
$message .= "\n\n";
|
||||
$message .= $host . 'index.php?module=CoreUpdater&action=newVersionAvailable';
|
||||
$message .= "\n\n";
|
||||
$message .= Piwik::translate('CoreUpdater_FeedbackRequest');
|
||||
$message .= "\n";
|
||||
$message .= 'http://piwik.org/contact/';
|
||||
|
||||
$this->sendEmailNotification($subject, $message);
|
||||
}
|
||||
|
||||
private function isVersionLike($latestVersion)
|
||||
{
|
||||
return strlen($latestVersion) < 18;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an email notification to all super users.
|
||||
*
|
||||
* @param $subject
|
||||
* @param $message
|
||||
*/
|
||||
protected function sendEmailNotification($subject, $message)
|
||||
{
|
||||
$superUsers = UsersManagerApi::getInstance()->getUsersHavingSuperUserAccess();
|
||||
|
||||
foreach ($superUsers as $superUser) {
|
||||
$mail = new Mail();
|
||||
$mail->setDefaultFromPiwik();
|
||||
$mail->addTo($superUser['email']);
|
||||
$mail->setSubject($subject);
|
||||
$mail->setBodyText($message);
|
||||
$mail->send();
|
||||
}
|
||||
}
|
||||
|
||||
private function isNewVersionAvailable()
|
||||
{
|
||||
UpdateCheck::check();
|
||||
|
||||
$hasUpdate = UpdateCheck::isNewestVersionAvailable();
|
||||
|
||||
if (!$hasUpdate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$latestVersion = self::getLatestVersion();
|
||||
if (!$this->isVersionLike($latestVersion)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $hasUpdate;
|
||||
}
|
||||
|
||||
private function hasNotificationAlreadyReceived()
|
||||
{
|
||||
$latestVersion = $this->getLatestVersion();
|
||||
$lastVersionSent = $this->getLatestVersionSent();
|
||||
|
||||
if (!empty($lastVersionSent)
|
||||
&& ($latestVersion == $lastVersionSent
|
||||
|| version_compare($latestVersion, $lastVersionSent) == -1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getLatestVersion()
|
||||
{
|
||||
return UpdateCheck::getLatestVersion();
|
||||
}
|
||||
|
||||
private function getLatestVersionSent()
|
||||
{
|
||||
return Option::get($this->getNotificationSentOptionName());
|
||||
}
|
||||
|
||||
private function setHasLatestUpdateNotificationReceived()
|
||||
{
|
||||
$latestVersion = $this->getLatestVersion();
|
||||
|
||||
Option::set($this->getNotificationSentOptionName(), $latestVersion);
|
||||
}
|
||||
|
||||
private function getNotificationSentOptionName()
|
||||
{
|
||||
return 'last_update_communication_sent_core';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
$(document).ready(function () {
|
||||
$('#showSql').click(function () {
|
||||
$('#sqlQueries').toggle();
|
||||
});
|
||||
$('#upgradeCorePluginsForm').submit(function () {
|
||||
$('input[type=submit]', this).prop('disabled', 'disabled');
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.topBarElem {
|
||||
font-family: arial, sans-serif !important;
|
||||
font-size: 13px;
|
||||
line-height: 1.33;
|
||||
}
|
||||
|
||||
#donate-form-container {
|
||||
margin: 0 0 2em 2em;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #F0F7FF;
|
||||
border: 1px dashed #00008B;
|
||||
border-left: 5px solid;
|
||||
direction: ltr;
|
||||
display: block;
|
||||
margin: 2px 2px 20px;
|
||||
padding: 4px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-top: 10px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
#oneclickupdate .submit {
|
||||
clear:none;
|
||||
float:left;
|
||||
}
|
||||
form#oneclickupdate {
|
||||
min-height: 50px;
|
||||
}
|
||||
36
www/analytics/plugins/CoreUpdater/templates/layout.twig
Normal file
36
www/analytics/plugins/CoreUpdater/templates/layout.twig
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Piwik › {{ 'CoreUpdater_UpdateTitle'|translate }}</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EDGE,chrome=1"/>
|
||||
<meta name="viewport" content="initial-scale=1.0" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="libs/jquery/themes/base/jquery-ui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="index.php?module=Installation&action=getBaseCss"/>
|
||||
<link rel="stylesheet" type="text/css" href="plugins/Zeitgeist/stylesheets/simple_structure.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="plugins/CoreHome/stylesheets/jquery.ui.autocomplete.css" />
|
||||
<link rel="stylesheet" type="text/css" href="plugins/CoreUpdater/stylesheets/updateLayout.css" />
|
||||
|
||||
<script type="text/javascript" src="libs/jquery/jquery.js"></script>
|
||||
<script type="text/javascript" src="libs/jquery/jquery-ui.js"></script>
|
||||
<script type="text/javascript" src="plugins/CoreHome/javascripts/donate.js"></script>
|
||||
<script type="text/javascript" src="plugins/CoreUpdater/javascripts/updateLayout.js"></script>
|
||||
<script type="text/javascript">{{ getJavascriptTranslations()|raw }}</script>
|
||||
{% if 'General_LayoutDirection'|translate =='rtl' %}
|
||||
<link rel="stylesheet" type="text/css" href="plugins/Zeitgeist/stylesheets/rtl.css"/>
|
||||
{% endif %}
|
||||
|
||||
<link rel="shortcut icon" href="plugins/CoreHome/images/favicon.ico"/>
|
||||
</head>
|
||||
<body id="simple">
|
||||
<div id="contentsimple">
|
||||
<div id="title">
|
||||
<img title='Piwik' alt="Piwik" src="plugins/Morpheus/images/logo-header.png" style="margin-left:10px;"/>
|
||||
<span id="subh1"> # {{ 'General_OpenSourceWebAnalytics'|translate }}</span>
|
||||
</div>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
{% extends '@CoreUpdater/layout.twig' %}
|
||||
{% import '@CorePluginsAdmin/macros.twig' as pluginsMacro %}
|
||||
|
||||
{% block content %}
|
||||
<br/>
|
||||
<p><strong>{{ 'CoreUpdater_ThereIsNewVersionAvailableForUpdate'|translate }}</strong></p>
|
||||
|
||||
{% if can_auto_update %}
|
||||
<p>{{ 'CoreUpdater_YouCanUpgradeAutomaticallyOrDownloadPackage'|translate(piwik_new_version) }}</p>
|
||||
{% else %}
|
||||
<p>{{ 'Installation_SystemCheckAutoUpdateHelp'|translate }}</p>
|
||||
<p>{{ 'CoreUpdater_YouMustDownloadPackageOrFixPermissions'|translate(piwik_new_version) }}
|
||||
{{ makeWritableCommands|raw }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if incompatiblePlugins %}
|
||||
<p>{{ 'CoreUpdater_IncompatbilePluginsWillBeDisabledInfo'|translate(piwik_new_version) }}</p>
|
||||
|
||||
<ul style="list-style: disc;">
|
||||
{% for plugin in incompatiblePlugins %}
|
||||
<li>{{ pluginsMacro.missingRequirementsInfo(plugin.getPluginName, plugin.getInformation, plugin.getMissingDependencies(piwik_new_version), marketplacePlugins) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p> </p>
|
||||
{% endif %}
|
||||
|
||||
{% if can_auto_update %}
|
||||
<form id="oneclickupdate" action="index.php">
|
||||
<input type="hidden" name="module" value="CoreUpdater"/>
|
||||
<input type="hidden" name="action" value="oneClickUpdate"/>
|
||||
<input type="submit" class="submit" value="{{ 'CoreUpdater_UpdateAutomatically'|translate }}"/>
|
||||
{% endif %}
|
||||
<a style="margin-left:50px;" class="submit button"
|
||||
href="{{ piwik_latest_version_url }}?cb={{ piwik_new_version }}">{{ 'CoreUpdater_DownloadX'|translate(piwik_new_version) }}</a><br/>
|
||||
{% if can_auto_update %}
|
||||
</form>
|
||||
{% endif %}
|
||||
<br/>
|
||||
<a href="index.php">« {{ 'General_BackToPiwik'|translate }}</a>
|
||||
{% endblock %}
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
{% extends '@CoreUpdater/layout.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<br/>
|
||||
{% for message in feedbackMessages %}
|
||||
<p>{{ message }}</p>
|
||||
{% endfor %}
|
||||
|
||||
{% if coreError %}
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="error"><img src="plugins/Zeitgeist/images/error_medium.png"/> {{ coreError }}</div>
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="warning">
|
||||
<img src="plugins/Zeitgeist/images/warning_medium.png"/>
|
||||
{{ 'CoreUpdater_UpdateHasBeenCancelledExplanation'|translate("<br /><br />","<a target='_blank' href='?module=Proxy&action=redirect&url=http://piwik.org/docs/update/'>","</a>")|raw }}
|
||||
</div>
|
||||
<br/>
|
||||
<br/>
|
||||
{% endif %}
|
||||
|
||||
<form action="index.php">
|
||||
<input type="submit" class="submit" value="{{ 'General_ContinueToPiwik'|translate }}"/>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
{% extends '@CoreUpdater/layout.twig' %}
|
||||
{% set helpMessage %}
|
||||
{{ 'CoreUpdater_HelpMessageContent'|translate('<a target="_blank" href="?module=Proxy&action=redirect&url=http://piwik.org/faq/">','</a>','</li><li>')|raw }}
|
||||
{% endset %}
|
||||
|
||||
{% block content %}
|
||||
{% if coreError %}
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="error">
|
||||
<img src="plugins/Zeitgeist/images/error_medium.png"/> {{ 'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate }}
|
||||
{% for message in errorMessages %}
|
||||
<pre>{{ message }}</pre>
|
||||
<br/>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<br/>
|
||||
<p>{{ 'CoreUpdater_HelpMessageIntroductionWhenError'|translate }}
|
||||
<ul>
|
||||
<li>{{ helpMessage }}</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>{{ 'CoreUpdater_ErrorDIYHelp'|translate }}
|
||||
<ul>
|
||||
<li>{{ 'CoreUpdater_ErrorDIYHelp_1'|translate }}</li>
|
||||
<li>{{ 'CoreUpdater_ErrorDIYHelp_2'|translate }}</li>
|
||||
<li>{{ 'CoreUpdater_ErrorDIYHelp_3'|translate }} <a href='https://piwik.org/faq/how-to-update/#faq_179' target='_blank'>(see FAQ)</a></li>
|
||||
<li>{{ 'CoreUpdater_ErrorDIYHelp_4'|translate }}</li>
|
||||
<li>{{ 'CoreUpdater_ErrorDIYHelp_5'|translate }}</li>
|
||||
</ul>
|
||||
</p>
|
||||
{% else %}
|
||||
{% if warningMessages|length > 0 %}
|
||||
<div class="warning">
|
||||
<p><img src="plugins/Zeitgeist/images/warning_medium.png"/> {{ 'CoreUpdater_WarningMessages'|translate }}</p>
|
||||
{% for message in warningMessages %}
|
||||
<pre>{{ message }}</pre>
|
||||
<br/>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if errorMessages|length > 0 %}
|
||||
<div class="warning">
|
||||
<p><img src="plugins/Zeitgeist/images/error_medium.png"/> {{ 'CoreUpdater_ErrorDuringPluginsUpdates'|translate }}</p>
|
||||
{% for message in errorMessages %}
|
||||
<pre>{{ message }}</pre>
|
||||
<br/>
|
||||
{% endfor %}
|
||||
|
||||
{% if deactivatedPlugins is defined and deactivatedPlugins|length > 0 %}
|
||||
{% set listOfDeactivatedPlugins=deactivatedPlugins|join(', ') %}
|
||||
<p style="color:red;">
|
||||
<img src="plugins/Zeitgeist/images/error_medium.png"/>
|
||||
{{ 'CoreUpdater_WeAutomaticallyDeactivatedTheFollowingPlugins'|translate(listOfDeactivatedPlugins) }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if errorMessages|length > 0 or warningMessages|length > 0 %}
|
||||
<br/>
|
||||
<p>{{ 'CoreUpdater_HelpMessageIntroductionWhenWarning'|translate }}
|
||||
<ul>
|
||||
<li>{{ helpMessage }}</li>
|
||||
</ul>
|
||||
</p>
|
||||
{% else %}
|
||||
<p class="success">{{ 'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate }}</p>
|
||||
<div id="donate-form-container">
|
||||
{% include "@CoreHome/_donate.twig" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<form action="index.php">
|
||||
<input type="submit" class="submit" value="{{ 'General_ContinueToPiwik'|translate }}"/>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
{% autoescape false %}
|
||||
{% set helpMessage %}{{- 'CoreUpdater_HelpMessageContent'|translate('[',']',"\n\n *") }}{% endset %}
|
||||
{% if coreError %}
|
||||
[X] {{ 'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate }}
|
||||
|
||||
{% for message in errorMessages %}
|
||||
* {{ message }}
|
||||
{% endfor %}
|
||||
|
||||
{{ 'CoreUpdater_HelpMessageIntroductionWhenError'|translate }}
|
||||
|
||||
* {{ helpMessage }}
|
||||
|
||||
{{ 'CoreUpdater_ErrorDIYHelp'|translate }}
|
||||
* {{ 'CoreUpdater_ErrorDIYHelp_1'|translate }}
|
||||
* {{ 'CoreUpdater_ErrorDIYHelp_2'|translate }}
|
||||
* {{ 'CoreUpdater_ErrorDIYHelp_3'|translate }}
|
||||
* {{ 'CoreUpdater_ErrorDIYHelp_4'|translate }}
|
||||
* {{ 'CoreUpdater_ErrorDIYHelp_5'|translate }}
|
||||
|
||||
{% else %}
|
||||
{% if warningMessages|length > 0 %}
|
||||
[!] {{ 'CoreUpdater_WarningMessages'|translate }}
|
||||
|
||||
{% for message in warningMessages -%}
|
||||
* {{ message }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{% if errorMessages|length > 0 -%}
|
||||
|
||||
[X] {{ 'CoreUpdater_ErrorDuringPluginsUpdates'|translate }}
|
||||
|
||||
{% for message in errorMessages %}
|
||||
* {{ message }}
|
||||
{% endfor %}
|
||||
|
||||
{% if deactivatedPlugins|length > 0 -%}
|
||||
{% set listOfDeactivatedPlugins %}{{ deactivatedPlugins|implode(', ') }}{% endset %}
|
||||
|
||||
[!] {{ 'CoreUpdater_WeAutomaticallyDeactivatedTheFollowingPlugins'|translate(listOfDeactivatedPlugins) }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if errorMessages|length > 0 or warningMessages|length > 0 %}
|
||||
{{ 'CoreUpdater_HelpMessageIntroductionWhenWarning'|translate }}
|
||||
|
||||
* {{ helpMessage }}
|
||||
{% else %}
|
||||
*** {{ 'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate }} ***
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endautoescape %}
|
||||
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
{% extends '@CoreUpdater/layout.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{% spaceless %}
|
||||
<span style="float:right;">{{ postEvent('Template.topBar')|raw }}</span>
|
||||
{% set helpMessage %}
|
||||
{{ 'CoreUpdater_HelpMessageContent'|translate('<a target="_blank" href="?module=Proxy&action=redirect&url=http://piwik.org/faq/">','</a>','</li><li>')|raw }}
|
||||
{% endset %}
|
||||
|
||||
{% if coreError %}
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="error">
|
||||
<img src="plugins/Zeitgeist/images/error_medium.png"/> {{ 'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate }}
|
||||
{% for message in errorMessages %}
|
||||
<pre>{{ message|raw }}</pre>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<br/>
|
||||
<p>{{ 'CoreUpdater_HelpMessageIntroductionWhenError'|translate }}
|
||||
<ul>
|
||||
<li>{{ helpMessage|raw }}</li>
|
||||
</ul>
|
||||
</p>
|
||||
{% else %}
|
||||
{% if coreToUpdate or pluginNamesToUpdate|length > 0 %}
|
||||
<p style='font-size:110%;padding-top:1em;'><strong id='titleUpdate'>{{ 'CoreUpdater_DatabaseUpgradeRequired'|translate }}</strong></p>
|
||||
<p>{{ 'CoreUpdater_YourDatabaseIsOutOfDate'|translate }}</p>
|
||||
{% if coreToUpdate %}
|
||||
<p>{{ 'CoreUpdater_PiwikWillBeUpgradedFromVersionXToVersionY'|translate(current_piwik_version,new_piwik_version) }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if pluginNamesToUpdate|length > 0 %}
|
||||
{% set listOfPlugins=pluginNamesToUpdate|join(', ') %}
|
||||
<p>{{ 'CoreUpdater_TheFollowingPluginsWillBeUpgradedX'|translate(listOfPlugins) }}</p>
|
||||
{% endif %}
|
||||
<h3 id='titleUpdate'>{{ 'CoreUpdater_NoteForLargePiwikInstances'|translate }}</h3>
|
||||
{% if isMajor %}
|
||||
<p class="warning normalFontSize">
|
||||
{{ 'CoreUpdater_MajorUpdateWarning1'|translate }}<br/>
|
||||
{{ 'CoreUpdater_MajorUpdateWarning2'|translate }}
|
||||
</p>
|
||||
{% endif %}
|
||||
<ul>
|
||||
<li>{{ 'CoreUpdater_TheUpgradeProcessMayFailExecuteCommand'|translate(commandUpgradePiwik)|raw }}</li>
|
||||
<li>{{ 'CoreUpdater_HighTrafficPiwikServerEnableMaintenance'|translate('<a target="_blank" href="?module=Proxy&action=redirect&url=http%3A%2F%2Fpiwik.org%2Ffaq%2Fhow-to%2F%23faq_111">', '</a>')|raw }}</li>
|
||||
<li>{{ 'CoreUpdater_YouCouldManuallyExecuteSqlQueries'|translate }}<br/>
|
||||
<a href="#titleUpdate" id="showSql" style="margin-left:20px;">› {{ 'CoreUpdater_ClickHereToViewSqlQueries'|translate }}</a>
|
||||
|
||||
<div id="sqlQueries" style="display:none;">
|
||||
<br/>
|
||||
<code>
|
||||
# {{ 'CoreUpdater_NoteItIsExpectedThatQueriesFail'|translate }}<br/><br/>
|
||||
{% for query in queries %}
|
||||
{{ query }}
|
||||
<br/>
|
||||
{% endfor %}
|
||||
</code>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<br/>
|
||||
<br/>
|
||||
<h4 id="titleUpdate">{{ 'CoreUpdater_ReadyToGo'|translate }}</h4>
|
||||
<p>{{ 'CoreUpdater_TheUpgradeProcessMayTakeAWhilePleaseBePatient'|translate }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if warningMessages|length > 0 %}
|
||||
<p><em>{{ warningMessages[0] }}</em>
|
||||
{% if warningMessages|length > 1 %}
|
||||
<button id="more-results" class="ui-button ui-state-default ui-corner-all">{{ 'General_Details'|translate }}</button>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if coreToUpdate or pluginNamesToUpdate|length > 0 %}
|
||||
<br/>
|
||||
<form action="index.php" id="upgradeCorePluginsForm">
|
||||
<input type="hidden" name="updateCorePlugins" value="1"/>
|
||||
{% if queries|length == 1 %}
|
||||
<input type="submit" class="submit" value="{{ 'General_ContinueToPiwik'|translate }}"/>
|
||||
{% else %}
|
||||
<input type="submit" class="submit" value="{{ 'CoreUpdater_UpgradePiwik'|translate }}"/>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% else %}
|
||||
{% if warningMessages|length == 0 %}
|
||||
<p class="success">{{ 'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate }}</p>
|
||||
{% endif %}
|
||||
<br/>
|
||||
<form action="index.php">
|
||||
<input type="submit" class="submit" value="{{ 'General_ContinueToPiwik'|translate }}"/>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% include "@Installation/_integrityDetails.twig" %}
|
||||
|
||||
{% endspaceless %}
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
{% autoescape false %}
|
||||
{% set helpMessage %}
|
||||
{{- 'CoreUpdater_HelpMessageContent'|translate('[',']','\n\n *') }}
|
||||
{% endset %}
|
||||
|
||||
*** {{ 'CoreUpdater_UpdateTitle'|translate }} ***
|
||||
{% if coreError %}
|
||||
|
||||
[X] {{ 'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate }}
|
||||
|
||||
{% for message in errorMessages %}
|
||||
{{- message }}
|
||||
{% endfor %}
|
||||
|
||||
{{ 'CoreUpdater_HelpMessageIntroductionWhenError'|translate }}
|
||||
|
||||
* {{ helpMessage }}
|
||||
|
||||
{% elseif coreToUpdate or pluginNamesToUpdate|length > 0 %}
|
||||
|
||||
{{ 'CoreUpdater_DatabaseUpgradeRequired'|translate }}
|
||||
|
||||
{{ 'CoreUpdater_YourDatabaseIsOutOfDate'|translate }}
|
||||
|
||||
{% if coreToUpdate %}
|
||||
{{ 'CoreUpdater_PiwikWillBeUpgradedFromVersionXToVersionY'|translate(current_piwik_version, new_piwik_version) }}
|
||||
{% endif %}
|
||||
|
||||
{%- if pluginNamesToUpdate|length > 0 %}
|
||||
{%- set listOfPlugins %}{{ pluginNamesToUpdate|implode(', ') }}{% endset %}
|
||||
{{ 'CoreUpdater_TheFollowingPluginsWillBeUpgradedX'|translate( listOfPlugins) }}
|
||||
{% endif %}
|
||||
|
||||
{# dry run #}
|
||||
{% if queries is defined and queries is not empty %}
|
||||
*** Note: this is a Dry Run ***
|
||||
|
||||
{% for query in queries %}{{ query|trim }}
|
||||
{% endfor %}
|
||||
|
||||
*** End of Dry Run ***
|
||||
{% else %}
|
||||
{{ 'CoreUpdater_TheUpgradeProcessMayTakeAWhilePleaseBePatient'|translate }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endautoescape %}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue