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:
Diffstat (limited to 'plugins/CoreUpdater/Commands/Update.php')
-rw-r--r--plugins/CoreUpdater/Commands/Update.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/CoreUpdater/Commands/Update.php b/plugins/CoreUpdater/Commands/Update.php
index 4b4d79e287..14865b6c33 100644
--- a/plugins/CoreUpdater/Commands/Update.php
+++ b/plugins/CoreUpdater/Commands/Update.php
@@ -8,6 +8,8 @@
*/
namespace Piwik\Plugins\CoreUpdater\Commands;
+use Piwik\Filechecks;
+use Piwik\SettingsServer;
use Piwik\Version;
use Piwik\Config;
use Piwik\DbHelper;
@@ -68,6 +70,9 @@ class Update extends ConsoleCommand
$this->writeSuccessMessage($output, array('Database upgrade not executed.'));
}
+ $this->writeAlertMessageWhenCommandExecutedWithUnexpectedUser($output);
+
+
} catch(NoUpdatesFoundException $e) {
// Do not fail if no updates were found
$this->writeSuccessMessage($output, array($e->getMessage()));
@@ -153,6 +158,11 @@ class Update extends ConsoleCommand
{
$migrationQueries = $this->getMigrationQueriesToExecute($updater);
+ if(empty($migrationQueries)) {
+ $output->writeln(array(" *** Note: There are no SQL queries to execute. ***", ""));
+ return;
+ }
+
$output->writeln(array(" *** Note: this is a Dry Run ***", ""));
foreach ($migrationQueries as $query) {
@@ -334,4 +344,31 @@ class Update extends ConsoleCommand
return $updater;
}
+
+ /**
+ * @param OutputInterface $output
+ */
+ protected function writeAlertMessageWhenCommandExecutedWithUnexpectedUser(OutputInterface $output)
+ {
+ if(SettingsServer::isWindows()) {
+ // does not work on windows
+ return;
+ }
+
+ $processUserAndGroup = Filechecks::getUserAndGroup();
+ $fileOwnerUserAndGroup = Filechecks::getOwnerOfPiwikFiles();
+
+ if($processUserAndGroup == $fileOwnerUserAndGroup) {
+ // current process user/group appear to be same as the Piwik filesystem user/group -> OK
+ return;
+ }
+ $output->writeln(
+
+ sprintf("<comment>It appears you have executed this update with user %s, while your Piwik files are owned by %s. \n\nTo ensure that the Piwik 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$ %s</comment>",
+ $processUserAndGroup,
+ $fileOwnerUserAndGroup,
+ Filechecks::getCommandToChangeOwnerOfPiwikFiles()
+ )
+ );
+ }
}