@@ -26,53 +26,53 @@ |
||
26 | 26 | |
27 | 27 | abstract class Base extends \OC\Core\Command\Base { |
28 | 28 | |
29 | - /** @var SystemConfig */ |
|
30 | - protected $systemConfig; |
|
29 | + /** @var SystemConfig */ |
|
30 | + protected $systemConfig; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param string $argumentName |
|
34 | - * @param CompletionContext $context |
|
35 | - * @return string[] |
|
36 | - */ |
|
37 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
38 | - if ($argumentName === 'name') { |
|
39 | - $words = $this->getPreviousNames($context, $context->getWordIndex()); |
|
40 | - if (empty($words)) { |
|
41 | - $completions = $this->systemConfig->getKeys(); |
|
42 | - } else { |
|
43 | - $key = array_shift($words); |
|
44 | - $value = $this->systemConfig->getValue($key); |
|
45 | - $completions = array_keys($value); |
|
32 | + /** |
|
33 | + * @param string $argumentName |
|
34 | + * @param CompletionContext $context |
|
35 | + * @return string[] |
|
36 | + */ |
|
37 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
38 | + if ($argumentName === 'name') { |
|
39 | + $words = $this->getPreviousNames($context, $context->getWordIndex()); |
|
40 | + if (empty($words)) { |
|
41 | + $completions = $this->systemConfig->getKeys(); |
|
42 | + } else { |
|
43 | + $key = array_shift($words); |
|
44 | + $value = $this->systemConfig->getValue($key); |
|
45 | + $completions = array_keys($value); |
|
46 | 46 | |
47 | - while (!empty($words) && is_array($value)) { |
|
48 | - $key = array_shift($words); |
|
49 | - if (!isset($value[$key]) || !is_array($value[$key])) { |
|
50 | - break; |
|
51 | - } |
|
47 | + while (!empty($words) && is_array($value)) { |
|
48 | + $key = array_shift($words); |
|
49 | + if (!isset($value[$key]) || !is_array($value[$key])) { |
|
50 | + break; |
|
51 | + } |
|
52 | 52 | |
53 | - $value = $value[$key]; |
|
54 | - $completions = array_keys($value); |
|
55 | - } |
|
56 | - } |
|
53 | + $value = $value[$key]; |
|
54 | + $completions = array_keys($value); |
|
55 | + } |
|
56 | + } |
|
57 | 57 | |
58 | - return $completions; |
|
59 | - } |
|
60 | - return parent::completeArgumentValues($argumentName, $context); |
|
61 | - } |
|
58 | + return $completions; |
|
59 | + } |
|
60 | + return parent::completeArgumentValues($argumentName, $context); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @param CompletionContext $context |
|
65 | - * @param int $currentIndex |
|
66 | - * @return string[] |
|
67 | - */ |
|
68 | - protected function getPreviousNames(CompletionContext $context, $currentIndex) { |
|
69 | - $word = $context->getWordAtIndex($currentIndex - 1); |
|
70 | - if ($word === $this->getName() || $currentIndex <= 0) { |
|
71 | - return []; |
|
72 | - } |
|
63 | + /** |
|
64 | + * @param CompletionContext $context |
|
65 | + * @param int $currentIndex |
|
66 | + * @return string[] |
|
67 | + */ |
|
68 | + protected function getPreviousNames(CompletionContext $context, $currentIndex) { |
|
69 | + $word = $context->getWordAtIndex($currentIndex - 1); |
|
70 | + if ($word === $this->getName() || $currentIndex <= 0) { |
|
71 | + return []; |
|
72 | + } |
|
73 | 73 | |
74 | - $words = $this->getPreviousNames($context, $currentIndex - 1); |
|
75 | - $words[] = $word; |
|
76 | - return $words; |
|
77 | - } |
|
74 | + $words = $this->getPreviousNames($context, $currentIndex - 1); |
|
75 | + $words[] = $word; |
|
76 | + return $words; |
|
77 | + } |
|
78 | 78 | } |
@@ -29,72 +29,72 @@ |
||
29 | 29 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 30 | |
31 | 31 | class GetConfig extends Base { |
32 | - /** * @var SystemConfig */ |
|
33 | - protected $systemConfig; |
|
32 | + /** * @var SystemConfig */ |
|
33 | + protected $systemConfig; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param SystemConfig $systemConfig |
|
37 | - */ |
|
38 | - public function __construct(SystemConfig $systemConfig) { |
|
39 | - parent::__construct(); |
|
40 | - $this->systemConfig = $systemConfig; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param SystemConfig $systemConfig |
|
37 | + */ |
|
38 | + public function __construct(SystemConfig $systemConfig) { |
|
39 | + parent::__construct(); |
|
40 | + $this->systemConfig = $systemConfig; |
|
41 | + } |
|
42 | 42 | |
43 | - protected function configure() { |
|
44 | - parent::configure(); |
|
43 | + protected function configure() { |
|
44 | + parent::configure(); |
|
45 | 45 | |
46 | - $this |
|
47 | - ->setName('config:system:get') |
|
48 | - ->setDescription('Get a system config value') |
|
49 | - ->addArgument( |
|
50 | - 'name', |
|
51 | - InputArgument::REQUIRED | InputArgument::IS_ARRAY, |
|
52 | - 'Name of the config to get, specify multiple for array parameter' |
|
53 | - ) |
|
54 | - ->addOption( |
|
55 | - 'default-value', |
|
56 | - null, |
|
57 | - InputOption::VALUE_OPTIONAL, |
|
58 | - 'If no default value is set and the config does not exist, the command will exit with 1' |
|
59 | - ) |
|
60 | - ; |
|
61 | - } |
|
46 | + $this |
|
47 | + ->setName('config:system:get') |
|
48 | + ->setDescription('Get a system config value') |
|
49 | + ->addArgument( |
|
50 | + 'name', |
|
51 | + InputArgument::REQUIRED | InputArgument::IS_ARRAY, |
|
52 | + 'Name of the config to get, specify multiple for array parameter' |
|
53 | + ) |
|
54 | + ->addOption( |
|
55 | + 'default-value', |
|
56 | + null, |
|
57 | + InputOption::VALUE_OPTIONAL, |
|
58 | + 'If no default value is set and the config does not exist, the command will exit with 1' |
|
59 | + ) |
|
60 | + ; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Executes the current command. |
|
65 | - * |
|
66 | - * @param InputInterface $input An InputInterface instance |
|
67 | - * @param OutputInterface $output An OutputInterface instance |
|
68 | - * @return null|int null or 0 if everything went fine, or an error code |
|
69 | - */ |
|
70 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
71 | - $configNames = $input->getArgument('name'); |
|
72 | - $configName = array_shift($configNames); |
|
73 | - $defaultValue = $input->getOption('default-value'); |
|
63 | + /** |
|
64 | + * Executes the current command. |
|
65 | + * |
|
66 | + * @param InputInterface $input An InputInterface instance |
|
67 | + * @param OutputInterface $output An OutputInterface instance |
|
68 | + * @return null|int null or 0 if everything went fine, or an error code |
|
69 | + */ |
|
70 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
71 | + $configNames = $input->getArgument('name'); |
|
72 | + $configName = array_shift($configNames); |
|
73 | + $defaultValue = $input->getOption('default-value'); |
|
74 | 74 | |
75 | - if (!in_array($configName, $this->systemConfig->getKeys()) && !$input->hasParameterOption('--default-value')) { |
|
76 | - return 1; |
|
77 | - } |
|
75 | + if (!in_array($configName, $this->systemConfig->getKeys()) && !$input->hasParameterOption('--default-value')) { |
|
76 | + return 1; |
|
77 | + } |
|
78 | 78 | |
79 | - if (!in_array($configName, $this->systemConfig->getKeys())) { |
|
80 | - $configValue = $defaultValue; |
|
81 | - } else { |
|
82 | - $configValue = $this->systemConfig->getValue($configName); |
|
83 | - if (!empty($configNames)) { |
|
84 | - foreach ($configNames as $configName) { |
|
85 | - if (isset($configValue[$configName])) { |
|
86 | - $configValue = $configValue[$configName]; |
|
87 | - } else if (!$input->hasParameterOption('--default-value')) { |
|
88 | - return 1; |
|
89 | - } else { |
|
90 | - $configValue = $defaultValue; |
|
91 | - break; |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
95 | - } |
|
79 | + if (!in_array($configName, $this->systemConfig->getKeys())) { |
|
80 | + $configValue = $defaultValue; |
|
81 | + } else { |
|
82 | + $configValue = $this->systemConfig->getValue($configName); |
|
83 | + if (!empty($configNames)) { |
|
84 | + foreach ($configNames as $configName) { |
|
85 | + if (isset($configValue[$configName])) { |
|
86 | + $configValue = $configValue[$configName]; |
|
87 | + } else if (!$input->hasParameterOption('--default-value')) { |
|
88 | + return 1; |
|
89 | + } else { |
|
90 | + $configValue = $defaultValue; |
|
91 | + break; |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | + } |
|
96 | 96 | |
97 | - $this->writeMixedInOutputFormat($input, $output, $configValue); |
|
98 | - return 0; |
|
99 | - } |
|
97 | + $this->writeMixedInOutputFormat($input, $output, $configValue); |
|
98 | + return 0; |
|
99 | + } |
|
100 | 100 | } |
@@ -29,53 +29,53 @@ |
||
29 | 29 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 30 | |
31 | 31 | class DeleteConfig extends Base { |
32 | - /** * @var IConfig */ |
|
33 | - protected $config; |
|
32 | + /** * @var IConfig */ |
|
33 | + protected $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param IConfig $config |
|
37 | - */ |
|
38 | - public function __construct(IConfig $config) { |
|
39 | - parent::__construct(); |
|
40 | - $this->config = $config; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param IConfig $config |
|
37 | + */ |
|
38 | + public function __construct(IConfig $config) { |
|
39 | + parent::__construct(); |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | 42 | |
43 | - protected function configure() { |
|
44 | - parent::configure(); |
|
43 | + protected function configure() { |
|
44 | + parent::configure(); |
|
45 | 45 | |
46 | - $this |
|
47 | - ->setName('config:app:delete') |
|
48 | - ->setDescription('Delete an app config value') |
|
49 | - ->addArgument( |
|
50 | - 'app', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'Name of the app' |
|
53 | - ) |
|
54 | - ->addArgument( |
|
55 | - 'name', |
|
56 | - InputArgument::REQUIRED, |
|
57 | - 'Name of the config to delete' |
|
58 | - ) |
|
59 | - ->addOption( |
|
60 | - 'error-if-not-exists', |
|
61 | - null, |
|
62 | - InputOption::VALUE_NONE, |
|
63 | - 'Checks whether the config exists before deleting it' |
|
64 | - ) |
|
65 | - ; |
|
66 | - } |
|
46 | + $this |
|
47 | + ->setName('config:app:delete') |
|
48 | + ->setDescription('Delete an app config value') |
|
49 | + ->addArgument( |
|
50 | + 'app', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'Name of the app' |
|
53 | + ) |
|
54 | + ->addArgument( |
|
55 | + 'name', |
|
56 | + InputArgument::REQUIRED, |
|
57 | + 'Name of the config to delete' |
|
58 | + ) |
|
59 | + ->addOption( |
|
60 | + 'error-if-not-exists', |
|
61 | + null, |
|
62 | + InputOption::VALUE_NONE, |
|
63 | + 'Checks whether the config exists before deleting it' |
|
64 | + ) |
|
65 | + ; |
|
66 | + } |
|
67 | 67 | |
68 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
69 | - $appName = $input->getArgument('app'); |
|
70 | - $configName = $input->getArgument('name'); |
|
68 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
69 | + $appName = $input->getArgument('app'); |
|
70 | + $configName = $input->getArgument('name'); |
|
71 | 71 | |
72 | - if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->config->getAppKeys($appName))) { |
|
73 | - $output->writeln('<error>Config ' . $configName . ' of app ' . $appName . ' could not be deleted because it did not exist</error>'); |
|
74 | - return 1; |
|
75 | - } |
|
72 | + if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->config->getAppKeys($appName))) { |
|
73 | + $output->writeln('<error>Config ' . $configName . ' of app ' . $appName . ' could not be deleted because it did not exist</error>'); |
|
74 | + return 1; |
|
75 | + } |
|
76 | 76 | |
77 | - $this->config->deleteAppValue($appName, $configName); |
|
78 | - $output->writeln('<info>Config value ' . $configName . ' of app ' . $appName . ' deleted</info>'); |
|
79 | - return 0; |
|
80 | - } |
|
77 | + $this->config->deleteAppValue($appName, $configName); |
|
78 | + $output->writeln('<info>Config value ' . $configName . ' of app ' . $appName . ' deleted</info>'); |
|
79 | + return 0; |
|
80 | + } |
|
81 | 81 | } |
@@ -26,23 +26,23 @@ |
||
26 | 26 | |
27 | 27 | abstract class Base extends \OC\Core\Command\Base { |
28 | 28 | |
29 | - /** * @var IConfig */ |
|
30 | - protected $config; |
|
29 | + /** * @var IConfig */ |
|
30 | + protected $config; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param string $argumentName |
|
34 | - * @param CompletionContext $context |
|
35 | - * @return string[] |
|
36 | - */ |
|
37 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
38 | - if ($argumentName === 'app') { |
|
39 | - return \OC_App::getAllApps(); |
|
40 | - } |
|
32 | + /** |
|
33 | + * @param string $argumentName |
|
34 | + * @param CompletionContext $context |
|
35 | + * @return string[] |
|
36 | + */ |
|
37 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
38 | + if ($argumentName === 'app') { |
|
39 | + return \OC_App::getAllApps(); |
|
40 | + } |
|
41 | 41 | |
42 | - if ($argumentName === 'name') { |
|
43 | - $appName = $context->getWordAtIndex($context->getWordIndex() - 1); |
|
44 | - return $this->config->getAppKeys($appName); |
|
45 | - } |
|
46 | - return []; |
|
47 | - } |
|
42 | + if ($argumentName === 'name') { |
|
43 | + $appName = $context->getWordAtIndex($context->getWordIndex() - 1); |
|
44 | + return $this->config->getAppKeys($appName); |
|
45 | + } |
|
46 | + return []; |
|
47 | + } |
|
48 | 48 | } |
@@ -29,61 +29,61 @@ |
||
29 | 29 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 30 | |
31 | 31 | class SetConfig extends Base { |
32 | - /** * @var IConfig */ |
|
33 | - protected $config; |
|
32 | + /** * @var IConfig */ |
|
33 | + protected $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param IConfig $config |
|
37 | - */ |
|
38 | - public function __construct(IConfig $config) { |
|
39 | - parent::__construct(); |
|
40 | - $this->config = $config; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param IConfig $config |
|
37 | + */ |
|
38 | + public function __construct(IConfig $config) { |
|
39 | + parent::__construct(); |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | 42 | |
43 | - protected function configure() { |
|
44 | - parent::configure(); |
|
43 | + protected function configure() { |
|
44 | + parent::configure(); |
|
45 | 45 | |
46 | - $this |
|
47 | - ->setName('config:app:set') |
|
48 | - ->setDescription('Set an app config value') |
|
49 | - ->addArgument( |
|
50 | - 'app', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'Name of the app' |
|
53 | - ) |
|
54 | - ->addArgument( |
|
55 | - 'name', |
|
56 | - InputArgument::REQUIRED, |
|
57 | - 'Name of the config to set' |
|
58 | - ) |
|
59 | - ->addOption( |
|
60 | - 'value', |
|
61 | - null, |
|
62 | - InputOption::VALUE_REQUIRED, |
|
63 | - 'The new value of the config' |
|
64 | - ) |
|
65 | - ->addOption( |
|
66 | - 'update-only', |
|
67 | - null, |
|
68 | - InputOption::VALUE_NONE, |
|
69 | - 'Only updates the value, if it is not set before, it is not being added' |
|
70 | - ) |
|
71 | - ; |
|
72 | - } |
|
46 | + $this |
|
47 | + ->setName('config:app:set') |
|
48 | + ->setDescription('Set an app config value') |
|
49 | + ->addArgument( |
|
50 | + 'app', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'Name of the app' |
|
53 | + ) |
|
54 | + ->addArgument( |
|
55 | + 'name', |
|
56 | + InputArgument::REQUIRED, |
|
57 | + 'Name of the config to set' |
|
58 | + ) |
|
59 | + ->addOption( |
|
60 | + 'value', |
|
61 | + null, |
|
62 | + InputOption::VALUE_REQUIRED, |
|
63 | + 'The new value of the config' |
|
64 | + ) |
|
65 | + ->addOption( |
|
66 | + 'update-only', |
|
67 | + null, |
|
68 | + InputOption::VALUE_NONE, |
|
69 | + 'Only updates the value, if it is not set before, it is not being added' |
|
70 | + ) |
|
71 | + ; |
|
72 | + } |
|
73 | 73 | |
74 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
75 | - $appName = $input->getArgument('app'); |
|
76 | - $configName = $input->getArgument('name'); |
|
74 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
75 | + $appName = $input->getArgument('app'); |
|
76 | + $configName = $input->getArgument('name'); |
|
77 | 77 | |
78 | - if (!in_array($configName, $this->config->getAppKeys($appName)) && $input->hasParameterOption('--update-only')) { |
|
79 | - $output->writeln('<comment>Config value ' . $configName . ' for app ' . $appName . ' not updated, as it has not been set before.</comment>'); |
|
80 | - return 1; |
|
81 | - } |
|
78 | + if (!in_array($configName, $this->config->getAppKeys($appName)) && $input->hasParameterOption('--update-only')) { |
|
79 | + $output->writeln('<comment>Config value ' . $configName . ' for app ' . $appName . ' not updated, as it has not been set before.</comment>'); |
|
80 | + return 1; |
|
81 | + } |
|
82 | 82 | |
83 | - $configValue = $input->getOption('value'); |
|
84 | - $this->config->setAppValue($appName, $configName, $configValue); |
|
83 | + $configValue = $input->getOption('value'); |
|
84 | + $this->config->setAppValue($appName, $configName, $configValue); |
|
85 | 85 | |
86 | - $output->writeln('<info>Config value ' . $configName . ' for app ' . $appName . ' set to ' . $configValue . '</info>'); |
|
87 | - return 0; |
|
88 | - } |
|
86 | + $output->writeln('<info>Config value ' . $configName . ' for app ' . $appName . ' set to ' . $configValue . '</info>'); |
|
87 | + return 0; |
|
88 | + } |
|
89 | 89 | } |
@@ -29,65 +29,65 @@ |
||
29 | 29 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 30 | |
31 | 31 | class GetConfig extends Base { |
32 | - /** * @var IConfig */ |
|
33 | - protected $config; |
|
32 | + /** * @var IConfig */ |
|
33 | + protected $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param IConfig $config |
|
37 | - */ |
|
38 | - public function __construct(IConfig $config) { |
|
39 | - parent::__construct(); |
|
40 | - $this->config = $config; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param IConfig $config |
|
37 | + */ |
|
38 | + public function __construct(IConfig $config) { |
|
39 | + parent::__construct(); |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | 42 | |
43 | - protected function configure() { |
|
44 | - parent::configure(); |
|
43 | + protected function configure() { |
|
44 | + parent::configure(); |
|
45 | 45 | |
46 | - $this |
|
47 | - ->setName('config:app:get') |
|
48 | - ->setDescription('Get an app config value') |
|
49 | - ->addArgument( |
|
50 | - 'app', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'Name of the app' |
|
53 | - ) |
|
54 | - ->addArgument( |
|
55 | - 'name', |
|
56 | - InputArgument::REQUIRED, |
|
57 | - 'Name of the config to get' |
|
58 | - ) |
|
59 | - ->addOption( |
|
60 | - 'default-value', |
|
61 | - null, |
|
62 | - InputOption::VALUE_OPTIONAL, |
|
63 | - 'If no default value is set and the config does not exist, the command will exit with 1' |
|
64 | - ) |
|
65 | - ; |
|
66 | - } |
|
46 | + $this |
|
47 | + ->setName('config:app:get') |
|
48 | + ->setDescription('Get an app config value') |
|
49 | + ->addArgument( |
|
50 | + 'app', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'Name of the app' |
|
53 | + ) |
|
54 | + ->addArgument( |
|
55 | + 'name', |
|
56 | + InputArgument::REQUIRED, |
|
57 | + 'Name of the config to get' |
|
58 | + ) |
|
59 | + ->addOption( |
|
60 | + 'default-value', |
|
61 | + null, |
|
62 | + InputOption::VALUE_OPTIONAL, |
|
63 | + 'If no default value is set and the config does not exist, the command will exit with 1' |
|
64 | + ) |
|
65 | + ; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Executes the current command. |
|
70 | - * |
|
71 | - * @param InputInterface $input An InputInterface instance |
|
72 | - * @param OutputInterface $output An OutputInterface instance |
|
73 | - * @return null|int null or 0 if everything went fine, or an error code |
|
74 | - */ |
|
75 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
76 | - $appName = $input->getArgument('app'); |
|
77 | - $configName = $input->getArgument('name'); |
|
78 | - $defaultValue = $input->getOption('default-value'); |
|
68 | + /** |
|
69 | + * Executes the current command. |
|
70 | + * |
|
71 | + * @param InputInterface $input An InputInterface instance |
|
72 | + * @param OutputInterface $output An OutputInterface instance |
|
73 | + * @return null|int null or 0 if everything went fine, or an error code |
|
74 | + */ |
|
75 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
76 | + $appName = $input->getArgument('app'); |
|
77 | + $configName = $input->getArgument('name'); |
|
78 | + $defaultValue = $input->getOption('default-value'); |
|
79 | 79 | |
80 | - if (!in_array($configName, $this->config->getAppKeys($appName)) && !$input->hasParameterOption('--default-value')) { |
|
81 | - return 1; |
|
82 | - } |
|
80 | + if (!in_array($configName, $this->config->getAppKeys($appName)) && !$input->hasParameterOption('--default-value')) { |
|
81 | + return 1; |
|
82 | + } |
|
83 | 83 | |
84 | - if (!in_array($configName, $this->config->getAppKeys($appName))) { |
|
85 | - $configValue = $defaultValue; |
|
86 | - } else { |
|
87 | - $configValue = $this->config->getAppValue($appName, $configName); |
|
88 | - } |
|
84 | + if (!in_array($configName, $this->config->getAppKeys($appName))) { |
|
85 | + $configValue = $defaultValue; |
|
86 | + } else { |
|
87 | + $configValue = $this->config->getAppValue($appName, $configName); |
|
88 | + } |
|
89 | 89 | |
90 | - $this->writeMixedInOutputFormat($input, $output, $configValue); |
|
91 | - return 0; |
|
92 | - } |
|
90 | + $this->writeMixedInOutputFormat($input, $output, $configValue); |
|
91 | + return 0; |
|
92 | + } |
|
93 | 93 | } |
@@ -28,23 +28,23 @@ |
||
28 | 28 | use Symfony\Component\Console\Output\OutputInterface; |
29 | 29 | |
30 | 30 | class Status extends Base { |
31 | - protected function configure() { |
|
32 | - parent::configure(); |
|
31 | + protected function configure() { |
|
32 | + parent::configure(); |
|
33 | 33 | |
34 | - $this |
|
35 | - ->setName('status') |
|
36 | - ->setDescription('show some status information') |
|
37 | - ; |
|
38 | - } |
|
34 | + $this |
|
35 | + ->setName('status') |
|
36 | + ->setDescription('show some status information') |
|
37 | + ; |
|
38 | + } |
|
39 | 39 | |
40 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
41 | - $values = array( |
|
42 | - 'installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false), |
|
43 | - 'version' => implode('.', \OCP\Util::getVersion()), |
|
44 | - 'versionstring' => \OC_Util::getVersionString(), |
|
45 | - 'edition' => '', |
|
46 | - ); |
|
40 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
41 | + $values = array( |
|
42 | + 'installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false), |
|
43 | + 'version' => implode('.', \OCP\Util::getVersion()), |
|
44 | + 'versionstring' => \OC_Util::getVersionString(), |
|
45 | + 'edition' => '', |
|
46 | + ); |
|
47 | 47 | |
48 | - $this->writeArrayInOutputFormat($input, $output, $values); |
|
49 | - } |
|
48 | + $this->writeArrayInOutputFormat($input, $output, $values); |
|
49 | + } |
|
50 | 50 | } |
@@ -30,25 +30,25 @@ |
||
30 | 30 | |
31 | 31 | class DataFingerprint extends Command { |
32 | 32 | |
33 | - /** @var IConfig */ |
|
34 | - protected $config; |
|
35 | - /** @var ITimeFactory */ |
|
36 | - protected $timeFactory; |
|
33 | + /** @var IConfig */ |
|
34 | + protected $config; |
|
35 | + /** @var ITimeFactory */ |
|
36 | + protected $timeFactory; |
|
37 | 37 | |
38 | - public function __construct(IConfig $config, |
|
39 | - ITimeFactory $timeFactory) { |
|
40 | - $this->config = $config; |
|
41 | - $this->timeFactory = $timeFactory; |
|
42 | - parent::__construct(); |
|
43 | - } |
|
38 | + public function __construct(IConfig $config, |
|
39 | + ITimeFactory $timeFactory) { |
|
40 | + $this->config = $config; |
|
41 | + $this->timeFactory = $timeFactory; |
|
42 | + parent::__construct(); |
|
43 | + } |
|
44 | 44 | |
45 | - protected function configure() { |
|
46 | - $this |
|
47 | - ->setName('maintenance:data-fingerprint') |
|
48 | - ->setDescription('update the systems data-fingerprint after a backup is restored'); |
|
49 | - } |
|
45 | + protected function configure() { |
|
46 | + $this |
|
47 | + ->setName('maintenance:data-fingerprint') |
|
48 | + ->setDescription('update the systems data-fingerprint after a backup is restored'); |
|
49 | + } |
|
50 | 50 | |
51 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
52 | - $this->config->setSystemValue('data-fingerprint', md5($this->timeFactory->getTime())); |
|
53 | - } |
|
51 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
52 | + $this->config->setSystemValue('data-fingerprint', md5($this->timeFactory->getTime())); |
|
53 | + } |
|
54 | 54 | } |
@@ -32,67 +32,67 @@ |
||
32 | 32 | |
33 | 33 | class UpdateDB extends Command { |
34 | 34 | |
35 | - const DEFAULT_MIMETYPE = 'application/octet-stream'; |
|
35 | + const DEFAULT_MIMETYPE = 'application/octet-stream'; |
|
36 | 36 | |
37 | - /** @var IMimeTypeDetector */ |
|
38 | - protected $mimetypeDetector; |
|
37 | + /** @var IMimeTypeDetector */ |
|
38 | + protected $mimetypeDetector; |
|
39 | 39 | |
40 | - /** @var IMimeTypeLoader */ |
|
41 | - protected $mimetypeLoader; |
|
40 | + /** @var IMimeTypeLoader */ |
|
41 | + protected $mimetypeLoader; |
|
42 | 42 | |
43 | - public function __construct( |
|
44 | - IMimeTypeDetector $mimetypeDetector, |
|
45 | - IMimeTypeLoader $mimetypeLoader |
|
46 | - ) { |
|
47 | - parent::__construct(); |
|
48 | - $this->mimetypeDetector = $mimetypeDetector; |
|
49 | - $this->mimetypeLoader = $mimetypeLoader; |
|
50 | - } |
|
43 | + public function __construct( |
|
44 | + IMimeTypeDetector $mimetypeDetector, |
|
45 | + IMimeTypeLoader $mimetypeLoader |
|
46 | + ) { |
|
47 | + parent::__construct(); |
|
48 | + $this->mimetypeDetector = $mimetypeDetector; |
|
49 | + $this->mimetypeLoader = $mimetypeLoader; |
|
50 | + } |
|
51 | 51 | |
52 | - protected function configure() { |
|
53 | - $this |
|
54 | - ->setName('maintenance:mimetype:update-db') |
|
55 | - ->setDescription('Update database mimetypes and update filecache') |
|
56 | - ->addOption( |
|
57 | - 'repair-filecache', |
|
58 | - null, |
|
59 | - InputOption::VALUE_NONE, |
|
60 | - 'Repair filecache for all mimetypes, not just new ones' |
|
61 | - ) |
|
62 | - ; |
|
63 | - } |
|
52 | + protected function configure() { |
|
53 | + $this |
|
54 | + ->setName('maintenance:mimetype:update-db') |
|
55 | + ->setDescription('Update database mimetypes and update filecache') |
|
56 | + ->addOption( |
|
57 | + 'repair-filecache', |
|
58 | + null, |
|
59 | + InputOption::VALUE_NONE, |
|
60 | + 'Repair filecache for all mimetypes, not just new ones' |
|
61 | + ) |
|
62 | + ; |
|
63 | + } |
|
64 | 64 | |
65 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
66 | - $mappings = $this->mimetypeDetector->getAllMappings(); |
|
65 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
66 | + $mappings = $this->mimetypeDetector->getAllMappings(); |
|
67 | 67 | |
68 | - $totalFilecacheUpdates = 0; |
|
69 | - $totalNewMimetypes = 0; |
|
68 | + $totalFilecacheUpdates = 0; |
|
69 | + $totalNewMimetypes = 0; |
|
70 | 70 | |
71 | - foreach ($mappings as $ext => $mimetypes) { |
|
72 | - if ($ext[0] === '_') { |
|
73 | - // comment |
|
74 | - continue; |
|
75 | - } |
|
76 | - $mimetype = $mimetypes[0]; |
|
77 | - $existing = $this->mimetypeLoader->exists($mimetype); |
|
78 | - // this will add the mimetype if it didn't exist |
|
79 | - $mimetypeId = $this->mimetypeLoader->getId($mimetype); |
|
71 | + foreach ($mappings as $ext => $mimetypes) { |
|
72 | + if ($ext[0] === '_') { |
|
73 | + // comment |
|
74 | + continue; |
|
75 | + } |
|
76 | + $mimetype = $mimetypes[0]; |
|
77 | + $existing = $this->mimetypeLoader->exists($mimetype); |
|
78 | + // this will add the mimetype if it didn't exist |
|
79 | + $mimetypeId = $this->mimetypeLoader->getId($mimetype); |
|
80 | 80 | |
81 | - if (!$existing) { |
|
82 | - $output->writeln('Added mimetype "'.$mimetype.'" to database'); |
|
83 | - $totalNewMimetypes++; |
|
84 | - } |
|
81 | + if (!$existing) { |
|
82 | + $output->writeln('Added mimetype "'.$mimetype.'" to database'); |
|
83 | + $totalNewMimetypes++; |
|
84 | + } |
|
85 | 85 | |
86 | - if (!$existing || $input->getOption('repair-filecache')) { |
|
87 | - $touchedFilecacheRows = $this->mimetypeLoader->updateFilecache($ext, $mimetypeId); |
|
88 | - if ($touchedFilecacheRows > 0) { |
|
89 | - $output->writeln('Updated '.$touchedFilecacheRows.' filecache rows for mimetype "'.$mimetype.'"'); |
|
90 | - } |
|
91 | - $totalFilecacheUpdates += $touchedFilecacheRows; |
|
92 | - } |
|
93 | - } |
|
86 | + if (!$existing || $input->getOption('repair-filecache')) { |
|
87 | + $touchedFilecacheRows = $this->mimetypeLoader->updateFilecache($ext, $mimetypeId); |
|
88 | + if ($touchedFilecacheRows > 0) { |
|
89 | + $output->writeln('Updated '.$touchedFilecacheRows.' filecache rows for mimetype "'.$mimetype.'"'); |
|
90 | + } |
|
91 | + $totalFilecacheUpdates += $touchedFilecacheRows; |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | - $output->writeln('Added '.$totalNewMimetypes.' new mimetypes'); |
|
96 | - $output->writeln('Updated '.$totalFilecacheUpdates.' filecache rows'); |
|
97 | - } |
|
95 | + $output->writeln('Added '.$totalNewMimetypes.' new mimetypes'); |
|
96 | + $output->writeln('Updated '.$totalFilecacheUpdates.' filecache rows'); |
|
97 | + } |
|
98 | 98 | } |