Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Updater.php27
-rw-r--r--core/Updates.php47
-rw-r--r--lang/en.php2
-rw-r--r--plugins/CoreUpdater/Controller.php1
-rw-r--r--plugins/CoreUpdater/templates/update_welcome.tpl6
-rw-r--r--themes/default/simple_structure.css4
6 files changed, 87 insertions, 0 deletions
diff --git a/core/Updater.php b/core/Updater.php
index ae3821d080..b993c9b46a 100644
--- a/core/Updater.php
+++ b/core/Updater.php
@@ -98,6 +98,33 @@ class Piwik_Updater
}
/**
+ * Does one of the new versions involve a major database update?
+ *
+ * @return bool
+ */
+ public function hasMajorDbUpdate()
+ {
+ foreach($this->componentsWithUpdateFile as $componentName => $componentUpdateInfo)
+ {
+ foreach($componentUpdateInfo as $file => $fileVersion)
+ {
+ require_once $file;
+
+ $className = $this->getUpdateClassName($componentName, $fileVersion);
+ if(class_exists($className, false))
+ {
+ $isMajor = call_user_func( array($className, 'isMajorUpdate'));
+ if ($isMajor) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Returns the list of SQL queries that would be executed during the update
*
* @return array of SQL queries
diff --git a/core/Updates.php b/core/Updates.php
index f932227ad9..e53a1d5bbc 100644
--- a/core/Updates.php
+++ b/core/Updates.php
@@ -39,4 +39,51 @@ abstract class Piwik_Updates
static function update()
{
}
+
+ /**
+ * Tell the updater that this is a major update.
+ * Leads to a more visible notice.
+ */
+ static function isMajorUpdate()
+ {
+ return false;
+ }
+
+ /**
+ * Helper method to enable maintenance mode during large updates
+ */
+ static function enableMaintenanceMode()
+ {
+ $config = Piwik_Config::getInstance();
+ $config->init();
+
+ $tracker = $config->Tracker;
+ $tracker['record_statistics'] = 0;
+ $config->Tracker = $tracker;
+
+ $general = $config->General;
+ $general['maintenance_mode'] = 1;
+ $config->General = $general;
+
+ $config->forceSave();
+ }
+
+ /**
+ * Helper method to disable maintenance mode after large updates
+ */
+ static function disableMaintenanceMode()
+ {
+ $config = Piwik_Config::getInstance();
+ $config->init();
+
+ $tracker = $config->Tracker;
+ $tracker['record_statistics'] = 1;
+ $config->Tracker = $tracker;
+
+ $general = $config->General;
+ $general['maintenance_mode'] = 0;
+ $config->General = $general;
+
+ $config->forceSave();
+ }
}
diff --git a/lang/en.php b/lang/en.php
index f51c77a8f5..c1679a0872 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -602,6 +602,8 @@ $translations = array(
'CoreUpdater_ExceptionArchiveIncompatible' => 'Incompatible archive: %s',
'CoreUpdater_ExceptionArchiveEmpty' => 'Empty archive.',
'CoreUpdater_ExceptionArchiveIncomplete' => 'Archive is incomplete: some files are missing (eg. %s).',
+ 'CoreUpdater_MajorUpdateWarning1' => 'This is a major update! It will take longer than usual.',
+ 'CoreUpdater_MajorUpdateWarning2' => 'The following advice is especially important for large installations.',
'CustomVariables_PluginDescription' => 'Custom Variables are name,value pairs that you can set to a Visit using the Javascript API setVisitCustomVariables() function. Piwik will then report how many visits, pages, conversions for each of these custom names and values.',
'CustomVariables_CustomVariables' => 'Custom Variables',
'CustomVariables_ColumnCustomVariableName' => 'Custom Variable name',
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php
index a8ade9afc1..567198bcca 100644
--- a/plugins/CoreUpdater/Controller.php
+++ b/plugins/CoreUpdater/Controller.php
@@ -280,6 +280,7 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller
{
$view = Piwik_View::factory('update_welcome');
$view->queries = $sqlQueries;
+ $view->isMajor = $updater->hasMajorDbUpdate();
$this->doWelcomeUpdates($view, $componentsWithUpdateFile);
echo $view->render();
}
diff --git a/plugins/CoreUpdater/templates/update_welcome.tpl b/plugins/CoreUpdater/templates/update_welcome.tpl
index f6c1b712e9..434b8ad99c 100644
--- a/plugins/CoreUpdater/templates/update_welcome.tpl
+++ b/plugins/CoreUpdater/templates/update_welcome.tpl
@@ -28,6 +28,12 @@
{/if}
<h3 id='titleUpdate'>{'CoreUpdater_NoteForLargePiwikInstances'|translate}</h3>
+ {if $isMajor}
+ <p class="warning normalFontSize">
+ {'CoreUpdater_MajorUpdateWarning1'|translate}<br />
+ {'CoreUpdater_MajorUpdateWarning2'|translate}
+ </p>
+ {/if}
<ul>
<li>{'CoreUpdater_TheUpgradeProcessMayFailExecuteCommand'|translate:$commandUpgradePiwik}</li>
<li>It is also recommended for high traffic Piwik servers to <a target='_blank' href='?module=Proxy&action=redirect&url={"http://piwik.org/faq/how-to/#faq_111"|escape:"url"}'>momentarily disable visitor Tracking and put the Piwik User Interface in maintenance mode</a>.</li>
diff --git a/themes/default/simple_structure.css b/themes/default/simple_structure.css
index 1c728665c7..7d0da3c777 100644
--- a/themes/default/simple_structure.css
+++ b/themes/default/simple_structure.css
@@ -93,3 +93,7 @@ a { color: #006; }
-webkit-border-radius:4px;
padding:15px;
}
+.warning.normalFontSize {
+ font-size: 100%;
+ padding: 10px;
+} \ No newline at end of file