From a30d35bf092340f511ac146a47c3a9f30891f82c Mon Sep 17 00:00:00 2001
From: Matthieu Aubry <mattab@users.noreply.github.com>
Date: Thu, 1 Dec 2016 09:49:59 +1300
Subject: [PATCH] Simplify update page and fix wording (#10864)

* Simplify update page and fix wording
fixes  #10720

* Translate the string
---
 plugins/CoreUpdater/lang/en.json                     |  3 +--
 .../templates/runUpdaterAndExit_welcome.twig         | 12 +++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/plugins/CoreUpdater/lang/en.json b/plugins/CoreUpdater/lang/en.json
index ad6d230ce9..531481230a 100644
--- a/plugins/CoreUpdater/lang/en.json
+++ b/plugins/CoreUpdater/lang/en.json
@@ -31,10 +31,10 @@
         "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 Piwik %s",
         "MajorUpdateWarning1": "This is a major update! It will take longer than usual.",
         "MajorUpdateWarning2": "The following advice is especially important for large installations.",
         "NoteForLargePiwikInstances": "Important notes for large Piwik installations",
-        "NoteItIsExpectedThatQueriesFail": "Note: if you manually execute these queries, it is expected that some of them fail. In this case, simply ignore the errors, and run the next ones in the list.",
         "NotificationClickToUpdatePlugins": "Click here to update your plugins now:",
         "NotificationClickToUpdateThemes": "Click here to update your themes now:",
         "NotificationSubjectAvailableCoreUpdate": "New Piwik %s is available",
@@ -73,7 +73,6 @@
         "WarningMessages": "Warning messages:",
         "WeAutomaticallyDeactivatedTheFollowingPlugins": "We automatically deactivated the following plugins: %s",
         "YouCanUpgradeAutomaticallyOrDownloadPackage": "You can update to version %s automatically or download the package and install it manually:",
-        "YouCouldManuallyExecuteSqlQueries": "If you are not able to use the command line updater and if Piwik fails to upgrade (due to a timeout of the database, a browser timeout, or any other issue), you could manually execute the SQL queries to update Piwik.",
         "YouMustDownloadPackageOrFixPermissions": "Piwik is unable to overwrite your current installation. You can either fix the directory\/file permissions, or download the package and install version %s manually:",
         "YourDatabaseIsOutOfDate": "Your Piwik database is out-of-date, and must be upgraded before you can continue.",
         "ViewVersionChangelog": "View the changelog for this version:"
diff --git a/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig b/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig
index 168524487b..e5899117ce 100644
--- a/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig
+++ b/plugins/CoreUpdater/templates/runUpdaterAndExit_welcome.twig
@@ -52,11 +52,13 @@
                 <p>{{ 'CoreUpdater_TheUpgradeProcessMayFailExecuteCommand'|translate('') }}</p>
                 <pre>{{ commandUpgradePiwik }}</pre>
                 <p>{{ '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 }}</p>
-                <p>{{ 'CoreUpdater_YouCouldManuallyExecuteSqlQueries'|translate }}</p>
-                <p><a href="#" id="showSql">› {{ 'CoreUpdater_ClickHereToViewSqlQueries'|translate }}</a></p>
-                <div id="sqlQueries" style="display:none;">
-                    <pre># {{ 'CoreUpdater_NoteItIsExpectedThatQueriesFail'|translate }}<br/>{% for query in queries %}{{ query }}<br/>{% endfor %}</pre>
-                </div>
+
+                {% if queries is not empty %}
+                    <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>
+                    </div>
+                {% endif %}
 
                 <h2>{{ 'CoreUpdater_ReadyToGo'|translate }}</h2>
                 <p>{{ 'CoreUpdater_TheUpgradeProcessMayTakeAWhilePleaseBePatient'|translate }}</p>
-- 
GitLab