@@ -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 | } |
@@ -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 = [ |
|
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 = [ |
|
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 | } |
@@ -63,13 +63,13 @@ |
||
63 | 63 | |
64 | 64 | $lastLogin = $user->getLastLogin(); |
65 | 65 | if ($lastLogin === 0) { |
66 | - $output->writeln('User ' . $user->getUID() . |
|
66 | + $output->writeln('User '.$user->getUID(). |
|
67 | 67 | ' has never logged in, yet.'); |
68 | 68 | } else { |
69 | 69 | $date = new \DateTime(); |
70 | 70 | $date->setTimestamp($lastLogin); |
71 | - $output->writeln($user->getUID() . |
|
72 | - '`s last login: ' . $date->format('d.m.Y H:i')); |
|
71 | + $output->writeln($user->getUID(). |
|
72 | + '`s last login: '.$date->format('d.m.Y H:i')); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -33,44 +33,44 @@ |
||
33 | 33 | use Symfony\Component\Console\Output\OutputInterface; |
34 | 34 | |
35 | 35 | class LastSeen extends Command { |
36 | - /** @var IUserManager */ |
|
37 | - protected $userManager; |
|
36 | + /** @var IUserManager */ |
|
37 | + protected $userManager; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param IUserManager $userManager |
|
41 | - */ |
|
42 | - public function __construct(IUserManager $userManager) { |
|
43 | - $this->userManager = $userManager; |
|
44 | - parent::__construct(); |
|
45 | - } |
|
39 | + /** |
|
40 | + * @param IUserManager $userManager |
|
41 | + */ |
|
42 | + public function __construct(IUserManager $userManager) { |
|
43 | + $this->userManager = $userManager; |
|
44 | + parent::__construct(); |
|
45 | + } |
|
46 | 46 | |
47 | - protected function configure() { |
|
48 | - $this |
|
49 | - ->setName('user:lastseen') |
|
50 | - ->setDescription('shows when the user was logged in last time') |
|
51 | - ->addArgument( |
|
52 | - 'uid', |
|
53 | - InputArgument::REQUIRED, |
|
54 | - 'the username' |
|
55 | - ); |
|
56 | - } |
|
47 | + protected function configure() { |
|
48 | + $this |
|
49 | + ->setName('user:lastseen') |
|
50 | + ->setDescription('shows when the user was logged in last time') |
|
51 | + ->addArgument( |
|
52 | + 'uid', |
|
53 | + InputArgument::REQUIRED, |
|
54 | + 'the username' |
|
55 | + ); |
|
56 | + } |
|
57 | 57 | |
58 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
59 | - $user = $this->userManager->get($input->getArgument('uid')); |
|
60 | - if (is_null($user)) { |
|
61 | - $output->writeln('<error>User does not exist</error>'); |
|
62 | - return; |
|
63 | - } |
|
58 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
59 | + $user = $this->userManager->get($input->getArgument('uid')); |
|
60 | + if (is_null($user)) { |
|
61 | + $output->writeln('<error>User does not exist</error>'); |
|
62 | + return; |
|
63 | + } |
|
64 | 64 | |
65 | - $lastLogin = $user->getLastLogin(); |
|
66 | - if ($lastLogin === 0) { |
|
67 | - $output->writeln('User ' . $user->getUID() . |
|
68 | - ' has never logged in, yet.'); |
|
69 | - } else { |
|
70 | - $date = new \DateTime(); |
|
71 | - $date->setTimestamp($lastLogin); |
|
72 | - $output->writeln($user->getUID() . |
|
73 | - '`s last login: ' . $date->format('d.m.Y H:i')); |
|
74 | - } |
|
75 | - } |
|
65 | + $lastLogin = $user->getLastLogin(); |
|
66 | + if ($lastLogin === 0) { |
|
67 | + $output->writeln('User ' . $user->getUID() . |
|
68 | + ' has never logged in, yet.'); |
|
69 | + } else { |
|
70 | + $date = new \DateTime(); |
|
71 | + $date->setTimestamp($lastLogin); |
|
72 | + $output->writeln($user->getUID() . |
|
73 | + '`s last login: ' . $date->format('d.m.Y H:i')); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | } |