@@ -27,40 +27,40 @@ |
||
27 | 27 | |
28 | 28 | class Admin implements ISettings { |
29 | 29 | |
30 | - /** @var SettingsManager */ |
|
31 | - private $settingsManager; |
|
30 | + /** @var SettingsManager */ |
|
31 | + private $settingsManager; |
|
32 | 32 | |
33 | - public function __construct(SettingsManager $settingsManager) { |
|
34 | - $this->settingsManager = $settingsManager; |
|
35 | - } |
|
33 | + public function __construct(SettingsManager $settingsManager) { |
|
34 | + $this->settingsManager = $settingsManager; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @return TemplateResponse |
|
39 | - */ |
|
40 | - public function getForm() { |
|
41 | - $parameters = [ |
|
42 | - 'sendPasswordMail' => $this->settingsManager->sendPasswordByMail(), |
|
43 | - 'enforcePasswordProtection' => $this->settingsManager->enforcePasswordProtection() |
|
44 | - ]; |
|
37 | + /** |
|
38 | + * @return TemplateResponse |
|
39 | + */ |
|
40 | + public function getForm() { |
|
41 | + $parameters = [ |
|
42 | + 'sendPasswordMail' => $this->settingsManager->sendPasswordByMail(), |
|
43 | + 'enforcePasswordProtection' => $this->settingsManager->enforcePasswordProtection() |
|
44 | + ]; |
|
45 | 45 | |
46 | - return new TemplateResponse('sharebymail', 'settings-admin', $parameters, ''); |
|
47 | - } |
|
46 | + return new TemplateResponse('sharebymail', 'settings-admin', $parameters, ''); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return string the section ID, e.g. 'sharing' |
|
51 | - */ |
|
52 | - public function getSection() { |
|
53 | - return 'sharing'; |
|
54 | - } |
|
49 | + /** |
|
50 | + * @return string the section ID, e.g. 'sharing' |
|
51 | + */ |
|
52 | + public function getSection() { |
|
53 | + return 'sharing'; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the form should be rather on the top or bottom of |
|
58 | - * the admin section. The forms are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * |
|
61 | - * E.g.: 70 |
|
62 | - */ |
|
63 | - public function getPriority() { |
|
64 | - return 40; |
|
65 | - } |
|
56 | + /** |
|
57 | + * @return int whether the form should be rather on the top or bottom of |
|
58 | + * the admin section. The forms are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * |
|
61 | + * E.g.: 70 |
|
62 | + */ |
|
63 | + public function getPriority() { |
|
64 | + return 40; |
|
65 | + } |
|
66 | 66 | } |
@@ -12,11 +12,11 @@ |
||
12 | 12 | |
13 | 13 | <p> |
14 | 14 | <input id="sendPasswordMail" type="checkbox" class="checkbox" <?php if ($_['sendPasswordMail']) { |
15 | - p('checked'); |
|
15 | + p('checked'); |
|
16 | 16 | } ?> /> |
17 | 17 | <label for="sendPasswordMail"><?php p($l->t('Send password by mail')); ?></label><br/> |
18 | 18 | <input id="enforcePasswordProtection" type="checkbox" class="checkbox" <?php if ($_['enforcePasswordProtection']) { |
19 | - p('checked'); |
|
19 | + p('checked'); |
|
20 | 20 | } ?> /> |
21 | 21 | <label for="enforcePasswordProtection"><?php p($l->t('Enforce password protection')); ?></label> |
22 | 22 | </p> |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use OCP\AppFramework\Http; |
6 | 6 | |
7 | 7 | class NotSubAdminException extends \Exception { |
8 | - public function __construct() { |
|
9 | - parent::__construct('Logged in user must be at least a sub admin', Http::STATUS_FORBIDDEN); |
|
10 | - } |
|
8 | + public function __construct() { |
|
9 | + parent::__construct('Logged in user must be at least a sub admin', Http::STATUS_FORBIDDEN); |
|
10 | + } |
|
11 | 11 | } |
@@ -32,81 +32,81 @@ |
||
32 | 32 | |
33 | 33 | class CleanUp extends Command { |
34 | 34 | |
35 | - /** @var IUserManager */ |
|
36 | - protected $userManager; |
|
35 | + /** @var IUserManager */ |
|
36 | + protected $userManager; |
|
37 | 37 | |
38 | - /** @var IRootFolder */ |
|
39 | - protected $rootFolder; |
|
38 | + /** @var IRootFolder */ |
|
39 | + protected $rootFolder; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param IRootFolder $rootFolder |
|
43 | - * @param IUserManager $userManager |
|
44 | - */ |
|
45 | - public function __construct(IRootFolder $rootFolder, IUserManager $userManager) { |
|
46 | - parent::__construct(); |
|
47 | - $this->userManager = $userManager; |
|
48 | - $this->rootFolder = $rootFolder; |
|
49 | - } |
|
41 | + /** |
|
42 | + * @param IRootFolder $rootFolder |
|
43 | + * @param IUserManager $userManager |
|
44 | + */ |
|
45 | + public function __construct(IRootFolder $rootFolder, IUserManager $userManager) { |
|
46 | + parent::__construct(); |
|
47 | + $this->userManager = $userManager; |
|
48 | + $this->rootFolder = $rootFolder; |
|
49 | + } |
|
50 | 50 | |
51 | - protected function configure() { |
|
52 | - $this |
|
53 | - ->setName('versions:cleanup') |
|
54 | - ->setDescription('Delete versions') |
|
55 | - ->addArgument( |
|
56 | - 'user_id', |
|
57 | - InputArgument::OPTIONAL | InputArgument::IS_ARRAY, |
|
58 | - 'delete versions of the given user(s), if no user is given all versions will be deleted' |
|
59 | - ); |
|
60 | - } |
|
51 | + protected function configure() { |
|
52 | + $this |
|
53 | + ->setName('versions:cleanup') |
|
54 | + ->setDescription('Delete versions') |
|
55 | + ->addArgument( |
|
56 | + 'user_id', |
|
57 | + InputArgument::OPTIONAL | InputArgument::IS_ARRAY, |
|
58 | + 'delete versions of the given user(s), if no user is given all versions will be deleted' |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
64 | - $users = $input->getArgument('user_id'); |
|
65 | - if (!empty($users)) { |
|
66 | - foreach ($users as $user) { |
|
67 | - if ($this->userManager->userExists($user)) { |
|
68 | - $output->writeln("Delete versions of <info>$user</info>"); |
|
69 | - $this->deleteVersions($user); |
|
70 | - } else { |
|
71 | - $output->writeln("<error>Unknown user $user</error>"); |
|
72 | - } |
|
73 | - } |
|
74 | - } else { |
|
75 | - $output->writeln('Delete all versions'); |
|
76 | - foreach ($this->userManager->getBackends() as $backend) { |
|
77 | - $name = get_class($backend); |
|
63 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
64 | + $users = $input->getArgument('user_id'); |
|
65 | + if (!empty($users)) { |
|
66 | + foreach ($users as $user) { |
|
67 | + if ($this->userManager->userExists($user)) { |
|
68 | + $output->writeln("Delete versions of <info>$user</info>"); |
|
69 | + $this->deleteVersions($user); |
|
70 | + } else { |
|
71 | + $output->writeln("<error>Unknown user $user</error>"); |
|
72 | + } |
|
73 | + } |
|
74 | + } else { |
|
75 | + $output->writeln('Delete all versions'); |
|
76 | + foreach ($this->userManager->getBackends() as $backend) { |
|
77 | + $name = get_class($backend); |
|
78 | 78 | |
79 | - if ($backend instanceof IUserBackend) { |
|
80 | - $name = $backend->getBackendName(); |
|
81 | - } |
|
79 | + if ($backend instanceof IUserBackend) { |
|
80 | + $name = $backend->getBackendName(); |
|
81 | + } |
|
82 | 82 | |
83 | - $output->writeln("Delete versions for users on backend <info>$name</info>"); |
|
83 | + $output->writeln("Delete versions for users on backend <info>$name</info>"); |
|
84 | 84 | |
85 | - $limit = 500; |
|
86 | - $offset = 0; |
|
87 | - do { |
|
88 | - $users = $backend->getUsers('', $limit, $offset); |
|
89 | - foreach ($users as $user) { |
|
90 | - $output->writeln(" <info>$user</info>"); |
|
91 | - $this->deleteVersions($user); |
|
92 | - } |
|
93 | - $offset += $limit; |
|
94 | - } while (count($users) >= $limit); |
|
95 | - } |
|
96 | - } |
|
97 | - } |
|
85 | + $limit = 500; |
|
86 | + $offset = 0; |
|
87 | + do { |
|
88 | + $users = $backend->getUsers('', $limit, $offset); |
|
89 | + foreach ($users as $user) { |
|
90 | + $output->writeln(" <info>$user</info>"); |
|
91 | + $this->deleteVersions($user); |
|
92 | + } |
|
93 | + $offset += $limit; |
|
94 | + } while (count($users) >= $limit); |
|
95 | + } |
|
96 | + } |
|
97 | + } |
|
98 | 98 | |
99 | 99 | |
100 | - /** |
|
101 | - * delete versions for the given user |
|
102 | - * |
|
103 | - * @param string $user |
|
104 | - */ |
|
105 | - protected function deleteVersions($user) { |
|
106 | - \OC_Util::tearDownFS(); |
|
107 | - \OC_Util::setupFS($user); |
|
108 | - if ($this->rootFolder->nodeExists('/' . $user . '/files_versions')) { |
|
109 | - $this->rootFolder->get('/' . $user . '/files_versions')->delete(); |
|
110 | - } |
|
111 | - } |
|
100 | + /** |
|
101 | + * delete versions for the given user |
|
102 | + * |
|
103 | + * @param string $user |
|
104 | + */ |
|
105 | + protected function deleteVersions($user) { |
|
106 | + \OC_Util::tearDownFS(); |
|
107 | + \OC_Util::setupFS($user); |
|
108 | + if ($this->rootFolder->nodeExists('/' . $user . '/files_versions')) { |
|
109 | + $this->rootFolder->get('/' . $user . '/files_versions')->delete(); |
|
110 | + } |
|
111 | + } |
|
112 | 112 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | namespace OC\Core\Command\Background; |
27 | 27 | |
28 | 28 | class Ajax extends Base { |
29 | - protected function getMode() { |
|
30 | - return 'ajax'; |
|
31 | - } |
|
29 | + protected function getMode() { |
|
30 | + return 'ajax'; |
|
31 | + } |
|
32 | 32 | } |
@@ -37,39 +37,39 @@ |
||
37 | 37 | * Subclasses will override the getMode() function to specify the mode to configure. |
38 | 38 | */ |
39 | 39 | abstract class Base extends Command { |
40 | - abstract protected function getMode(); |
|
40 | + abstract protected function getMode(); |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var \OCP\IConfig |
|
44 | - */ |
|
45 | - protected $config; |
|
42 | + /** |
|
43 | + * @var \OCP\IConfig |
|
44 | + */ |
|
45 | + protected $config; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param \OCP\IConfig $config |
|
49 | - */ |
|
50 | - public function __construct(IConfig $config) { |
|
51 | - $this->config = $config; |
|
52 | - parent::__construct(); |
|
53 | - } |
|
47 | + /** |
|
48 | + * @param \OCP\IConfig $config |
|
49 | + */ |
|
50 | + public function __construct(IConfig $config) { |
|
51 | + $this->config = $config; |
|
52 | + parent::__construct(); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function configure() { |
|
56 | - $mode = $this->getMode(); |
|
57 | - $this |
|
58 | - ->setName("background:$mode") |
|
59 | - ->setDescription("Use $mode to run background jobs"); |
|
60 | - } |
|
55 | + protected function configure() { |
|
56 | + $mode = $this->getMode(); |
|
57 | + $this |
|
58 | + ->setName("background:$mode") |
|
59 | + ->setDescription("Use $mode to run background jobs"); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Executing this command will set the background job mode for owncloud. |
|
64 | - * The mode to set is specified by the concrete sub class by implementing the |
|
65 | - * getMode() function. |
|
66 | - * |
|
67 | - * @param InputInterface $input |
|
68 | - * @param OutputInterface $output |
|
69 | - */ |
|
70 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
71 | - $mode = $this->getMode(); |
|
72 | - $this->config->setAppValue('core', 'backgroundjobs_mode', $mode); |
|
73 | - $output->writeln("Set mode for background jobs to '$mode'"); |
|
74 | - } |
|
62 | + /** |
|
63 | + * Executing this command will set the background job mode for owncloud. |
|
64 | + * The mode to set is specified by the concrete sub class by implementing the |
|
65 | + * getMode() function. |
|
66 | + * |
|
67 | + * @param InputInterface $input |
|
68 | + * @param OutputInterface $output |
|
69 | + */ |
|
70 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
71 | + $mode = $this->getMode(); |
|
72 | + $this->config->setAppValue('core', 'backgroundjobs_mode', $mode); |
|
73 | + $output->writeln("Set mode for background jobs to '$mode'"); |
|
74 | + } |
|
75 | 75 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | namespace OC\Core\Command\Background; |
27 | 27 | |
28 | 28 | class Cron extends Base { |
29 | - protected function getMode() { |
|
30 | - return 'cron'; |
|
31 | - } |
|
29 | + protected function getMode() { |
|
30 | + return 'cron'; |
|
31 | + } |
|
32 | 32 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | namespace OC\Core\Command\Background; |
27 | 27 | |
28 | 28 | class WebCron extends Base { |
29 | - protected function getMode() { |
|
30 | - return 'webcron'; |
|
31 | - } |
|
29 | + protected function getMode() { |
|
30 | + return 'webcron'; |
|
31 | + } |
|
32 | 32 | } |
@@ -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 | - } elseif (!$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 | + } elseif (!$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 | } |