Raise a warning if current user and owner of deploy dir doesn't match
parent
6717cf1956
commit
dbea825871
|
@ -93,7 +93,9 @@ EOT
|
||||||
$cacheDir = $config->get('cache-dir');
|
$cacheDir = $config->get('cache-dir');
|
||||||
$rollbackDir = $config->get('data-dir');
|
$rollbackDir = $config->get('data-dir');
|
||||||
$home = $config->get('home');
|
$home = $config->get('home');
|
||||||
|
$homeOwner = posix_getpwuid(fileowner($home));
|
||||||
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
|
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
|
||||||
|
$composeUser = posix_getpwuid(posix_geteuid());
|
||||||
|
|
||||||
if ($input->getOption('update-keys')) {
|
if ($input->getOption('update-keys')) {
|
||||||
return $this->fetchKeys($io, $config);
|
return $this->fetchKeys($io, $config);
|
||||||
|
@ -107,6 +109,11 @@ EOT
|
||||||
throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
|
throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if composer is running as the same user that owns the directory root
|
||||||
|
if ($composeUser !== $homeOwner) {
|
||||||
|
$io->writeError('<warning>You are running composer as "'.$composeUser.'", while "'.$home.'" is owned by "'.$homeOwner.'"</warning>');
|
||||||
|
}
|
||||||
|
|
||||||
if ($input->getOption('rollback')) {
|
if ($input->getOption('rollback')) {
|
||||||
return $this->rollback($output, $rollbackDir, $localFilename);
|
return $this->rollback($output, $rollbackDir, $localFilename);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue