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:
authordiosmosis <diosmosis@users.noreply.github.com>2019-02-11 02:12:20 +0300
committerGitHub <noreply@github.com>2019-02-11 02:12:20 +0300
commitc67317737aa08f1b5b3d626b4a3aeb8b626dbfde (patch)
treec9abdaabb86f7dd176675a7c0204335f4ec9af1f /plugins/CoreUpdater
parentf768274396fba6aaaa7862a16787b702d01cb40a (diff)
Include non-sql migrations in update dry run output. (#14003)
* Include non-sql migrations in update dry run output. * More translation updates. * Make check for by domain Matomo more robust. * Show migrations in separate boxes based on whether they are SQL or console commands. * Update two screenshots and fix test.
Diffstat (limited to 'plugins/CoreUpdater')
-rw-r--r--plugins/CoreUpdater/Controller.php31
-rw-r--r--plugins/CoreUpdater/javascripts/updateLayout.js2
-rw-r--r--plugins/CoreUpdater/lang/en.json8
-rw-r--r--plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig11
-rw-r--r--plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main.png4
-rw-r--r--plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main_instance.png4
6 files changed, 47 insertions, 13 deletions
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php
index db9739e319..c2f50285f1 100644
--- a/plugins/CoreUpdater/Controller.php
+++ b/plugins/CoreUpdater/Controller.php
@@ -29,6 +29,7 @@ use Piwik\Updater as DbUpdater;
use Piwik\Version;
use Piwik\View;
use Piwik\View\OneClickDone;
+use Piwik\Updater\Migration\Db as DbMigration;
class Controller extends \Piwik\Plugin\Controller
{
@@ -255,7 +256,12 @@ class Controller extends \Piwik\Plugin\Controller
}
if ($doDryRun) {
- $viewWelcome->queries = $updater->getSqlQueriesToExecute();
+ $migrations = $updater->getSqlQueriesToExecute();
+ $queryCount = count($migrations);
+
+ $migrations = $this->groupMigrations($migrations);
+ $viewWelcome->migrations = $migrations;
+ $viewWelcome->queryCount = $queryCount;
$viewWelcome->isMajor = $updater->hasMajorDbUpdate();
$this->doWelcomeUpdates($viewWelcome, $componentsWithUpdateFile);
return $viewWelcome->render();
@@ -274,6 +280,29 @@ class Controller extends \Piwik\Plugin\Controller
exit;
}
+ private function groupMigrations($migrations)
+ {
+ $result = [];
+
+ $group = null;
+ foreach ($migrations as $migration) {
+ $type = $migration instanceof DbMigration ? 'sql' : 'command';
+ if ($group === null
+ || $type != $group['type']
+ ) {
+ $group = [
+ 'type' => $type,
+ 'migrations' => [],
+ ];
+ $result[] = $group;
+ }
+
+ $result[count($result) - 1]['migrations'][] = $migration;
+ }
+
+ return $result;
+ }
+
private function doWelcomeUpdates($view, $componentsWithUpdateFile)
{
$view->new_piwik_version = Version::VERSION;
diff --git a/plugins/CoreUpdater/javascripts/updateLayout.js b/plugins/CoreUpdater/javascripts/updateLayout.js
index bffd8181f7..2947970afe 100644
--- a/plugins/CoreUpdater/javascripts/updateLayout.js
+++ b/plugins/CoreUpdater/javascripts/updateLayout.js
@@ -1,7 +1,7 @@
$(document).ready(function () {
$('#showSql').click(function (e) {
e.preventDefault();
- $('#sqlQueries').toggle();
+ $('.sqlQueries').toggle();
});
$('#upgradeCorePluginsForm').submit(function () {
$('input[type=submit]', this)
diff --git a/plugins/CoreUpdater/lang/en.json b/plugins/CoreUpdater/lang/en.json
index ca642d15db..1fc8cb454e 100644
--- a/plugins/CoreUpdater/lang/en.json
+++ b/plugins/CoreUpdater/lang/en.json
@@ -1,7 +1,7 @@
{
"CoreUpdater": {
"CheckingForPluginUpdates": "Checking for new plugin updates",
- "ClickHereToViewSqlQueries": "Click here to view and copy the list of SQL queries that will get executed",
+ "ClickHereToViewSqlQueries": "Click here to view and copy the list of SQL queries and console commands that will get executed",
"CriticalErrorDuringTheUpgradeProcess": "Critical Error during the update process:",
"DatabaseUpgradeRequired": "Database Upgrade Required",
"DisablingIncompatiblePlugins": "Disabling incompatible plugins: %s",
@@ -31,7 +31,9 @@
"Latest2XStableRelease": "Latest stable 2.X",
"Latest2XBetaRelease": "Latest beta 2.X",
"LtsSupportVersion": "Long Term Support version",
- "ListOfSqlQueriesFYI": "FYI: these are the SQL queries that will be executed to upgrade your database to Matomo %s",
+ "ListOfSqlQueriesFYI": "FYI: these are the SQL queries and console commands that will be executed to upgrade your database to Matomo %s",
+ "TheseSqlQueriesWillBeExecuted": "These SQL queries will be executed:",
+ "TheseCommandsWillBeExecuted": "These console commands will be run:",
"MajorUpdateWarning1": "This is a major update! It will take longer than usual.",
"MajorUpdateWarning2": "The following advice is especially important for large installations.",
"NeedHelpUpgrading": "Need help upgrading Matomo?",
@@ -75,7 +77,7 @@
"DbUpgradeNotExecuted": "Database upgrade not executed.",
"ConsoleUpdateUnexpectedUserWarning": "It appears you have executed this update with user %1$s, while your Matomo files are owned by %2$s. \n\nTo ensure that the Matomo files are readable by the correct user, you may need to run the following command (or a similar command depending on your server configuration):\n\n$ %3$s",
"ConsoleUpdateFailure": "Matomo could not be updated! See above for more information.",
- "ConsoleUpdateNoSqlQueries": "Note: There are no SQL queries to execute.",
+ "ConsoleUpdateNoSqlQueries": "Note: There are no SQL queries or console commands to execute.",
"AlreadyUpToDate": "Everything is already up to date.",
"ExecuteDbUpgrade": "A database upgrade is required. Execute update?",
"DryRun": "Note: this is a Dry Run",
diff --git a/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig b/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig
index 041dacccb7..a855fd6952 100644
--- a/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig
+++ b/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig
@@ -53,11 +53,14 @@
<pre>{{ commandUpgradePiwik }}</pre>
<p>{{ 'CoreUpdater_HighTrafficPiwikServerEnableMaintenance'|translate('<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/faq/how-to/#faq_111">', '</a>')|raw }}</p>
- {% if queries is not empty %}
+ {% if migrations is not empty %}
+ <p>{{ 'CoreUpdater_ListOfSqlQueriesFYI'|translate(piwik_version) }}</p>
<p><a href="#" id="showSql">› {{ 'CoreUpdater_ClickHereToViewSqlQueries'|translate }}</a></p>
- <div id="sqlQueries" style="display:none;">
- <pre># {{ 'CoreUpdater_ListOfSqlQueriesFYI'|translate(piwik_version) }}<br/>{% for query in queries %}{{ query }}<br/>{% endfor %}</pre>
+ {% for group in migrations %}
+ <div class="sqlQueries" style="display:none;">
+ <pre># {% if group.type == 'sql' %}{{ 'CoreUpdater_TheseSqlQueriesWillBeExecuted'|translate }}{% else %}{{ 'CoreUpdater_TheseCommandsWillBeExecuted'|translate }}{% endif %} <br/>{% for migration in group.migrations %}{{ migration }}<br/>{% endfor %}</pre>
</div>
+ {% endfor %}
{% endif %}
<h2>{{ 'CoreUpdater_NeedHelpUpgrading'|translate }}</h2>
@@ -79,7 +82,7 @@
{% if coreToUpdate or pluginNamesToUpdate|length > 0 or dimensionsToUpdate|length > 0 %}
<form action="index.php" id="upgradeCorePluginsForm" class="clearfix" data-updating="{{ 'CoreUpdater_Updating'|translate }}...">
<input type="hidden" name="updateCorePlugins" value="1"/>
- {% if queries|length == 1 %}
+ {% if queryCount == 1 %}
<input type="submit" class="btn right" value="{{ 'General_ContinueToPiwik'|translate }}"/>
{% else %}
<input type="submit" class="btn right" value="{{ 'CoreUpdater_UpgradePiwik'|translate }}"/>
diff --git a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main.png b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main.png
index 64a8a076a1..0806c0cb64 100644
--- a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main.png
+++ b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:89a13a7a03740edbef58a8d6d41e28a1e1a62a38637b2b72d53f096a1ec6522b
-size 292252
+oid sha256:c6d782438f1fb12fcc1e4ab18ae71eb431172faac14c3232d9133758952f1ae7
+size 306036
diff --git a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main_instance.png b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main_instance.png
index 89562308f8..da8551d607 100644
--- a/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main_instance.png
+++ b/plugins/CoreUpdater/tests/UI/expected-screenshots/CoreUpdaterDb_main_instance.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:2693bb08a4624b6e930a8c045886a586d43a1c89cbb9e804fe01f022d0e4c6d5
-size 294156
+oid sha256:600c26506ce387821e8df5aa82532aedd0fc43957389879d03d27bac3a25b63b
+size 307931