Skip to content
Extraits de code Groupes Projets
Valider a27fa815 rédigé par Thomas Steur's avatar Thomas Steur Validation de Matthieu Aubry
Parcourir les fichiers

fix a posix function was called that may not exist on the server (#10825)

parent 04ae85b1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -310,11 +310,19 @@ class Filechecks ...@@ -310,11 +310,19 @@ class Filechecks
return ''; return '';
} }
$group = posix_getgrgid($stat[5]); if (function_exists('posix_getgrgid')) {
$group = $group['name']; $group = posix_getgrgid($stat[5]);
$group = $group['name'];
} else {
return '';
}
$user = posix_getpwuid($stat[4]); if (function_exists('posix_getpwuid')) {
$user = $user['name']; $user = posix_getpwuid($stat[4]);
$user = $user['name'];
} else {
return '';
}
return "$user:$group"; return "$user:$group";
} }
......
...@@ -358,7 +358,7 @@ class Update extends ConsoleCommand ...@@ -358,7 +358,7 @@ class Update extends ConsoleCommand
*/ */
protected function writeAlertMessageWhenCommandExecutedWithUnexpectedUser(OutputInterface $output) protected function writeAlertMessageWhenCommandExecutedWithUnexpectedUser(OutputInterface $output)
{ {
if(SettingsServer::isWindows()) { if (SettingsServer::isWindows()) {
// does not work on windows // does not work on windows
return; return;
} }
...@@ -366,12 +366,11 @@ class Update extends ConsoleCommand ...@@ -366,12 +366,11 @@ class Update extends ConsoleCommand
$processUserAndGroup = Filechecks::getUserAndGroup(); $processUserAndGroup = Filechecks::getUserAndGroup();
$fileOwnerUserAndGroup = Filechecks::getOwnerOfPiwikFiles(); $fileOwnerUserAndGroup = Filechecks::getOwnerOfPiwikFiles();
if($processUserAndGroup == $fileOwnerUserAndGroup) { if (!$fileOwnerUserAndGroup || $processUserAndGroup == $fileOwnerUserAndGroup) {
// current process user/group appear to be same as the Piwik filesystem user/group -> OK // current process user/group appear to be same as the Piwik filesystem user/group -> OK
return; return;
} }
$output->writeln( $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>", 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, $processUserAndGroup,
$fileOwnerUserAndGroup, $fileOwnerUserAndGroup,
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter