@@ -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,35 +30,35 @@ |
||
| 30 | 30 | |
| 31 | 31 | class Enable extends Base { |
| 32 | 32 | |
| 33 | - /** @var Manager */ |
|
| 34 | - private $manager; |
|
| 33 | + /** @var Manager */ |
|
| 34 | + private $manager; |
|
| 35 | 35 | |
| 36 | - /** @var IUserManager */ |
|
| 37 | - protected $userManager; |
|
| 36 | + /** @var IUserManager */ |
|
| 37 | + protected $userManager; |
|
| 38 | 38 | |
| 39 | - public function __construct(Manager $manager, IUserManager $userManager) { |
|
| 40 | - parent::__construct('twofactorauth:enable'); |
|
| 41 | - $this->manager = $manager; |
|
| 42 | - $this->userManager = $userManager; |
|
| 43 | - } |
|
| 39 | + public function __construct(Manager $manager, IUserManager $userManager) { |
|
| 40 | + parent::__construct('twofactorauth:enable'); |
|
| 41 | + $this->manager = $manager; |
|
| 42 | + $this->userManager = $userManager; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - protected function configure() { |
|
| 46 | - parent::configure(); |
|
| 45 | + protected function configure() { |
|
| 46 | + parent::configure(); |
|
| 47 | 47 | |
| 48 | - $this->setName('twofactorauth:enable'); |
|
| 49 | - $this->setDescription('Enable two-factor authentication for a user'); |
|
| 50 | - $this->addArgument('uid', InputArgument::REQUIRED); |
|
| 51 | - } |
|
| 48 | + $this->setName('twofactorauth:enable'); |
|
| 49 | + $this->setDescription('Enable two-factor authentication for a user'); |
|
| 50 | + $this->addArgument('uid', InputArgument::REQUIRED); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 54 | - $uid = $input->getArgument('uid'); |
|
| 55 | - $user = $this->userManager->get($uid); |
|
| 56 | - if (is_null($user)) { |
|
| 57 | - $output->writeln("<error>Invalid UID</error>"); |
|
| 58 | - return; |
|
| 59 | - } |
|
| 60 | - $this->manager->enableTwoFactorAuthentication($user); |
|
| 61 | - $output->writeln("Two-factor authentication enabled for user $uid"); |
|
| 62 | - } |
|
| 53 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 54 | + $uid = $input->getArgument('uid'); |
|
| 55 | + $user = $this->userManager->get($uid); |
|
| 56 | + if (is_null($user)) { |
|
| 57 | + $output->writeln("<error>Invalid UID</error>"); |
|
| 58 | + return; |
|
| 59 | + } |
|
| 60 | + $this->manager->enableTwoFactorAuthentication($user); |
|
| 61 | + $output->writeln("Two-factor authentication enabled for user $uid"); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | } |
@@ -30,35 +30,35 @@ |
||
| 30 | 30 | |
| 31 | 31 | class Disable extends Base { |
| 32 | 32 | |
| 33 | - /** @var Manager */ |
|
| 34 | - private $manager; |
|
| 33 | + /** @var Manager */ |
|
| 34 | + private $manager; |
|
| 35 | 35 | |
| 36 | - /** @var IUserManager */ |
|
| 37 | - protected $userManager; |
|
| 36 | + /** @var IUserManager */ |
|
| 37 | + protected $userManager; |
|
| 38 | 38 | |
| 39 | - public function __construct(Manager $manager, IUserManager $userManager) { |
|
| 40 | - parent::__construct('twofactorauth:disable'); |
|
| 41 | - $this->manager = $manager; |
|
| 42 | - $this->userManager = $userManager; |
|
| 43 | - } |
|
| 39 | + public function __construct(Manager $manager, IUserManager $userManager) { |
|
| 40 | + parent::__construct('twofactorauth:disable'); |
|
| 41 | + $this->manager = $manager; |
|
| 42 | + $this->userManager = $userManager; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - protected function configure() { |
|
| 46 | - parent::configure(); |
|
| 45 | + protected function configure() { |
|
| 46 | + parent::configure(); |
|
| 47 | 47 | |
| 48 | - $this->setName('twofactorauth:disable'); |
|
| 49 | - $this->setDescription('Disable two-factor authentication for a user'); |
|
| 50 | - $this->addArgument('uid', InputArgument::REQUIRED); |
|
| 51 | - } |
|
| 48 | + $this->setName('twofactorauth:disable'); |
|
| 49 | + $this->setDescription('Disable two-factor authentication for a user'); |
|
| 50 | + $this->addArgument('uid', InputArgument::REQUIRED); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 54 | - $uid = $input->getArgument('uid'); |
|
| 55 | - $user = $this->userManager->get($uid); |
|
| 56 | - if (is_null($user)) { |
|
| 57 | - $output->writeln("<error>Invalid UID</error>"); |
|
| 58 | - return; |
|
| 59 | - } |
|
| 60 | - $this->manager->disableTwoFactorAuthentication($user); |
|
| 61 | - $output->writeln("Two-factor authentication disabled for user $uid"); |
|
| 62 | - } |
|
| 53 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 54 | + $uid = $input->getArgument('uid'); |
|
| 55 | + $user = $this->userManager->get($uid); |
|
| 56 | + if (is_null($user)) { |
|
| 57 | + $output->writeln("<error>Invalid UID</error>"); |
|
| 58 | + return; |
|
| 59 | + } |
|
| 60 | + $this->manager->disableTwoFactorAuthentication($user); |
|
| 61 | + $output->writeln("Two-factor authentication disabled for user $uid"); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | } |
@@ -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 | } |