mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-28 18:40:39 +00:00
only check if config is writeable if a change is required
This commit is contained in:
parent
32351d6179
commit
ac7128b8d3
|
|
@ -55,7 +55,7 @@ class ConfigureextensionCommand extends Command
|
|||
|
||||
$output->writeln("<comment>Using configuration from '".$settings->_configFilePath."'.</comment>", OutputInterface::VERBOSITY_VERBOSE);
|
||||
|
||||
if (!is_writable($settings->_configFilePath)) {
|
||||
if (($input->getOption('enable') || $input->getOption('disable')) && !is_writable($settings->_configFilePath)) {
|
||||
$output->writeln(sprintf("<error>The configuration file '%s' is not writable by the system user running this script.</error>", $settings->_configFilePath));
|
||||
return Command::FAILURE;
|
||||
}
|
||||
|
|
@ -69,23 +69,31 @@ class ConfigureextensionCommand extends Command
|
|||
if ($input->getOption('enable')) {
|
||||
if ($settings->extensionIsDisabled($extname)) {
|
||||
$settings->enableExtension($extname);
|
||||
if (false === $settings->save()) {
|
||||
$output->writeln(sprintf("<error>Could not write configuration.</error>", $extname));
|
||||
return Command::FAILURE;
|
||||
} else {
|
||||
$output->writeln(sprintf("<info>Extension already enabled.</info>"));
|
||||
return Command::SUCCESS;
|
||||
$output->writeln(sprintf("Extension is %s.", $settings->extensionIsDisabled($extname) ? 'disabled' : 'enabled'));
|
||||
}
|
||||
} else {
|
||||
$output->writeln(sprintf("Extension already enabled."));
|
||||
}
|
||||
} elseif ($input->getOption('disable')) {
|
||||
if (!$settings->extensionIsDisabled($extname)) {
|
||||
$settings->disableExtension($extname);
|
||||
if (false === $settings->save()) {
|
||||
$output->writeln(sprintf("<error>Could not write configuration.</error>", $extname));
|
||||
return Command::FAILURE;
|
||||
} else {
|
||||
$output->writeln(sprintf("<info>Extension already disabled.</info>"));
|
||||
return Command::SUCCESS;
|
||||
$output->writeln(sprintf("Extension is %s.", $settings->extensionIsDisabled($extname) ? 'disabled' : 'enabled'));
|
||||
}
|
||||
} else {
|
||||
$output->writeln(sprintf("<error>Missing option --enable or --disable</error>"));
|
||||
return Command::FAILURE;
|
||||
$output->writeln(sprintf("Extension already disabled."));
|
||||
}
|
||||
} else {
|
||||
$output->writeln(sprintf("Extension is %s.", $settings->extensionIsDisabled($extname) ? 'disabled' : 'enabled'));
|
||||
}
|
||||
|
||||
$settings->save();
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user