@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | return; |
67 | 67 | } |
68 | 68 | |
69 | - $this->userManager->callForSeenUsers(function (IUser $user) { |
|
69 | + $this->userManager->callForSeenUsers(function(IUser $user) { |
|
70 | 70 | $uid = $user->getUID(); |
71 | 71 | if (!$this->setupFS($uid)) { |
72 | 72 | return; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | \OC_Util::setupFS($user); |
86 | 86 | |
87 | 87 | // Check if this user has a versions directory |
88 | - $view = new \OC\Files\View('/' . $user); |
|
88 | + $view = new \OC\Files\View('/'.$user); |
|
89 | 89 | if (!$view->is_dir('/files_versions')) { |
90 | 90 | return false; |
91 | 91 | } |
@@ -31,56 +31,56 @@ |
||
31 | 31 | use OCP\IUserManager; |
32 | 32 | |
33 | 33 | class ExpireVersions extends \OC\BackgroundJob\TimedJob { |
34 | - public const ITEMS_PER_SESSION = 1000; |
|
34 | + public const ITEMS_PER_SESSION = 1000; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var Expiration |
|
38 | - */ |
|
39 | - private $expiration; |
|
36 | + /** |
|
37 | + * @var Expiration |
|
38 | + */ |
|
39 | + private $expiration; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var IUserManager |
|
43 | - */ |
|
44 | - private $userManager; |
|
41 | + /** |
|
42 | + * @var IUserManager |
|
43 | + */ |
|
44 | + private $userManager; |
|
45 | 45 | |
46 | - public function __construct(IUserManager $userManager, Expiration $expiration) { |
|
47 | - // Run once per 30 minutes |
|
48 | - $this->setInterval(60 * 30); |
|
46 | + public function __construct(IUserManager $userManager, Expiration $expiration) { |
|
47 | + // Run once per 30 minutes |
|
48 | + $this->setInterval(60 * 30); |
|
49 | 49 | |
50 | - $this->expiration = $expiration; |
|
51 | - $this->userManager = $userManager; |
|
52 | - } |
|
50 | + $this->expiration = $expiration; |
|
51 | + $this->userManager = $userManager; |
|
52 | + } |
|
53 | 53 | |
54 | - protected function run($argument) { |
|
55 | - $maxAge = $this->expiration->getMaxAgeAsTimestamp(); |
|
56 | - if (!$maxAge) { |
|
57 | - return; |
|
58 | - } |
|
54 | + protected function run($argument) { |
|
55 | + $maxAge = $this->expiration->getMaxAgeAsTimestamp(); |
|
56 | + if (!$maxAge) { |
|
57 | + return; |
|
58 | + } |
|
59 | 59 | |
60 | - $this->userManager->callForSeenUsers(function (IUser $user) { |
|
61 | - $uid = $user->getUID(); |
|
62 | - if (!$this->setupFS($uid)) { |
|
63 | - return; |
|
64 | - } |
|
65 | - Storage::expireOlderThanMaxForUser($uid); |
|
66 | - }); |
|
67 | - } |
|
60 | + $this->userManager->callForSeenUsers(function (IUser $user) { |
|
61 | + $uid = $user->getUID(); |
|
62 | + if (!$this->setupFS($uid)) { |
|
63 | + return; |
|
64 | + } |
|
65 | + Storage::expireOlderThanMaxForUser($uid); |
|
66 | + }); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Act on behalf on trash item owner |
|
71 | - * @param string $user |
|
72 | - * @return boolean |
|
73 | - */ |
|
74 | - protected function setupFS($user) { |
|
75 | - \OC_Util::tearDownFS(); |
|
76 | - \OC_Util::setupFS($user); |
|
69 | + /** |
|
70 | + * Act on behalf on trash item owner |
|
71 | + * @param string $user |
|
72 | + * @return boolean |
|
73 | + */ |
|
74 | + protected function setupFS($user) { |
|
75 | + \OC_Util::tearDownFS(); |
|
76 | + \OC_Util::setupFS($user); |
|
77 | 77 | |
78 | - // Check if this user has a versions directory |
|
79 | - $view = new \OC\Files\View('/' . $user); |
|
80 | - if (!$view->is_dir('/files_versions')) { |
|
81 | - return false; |
|
82 | - } |
|
78 | + // Check if this user has a versions directory |
|
79 | + $view = new \OC\Files\View('/' . $user); |
|
80 | + if (!$view->is_dir('/files_versions')) { |
|
81 | + return false; |
|
82 | + } |
|
83 | 83 | |
84 | - return true; |
|
85 | - } |
|
84 | + return true; |
|
85 | + } |
|
86 | 86 | } |
@@ -99,7 +99,7 @@ |
||
99 | 99 | $this->checker->writeCoreSignature($x509, $rsa, $path); |
100 | 100 | $output->writeln('Successfully signed "core"'); |
101 | 101 | } catch (\Exception $e) { |
102 | - $output->writeln('Error: ' . $e->getMessage()); |
|
102 | + $output->writeln('Error: '.$e->getMessage()); |
|
103 | 103 | return 1; |
104 | 104 | } |
105 | 105 | return 0; |
@@ -38,69 +38,69 @@ |
||
38 | 38 | * @package OC\Core\Command\Integrity |
39 | 39 | */ |
40 | 40 | class SignCore extends Command { |
41 | - /** @var Checker */ |
|
42 | - private $checker; |
|
43 | - /** @var FileAccessHelper */ |
|
44 | - private $fileAccessHelper; |
|
41 | + /** @var Checker */ |
|
42 | + private $checker; |
|
43 | + /** @var FileAccessHelper */ |
|
44 | + private $fileAccessHelper; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param Checker $checker |
|
48 | - * @param FileAccessHelper $fileAccessHelper |
|
49 | - */ |
|
50 | - public function __construct(Checker $checker, |
|
51 | - FileAccessHelper $fileAccessHelper) { |
|
52 | - parent::__construct(null); |
|
53 | - $this->checker = $checker; |
|
54 | - $this->fileAccessHelper = $fileAccessHelper; |
|
55 | - } |
|
46 | + /** |
|
47 | + * @param Checker $checker |
|
48 | + * @param FileAccessHelper $fileAccessHelper |
|
49 | + */ |
|
50 | + public function __construct(Checker $checker, |
|
51 | + FileAccessHelper $fileAccessHelper) { |
|
52 | + parent::__construct(null); |
|
53 | + $this->checker = $checker; |
|
54 | + $this->fileAccessHelper = $fileAccessHelper; |
|
55 | + } |
|
56 | 56 | |
57 | - protected function configure() { |
|
58 | - $this |
|
59 | - ->setName('integrity:sign-core') |
|
60 | - ->setDescription('Sign core using a private key.') |
|
61 | - ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') |
|
62 | - ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing') |
|
63 | - ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Path of core to sign'); |
|
64 | - } |
|
57 | + protected function configure() { |
|
58 | + $this |
|
59 | + ->setName('integrity:sign-core') |
|
60 | + ->setDescription('Sign core using a private key.') |
|
61 | + ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') |
|
62 | + ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing') |
|
63 | + ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Path of core to sign'); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * {@inheritdoc } |
|
68 | - */ |
|
69 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
70 | - $privateKeyPath = $input->getOption('privateKey'); |
|
71 | - $keyBundlePath = $input->getOption('certificate'); |
|
72 | - $path = $input->getOption('path'); |
|
73 | - if (is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { |
|
74 | - $output->writeln('--privateKey, --certificate and --path are required.'); |
|
75 | - return null; |
|
76 | - } |
|
66 | + /** |
|
67 | + * {@inheritdoc } |
|
68 | + */ |
|
69 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
70 | + $privateKeyPath = $input->getOption('privateKey'); |
|
71 | + $keyBundlePath = $input->getOption('certificate'); |
|
72 | + $path = $input->getOption('path'); |
|
73 | + if (is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { |
|
74 | + $output->writeln('--privateKey, --certificate and --path are required.'); |
|
75 | + return null; |
|
76 | + } |
|
77 | 77 | |
78 | - $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
|
79 | - $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
|
78 | + $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
|
79 | + $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
|
80 | 80 | |
81 | - if ($privateKey === false) { |
|
82 | - $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
|
83 | - return null; |
|
84 | - } |
|
81 | + if ($privateKey === false) { |
|
82 | + $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
|
83 | + return null; |
|
84 | + } |
|
85 | 85 | |
86 | - if ($keyBundle === false) { |
|
87 | - $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
|
88 | - return null; |
|
89 | - } |
|
86 | + if ($keyBundle === false) { |
|
87 | + $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
|
88 | + return null; |
|
89 | + } |
|
90 | 90 | |
91 | - $rsa = new RSA(); |
|
92 | - $rsa->loadKey($privateKey); |
|
93 | - $x509 = new X509(); |
|
94 | - $x509->loadX509($keyBundle); |
|
95 | - $x509->setPrivateKey($rsa); |
|
91 | + $rsa = new RSA(); |
|
92 | + $rsa->loadKey($privateKey); |
|
93 | + $x509 = new X509(); |
|
94 | + $x509->loadX509($keyBundle); |
|
95 | + $x509->setPrivateKey($rsa); |
|
96 | 96 | |
97 | - try { |
|
98 | - $this->checker->writeCoreSignature($x509, $rsa, $path); |
|
99 | - $output->writeln('Successfully signed "core"'); |
|
100 | - } catch (\Exception $e) { |
|
101 | - $output->writeln('Error: ' . $e->getMessage()); |
|
102 | - return 1; |
|
103 | - } |
|
104 | - return 0; |
|
105 | - } |
|
97 | + try { |
|
98 | + $this->checker->writeCoreSignature($x509, $rsa, $path); |
|
99 | + $output->writeln('Successfully signed "core"'); |
|
100 | + } catch (\Exception $e) { |
|
101 | + $output->writeln('Error: ' . $e->getMessage()); |
|
102 | + return 1; |
|
103 | + } |
|
104 | + return 0; |
|
105 | + } |
|
106 | 106 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity'); |
82 | 82 | $output->writeln('This command requires the --path, --privateKey and --certificate.'); |
83 | 83 | $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"'); |
84 | - $output->writeln('For more information please consult the documentation: '. $documentationUrl); |
|
84 | + $output->writeln('For more information please consult the documentation: '.$documentationUrl); |
|
85 | 85 | return null; |
86 | 86 | } |
87 | 87 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $this->checker->writeAppSignature($path, $x509, $rsa); |
108 | 108 | $output->writeln('Successfully signed "'.$path.'"'); |
109 | 109 | } catch (\Exception $e) { |
110 | - $output->writeln('Error: ' . $e->getMessage()); |
|
110 | + $output->writeln('Error: '.$e->getMessage()); |
|
111 | 111 | return 1; |
112 | 112 | } |
113 | 113 | return 0; |
@@ -39,76 +39,76 @@ |
||
39 | 39 | * @package OC\Core\Command\Integrity |
40 | 40 | */ |
41 | 41 | class SignApp extends Command { |
42 | - /** @var Checker */ |
|
43 | - private $checker; |
|
44 | - /** @var FileAccessHelper */ |
|
45 | - private $fileAccessHelper; |
|
46 | - /** @var IURLGenerator */ |
|
47 | - private $urlGenerator; |
|
42 | + /** @var Checker */ |
|
43 | + private $checker; |
|
44 | + /** @var FileAccessHelper */ |
|
45 | + private $fileAccessHelper; |
|
46 | + /** @var IURLGenerator */ |
|
47 | + private $urlGenerator; |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param Checker $checker |
|
51 | - * @param FileAccessHelper $fileAccessHelper |
|
52 | - * @param IURLGenerator $urlGenerator |
|
53 | - */ |
|
54 | - public function __construct(Checker $checker, |
|
55 | - FileAccessHelper $fileAccessHelper, |
|
56 | - IURLGenerator $urlGenerator) { |
|
57 | - parent::__construct(null); |
|
58 | - $this->checker = $checker; |
|
59 | - $this->fileAccessHelper = $fileAccessHelper; |
|
60 | - $this->urlGenerator = $urlGenerator; |
|
61 | - } |
|
49 | + /** |
|
50 | + * @param Checker $checker |
|
51 | + * @param FileAccessHelper $fileAccessHelper |
|
52 | + * @param IURLGenerator $urlGenerator |
|
53 | + */ |
|
54 | + public function __construct(Checker $checker, |
|
55 | + FileAccessHelper $fileAccessHelper, |
|
56 | + IURLGenerator $urlGenerator) { |
|
57 | + parent::__construct(null); |
|
58 | + $this->checker = $checker; |
|
59 | + $this->fileAccessHelper = $fileAccessHelper; |
|
60 | + $this->urlGenerator = $urlGenerator; |
|
61 | + } |
|
62 | 62 | |
63 | - protected function configure() { |
|
64 | - $this |
|
65 | - ->setName('integrity:sign-app') |
|
66 | - ->setDescription('Signs an app using a private key.') |
|
67 | - ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Application to sign') |
|
68 | - ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') |
|
69 | - ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing'); |
|
70 | - } |
|
63 | + protected function configure() { |
|
64 | + $this |
|
65 | + ->setName('integrity:sign-app') |
|
66 | + ->setDescription('Signs an app using a private key.') |
|
67 | + ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Application to sign') |
|
68 | + ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') |
|
69 | + ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing'); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * {@inheritdoc } |
|
74 | - */ |
|
75 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
76 | - $path = $input->getOption('path'); |
|
77 | - $privateKeyPath = $input->getOption('privateKey'); |
|
78 | - $keyBundlePath = $input->getOption('certificate'); |
|
79 | - if (is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { |
|
80 | - $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity'); |
|
81 | - $output->writeln('This command requires the --path, --privateKey and --certificate.'); |
|
82 | - $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"'); |
|
83 | - $output->writeln('For more information please consult the documentation: '. $documentationUrl); |
|
84 | - return null; |
|
85 | - } |
|
72 | + /** |
|
73 | + * {@inheritdoc } |
|
74 | + */ |
|
75 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
76 | + $path = $input->getOption('path'); |
|
77 | + $privateKeyPath = $input->getOption('privateKey'); |
|
78 | + $keyBundlePath = $input->getOption('certificate'); |
|
79 | + if (is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { |
|
80 | + $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity'); |
|
81 | + $output->writeln('This command requires the --path, --privateKey and --certificate.'); |
|
82 | + $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"'); |
|
83 | + $output->writeln('For more information please consult the documentation: '. $documentationUrl); |
|
84 | + return null; |
|
85 | + } |
|
86 | 86 | |
87 | - $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
|
88 | - $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
|
87 | + $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
|
88 | + $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
|
89 | 89 | |
90 | - if ($privateKey === false) { |
|
91 | - $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
|
92 | - return null; |
|
93 | - } |
|
90 | + if ($privateKey === false) { |
|
91 | + $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
|
92 | + return null; |
|
93 | + } |
|
94 | 94 | |
95 | - if ($keyBundle === false) { |
|
96 | - $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
|
97 | - return null; |
|
98 | - } |
|
95 | + if ($keyBundle === false) { |
|
96 | + $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
|
97 | + return null; |
|
98 | + } |
|
99 | 99 | |
100 | - $rsa = new RSA(); |
|
101 | - $rsa->loadKey($privateKey); |
|
102 | - $x509 = new X509(); |
|
103 | - $x509->loadX509($keyBundle); |
|
104 | - $x509->setPrivateKey($rsa); |
|
105 | - try { |
|
106 | - $this->checker->writeAppSignature($path, $x509, $rsa); |
|
107 | - $output->writeln('Successfully signed "'.$path.'"'); |
|
108 | - } catch (\Exception $e) { |
|
109 | - $output->writeln('Error: ' . $e->getMessage()); |
|
110 | - return 1; |
|
111 | - } |
|
112 | - return 0; |
|
113 | - } |
|
100 | + $rsa = new RSA(); |
|
101 | + $rsa->loadKey($privateKey); |
|
102 | + $x509 = new X509(); |
|
103 | + $x509->loadX509($keyBundle); |
|
104 | + $x509->setPrivateKey($rsa); |
|
105 | + try { |
|
106 | + $this->checker->writeAppSignature($path, $x509, $rsa); |
|
107 | + $output->writeln('Successfully signed "'.$path.'"'); |
|
108 | + } catch (\Exception $e) { |
|
109 | + $output->writeln('Error: ' . $e->getMessage()); |
|
110 | + return 1; |
|
111 | + } |
|
112 | + return 0; |
|
113 | + } |
|
114 | 114 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function completeArgumentValues($argumentName, CompletionContext $context) { |
53 | 53 | if ($argumentName === 'uid') { |
54 | - return array_map(function (IUser $user) { |
|
54 | + return array_map(function(IUser $user) { |
|
55 | 55 | return $user->getUID(); |
56 | 56 | }, $this->userManager->search($context->getCurrentWord(), 100)); |
57 | 57 | } |
@@ -31,33 +31,33 @@ |
||
31 | 31 | |
32 | 32 | class Base extends \OC\Core\Command\Base { |
33 | 33 | |
34 | - /** @var IUserManager */ |
|
35 | - protected $userManager; |
|
34 | + /** @var IUserManager */ |
|
35 | + protected $userManager; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Return possible values for the named option |
|
39 | - * |
|
40 | - * @param string $optionName |
|
41 | - * @param CompletionContext $context |
|
42 | - * @return string[] |
|
43 | - */ |
|
44 | - public function completeOptionValues($optionName, CompletionContext $context) { |
|
45 | - return []; |
|
46 | - } |
|
37 | + /** |
|
38 | + * Return possible values for the named option |
|
39 | + * |
|
40 | + * @param string $optionName |
|
41 | + * @param CompletionContext $context |
|
42 | + * @return string[] |
|
43 | + */ |
|
44 | + public function completeOptionValues($optionName, CompletionContext $context) { |
|
45 | + return []; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Return possible values for the named argument |
|
50 | - * |
|
51 | - * @param string $argumentName |
|
52 | - * @param CompletionContext $context |
|
53 | - * @return string[] |
|
54 | - */ |
|
55 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
56 | - if ($argumentName === 'uid') { |
|
57 | - return array_map(function (IUser $user) { |
|
58 | - return $user->getUID(); |
|
59 | - }, $this->userManager->search($context->getCurrentWord(), 100)); |
|
60 | - } |
|
61 | - return []; |
|
62 | - } |
|
48 | + /** |
|
49 | + * Return possible values for the named argument |
|
50 | + * |
|
51 | + * @param string $argumentName |
|
52 | + * @param CompletionContext $context |
|
53 | + * @return string[] |
|
54 | + */ |
|
55 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
56 | + if ($argumentName === 'uid') { |
|
57 | + return array_map(function (IUser $user) { |
|
58 | + return $user->getUID(); |
|
59 | + }, $this->userManager->search($context->getCurrentWord(), 100)); |
|
60 | + } |
|
61 | + return []; |
|
62 | + } |
|
63 | 63 | } |
@@ -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 | } |