cli/setup: Issue nice error messages when creating the config directory fails

This commit is contained in:
Eric Lippmann 2014-12-30 16:03:05 +01:00
parent 865b5c126a
commit 9f545535a0
1 changed files with 19 additions and 10 deletions

View File

@ -55,22 +55,31 @@ class ConfigCommand extends Command
));
}
if (! mkdir($configDir)) {
$this->fail(sprintf($this->translate('Can\'t create configuration directory %s'), $configDir));
}
if (! chmod($configDir, octdec($mode))) {
if (! file_exists($configDir) && ! @mkdir($configDir)) {
$e = error_get_last();
$this->fail(sprintf(
$this->translate('Can\'t change the mode of the configuration directory to %s'),
$mode
$this->translate('Can\'t create configuration directory %s: %s'),
$configDir,
$e['message']
));
}
if (! chgrp($configDir, $group)) {
if (! @chmod($configDir, octdec($mode))) {
$e = error_get_last();
$this->fail(sprintf(
$this->translate('Can\'t change the to change the group of %s to %s'),
$this->translate('Can\'t change the mode of the configuration directory to %s: %s'),
$mode,
$e['message']
));
}
if (! @chgrp($configDir, $group)) {
$e = error_get_last();
$this->fail(sprintf(
$this->translate('Can\'t change the group of %s to %s: %s'),
$configDir,
$group
$group,
$e['message']
));
}