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:
authorMatthieu Aubry <mattab@users.noreply.github.com>2016-08-28 09:35:27 +0300
committerGitHub <noreply@github.com>2016-08-28 09:35:27 +0300
commit3fcead8b2bc7d6a2e26d7f1101861ea44d563aef (patch)
tree6dbe355484fd26dee5523c71fe5ae5e6f834d88d /core/Filechecks.php
parent77a6412ff7a8bdb2f23fb00a2d8ce22e7a35fcee (diff)
Fixes #10143 (#10424)2.16.3-b2
Diffstat (limited to 'core/Filechecks.php')
-rw-r--r--core/Filechecks.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/core/Filechecks.php b/core/Filechecks.php
index 274453e96d..ee29adad7e 100644
--- a/core/Filechecks.php
+++ b/core/Filechecks.php
@@ -174,7 +174,7 @@ class Filechecks
{
$realpath = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/');
$message = '';
- $message .= "<code>chown -R ". self::getUserAndGroup() ." " . $realpath . "</code><br />";
+ $message .= "<code>" . self::getCommandToChangeOwnerOfPiwikFiles() . "</code><br />";
$message .= "<code>chmod -R 0755 " . $realpath . "</code><br />";
$message .= 'After you execute these commands (or change permissions via your FTP software), refresh the page and you should be able to use the "Automatic Update" feature.';
return $message;
@@ -247,4 +247,30 @@ class Filechecks
}
return "<code>chmod -R 0755 $realpath</code><br />";
}
+
+ /**
+ * @return string
+ */
+ public static function getCommandToChangeOwnerOfPiwikFiles()
+ {
+ $realpath = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/');
+ return "chown -R " . self::getUserAndGroup() . " " . $realpath;
+ }
+
+ public static function getOwnerOfPiwikFiles()
+ {
+ $index = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/index.php');
+ $stat = stat($index);
+ if(!$stat) {
+ return '';
+ }
+
+ $group = posix_getgrgid($stat[5]);
+ $group = $group['name'];
+
+ $user = posix_getpwuid($stat[4]);
+ $user = $user['name'];
+
+ return "$user:$group";
+ }
}