@@ -29,61 +29,61 @@ |
||
29 | 29 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 30 | |
31 | 31 | class SetConfig extends Base { |
32 | - /** * @var IConfig */ |
|
33 | - protected $config; |
|
32 | + /** * @var IConfig */ |
|
33 | + protected $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param IConfig $config |
|
37 | - */ |
|
38 | - public function __construct(IConfig $config) { |
|
39 | - parent::__construct(); |
|
40 | - $this->config = $config; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param IConfig $config |
|
37 | + */ |
|
38 | + public function __construct(IConfig $config) { |
|
39 | + parent::__construct(); |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | 42 | |
43 | - protected function configure() { |
|
44 | - parent::configure(); |
|
43 | + protected function configure() { |
|
44 | + parent::configure(); |
|
45 | 45 | |
46 | - $this |
|
47 | - ->setName('config:app:set') |
|
48 | - ->setDescription('Set an app config value') |
|
49 | - ->addArgument( |
|
50 | - 'app', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'Name of the app' |
|
53 | - ) |
|
54 | - ->addArgument( |
|
55 | - 'name', |
|
56 | - InputArgument::REQUIRED, |
|
57 | - 'Name of the config to set' |
|
58 | - ) |
|
59 | - ->addOption( |
|
60 | - 'value', |
|
61 | - null, |
|
62 | - InputOption::VALUE_REQUIRED, |
|
63 | - 'The new value of the config' |
|
64 | - ) |
|
65 | - ->addOption( |
|
66 | - 'update-only', |
|
67 | - null, |
|
68 | - InputOption::VALUE_NONE, |
|
69 | - 'Only updates the value, if it is not set before, it is not being added' |
|
70 | - ) |
|
71 | - ; |
|
72 | - } |
|
46 | + $this |
|
47 | + ->setName('config:app:set') |
|
48 | + ->setDescription('Set an app config value') |
|
49 | + ->addArgument( |
|
50 | + 'app', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'Name of the app' |
|
53 | + ) |
|
54 | + ->addArgument( |
|
55 | + 'name', |
|
56 | + InputArgument::REQUIRED, |
|
57 | + 'Name of the config to set' |
|
58 | + ) |
|
59 | + ->addOption( |
|
60 | + 'value', |
|
61 | + null, |
|
62 | + InputOption::VALUE_REQUIRED, |
|
63 | + 'The new value of the config' |
|
64 | + ) |
|
65 | + ->addOption( |
|
66 | + 'update-only', |
|
67 | + null, |
|
68 | + InputOption::VALUE_NONE, |
|
69 | + 'Only updates the value, if it is not set before, it is not being added' |
|
70 | + ) |
|
71 | + ; |
|
72 | + } |
|
73 | 73 | |
74 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
75 | - $appName = $input->getArgument('app'); |
|
76 | - $configName = $input->getArgument('name'); |
|
74 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
75 | + $appName = $input->getArgument('app'); |
|
76 | + $configName = $input->getArgument('name'); |
|
77 | 77 | |
78 | - if (!in_array($configName, $this->config->getAppKeys($appName)) && $input->hasParameterOption('--update-only')) { |
|
79 | - $output->writeln('<comment>Config value ' . $configName . ' for app ' . $appName . ' not updated, as it has not been set before.</comment>'); |
|
80 | - return 1; |
|
81 | - } |
|
78 | + if (!in_array($configName, $this->config->getAppKeys($appName)) && $input->hasParameterOption('--update-only')) { |
|
79 | + $output->writeln('<comment>Config value ' . $configName . ' for app ' . $appName . ' not updated, as it has not been set before.</comment>'); |
|
80 | + return 1; |
|
81 | + } |
|
82 | 82 | |
83 | - $configValue = $input->getOption('value'); |
|
84 | - $this->config->setAppValue($appName, $configName, $configValue); |
|
83 | + $configValue = $input->getOption('value'); |
|
84 | + $this->config->setAppValue($appName, $configName, $configValue); |
|
85 | 85 | |
86 | - $output->writeln('<info>Config value ' . $configName . ' for app ' . $appName . ' set to ' . $configValue . '</info>'); |
|
87 | - return 0; |
|
88 | - } |
|
86 | + $output->writeln('<info>Config value ' . $configName . ' for app ' . $appName . ' set to ' . $configValue . '</info>'); |
|
87 | + return 0; |
|
88 | + } |
|
89 | 89 | } |
@@ -29,65 +29,65 @@ |
||
29 | 29 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 30 | |
31 | 31 | class GetConfig extends Base { |
32 | - /** * @var IConfig */ |
|
33 | - protected $config; |
|
32 | + /** * @var IConfig */ |
|
33 | + protected $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param IConfig $config |
|
37 | - */ |
|
38 | - public function __construct(IConfig $config) { |
|
39 | - parent::__construct(); |
|
40 | - $this->config = $config; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param IConfig $config |
|
37 | + */ |
|
38 | + public function __construct(IConfig $config) { |
|
39 | + parent::__construct(); |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | 42 | |
43 | - protected function configure() { |
|
44 | - parent::configure(); |
|
43 | + protected function configure() { |
|
44 | + parent::configure(); |
|
45 | 45 | |
46 | - $this |
|
47 | - ->setName('config:app:get') |
|
48 | - ->setDescription('Get an app config value') |
|
49 | - ->addArgument( |
|
50 | - 'app', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'Name of the app' |
|
53 | - ) |
|
54 | - ->addArgument( |
|
55 | - 'name', |
|
56 | - InputArgument::REQUIRED, |
|
57 | - 'Name of the config to get' |
|
58 | - ) |
|
59 | - ->addOption( |
|
60 | - 'default-value', |
|
61 | - null, |
|
62 | - InputOption::VALUE_OPTIONAL, |
|
63 | - 'If no default value is set and the config does not exist, the command will exit with 1' |
|
64 | - ) |
|
65 | - ; |
|
66 | - } |
|
46 | + $this |
|
47 | + ->setName('config:app:get') |
|
48 | + ->setDescription('Get an app config value') |
|
49 | + ->addArgument( |
|
50 | + 'app', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'Name of the app' |
|
53 | + ) |
|
54 | + ->addArgument( |
|
55 | + 'name', |
|
56 | + InputArgument::REQUIRED, |
|
57 | + 'Name of the config to get' |
|
58 | + ) |
|
59 | + ->addOption( |
|
60 | + 'default-value', |
|
61 | + null, |
|
62 | + InputOption::VALUE_OPTIONAL, |
|
63 | + 'If no default value is set and the config does not exist, the command will exit with 1' |
|
64 | + ) |
|
65 | + ; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Executes the current command. |
|
70 | - * |
|
71 | - * @param InputInterface $input An InputInterface instance |
|
72 | - * @param OutputInterface $output An OutputInterface instance |
|
73 | - * @return null|int null or 0 if everything went fine, or an error code |
|
74 | - */ |
|
75 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
76 | - $appName = $input->getArgument('app'); |
|
77 | - $configName = $input->getArgument('name'); |
|
78 | - $defaultValue = $input->getOption('default-value'); |
|
68 | + /** |
|
69 | + * Executes the current command. |
|
70 | + * |
|
71 | + * @param InputInterface $input An InputInterface instance |
|
72 | + * @param OutputInterface $output An OutputInterface instance |
|
73 | + * @return null|int null or 0 if everything went fine, or an error code |
|
74 | + */ |
|
75 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
76 | + $appName = $input->getArgument('app'); |
|
77 | + $configName = $input->getArgument('name'); |
|
78 | + $defaultValue = $input->getOption('default-value'); |
|
79 | 79 | |
80 | - if (!in_array($configName, $this->config->getAppKeys($appName)) && !$input->hasParameterOption('--default-value')) { |
|
81 | - return 1; |
|
82 | - } |
|
80 | + if (!in_array($configName, $this->config->getAppKeys($appName)) && !$input->hasParameterOption('--default-value')) { |
|
81 | + return 1; |
|
82 | + } |
|
83 | 83 | |
84 | - if (!in_array($configName, $this->config->getAppKeys($appName))) { |
|
85 | - $configValue = $defaultValue; |
|
86 | - } else { |
|
87 | - $configValue = $this->config->getAppValue($appName, $configName); |
|
88 | - } |
|
84 | + if (!in_array($configName, $this->config->getAppKeys($appName))) { |
|
85 | + $configValue = $defaultValue; |
|
86 | + } else { |
|
87 | + $configValue = $this->config->getAppValue($appName, $configName); |
|
88 | + } |
|
89 | 89 | |
90 | - $this->writeMixedInOutputFormat($input, $output, $configValue); |
|
91 | - return 0; |
|
92 | - } |
|
90 | + $this->writeMixedInOutputFormat($input, $output, $configValue); |
|
91 | + return 0; |
|
92 | + } |
|
93 | 93 | } |
@@ -28,23 +28,23 @@ |
||
28 | 28 | use Symfony\Component\Console\Output\OutputInterface; |
29 | 29 | |
30 | 30 | class Status extends Base { |
31 | - protected function configure() { |
|
32 | - parent::configure(); |
|
31 | + protected function configure() { |
|
32 | + parent::configure(); |
|
33 | 33 | |
34 | - $this |
|
35 | - ->setName('status') |
|
36 | - ->setDescription('show some status information') |
|
37 | - ; |
|
38 | - } |
|
34 | + $this |
|
35 | + ->setName('status') |
|
36 | + ->setDescription('show some status information') |
|
37 | + ; |
|
38 | + } |
|
39 | 39 | |
40 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
41 | - $values = array( |
|
42 | - 'installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false), |
|
43 | - 'version' => implode('.', \OCP\Util::getVersion()), |
|
44 | - 'versionstring' => \OC_Util::getVersionString(), |
|
45 | - 'edition' => '', |
|
46 | - ); |
|
40 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
41 | + $values = array( |
|
42 | + 'installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false), |
|
43 | + 'version' => implode('.', \OCP\Util::getVersion()), |
|
44 | + 'versionstring' => \OC_Util::getVersionString(), |
|
45 | + 'edition' => '', |
|
46 | + ); |
|
47 | 47 | |
48 | - $this->writeArrayInOutputFormat($input, $output, $values); |
|
49 | - } |
|
48 | + $this->writeArrayInOutputFormat($input, $output, $values); |
|
49 | + } |
|
50 | 50 | } |
@@ -30,25 +30,25 @@ |
||
30 | 30 | |
31 | 31 | class DataFingerprint extends Command { |
32 | 32 | |
33 | - /** @var IConfig */ |
|
34 | - protected $config; |
|
35 | - /** @var ITimeFactory */ |
|
36 | - protected $timeFactory; |
|
33 | + /** @var IConfig */ |
|
34 | + protected $config; |
|
35 | + /** @var ITimeFactory */ |
|
36 | + protected $timeFactory; |
|
37 | 37 | |
38 | - public function __construct(IConfig $config, |
|
39 | - ITimeFactory $timeFactory) { |
|
40 | - $this->config = $config; |
|
41 | - $this->timeFactory = $timeFactory; |
|
42 | - parent::__construct(); |
|
43 | - } |
|
38 | + public function __construct(IConfig $config, |
|
39 | + ITimeFactory $timeFactory) { |
|
40 | + $this->config = $config; |
|
41 | + $this->timeFactory = $timeFactory; |
|
42 | + parent::__construct(); |
|
43 | + } |
|
44 | 44 | |
45 | - protected function configure() { |
|
46 | - $this |
|
47 | - ->setName('maintenance:data-fingerprint') |
|
48 | - ->setDescription('update the systems data-fingerprint after a backup is restored'); |
|
49 | - } |
|
45 | + protected function configure() { |
|
46 | + $this |
|
47 | + ->setName('maintenance:data-fingerprint') |
|
48 | + ->setDescription('update the systems data-fingerprint after a backup is restored'); |
|
49 | + } |
|
50 | 50 | |
51 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
52 | - $this->config->setSystemValue('data-fingerprint', md5($this->timeFactory->getTime())); |
|
53 | - } |
|
51 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
52 | + $this->config->setSystemValue('data-fingerprint', md5($this->timeFactory->getTime())); |
|
53 | + } |
|
54 | 54 | } |
@@ -32,67 +32,67 @@ |
||
32 | 32 | |
33 | 33 | class UpdateDB extends Command { |
34 | 34 | |
35 | - const DEFAULT_MIMETYPE = 'application/octet-stream'; |
|
35 | + const DEFAULT_MIMETYPE = 'application/octet-stream'; |
|
36 | 36 | |
37 | - /** @var IMimeTypeDetector */ |
|
38 | - protected $mimetypeDetector; |
|
37 | + /** @var IMimeTypeDetector */ |
|
38 | + protected $mimetypeDetector; |
|
39 | 39 | |
40 | - /** @var IMimeTypeLoader */ |
|
41 | - protected $mimetypeLoader; |
|
40 | + /** @var IMimeTypeLoader */ |
|
41 | + protected $mimetypeLoader; |
|
42 | 42 | |
43 | - public function __construct( |
|
44 | - IMimeTypeDetector $mimetypeDetector, |
|
45 | - IMimeTypeLoader $mimetypeLoader |
|
46 | - ) { |
|
47 | - parent::__construct(); |
|
48 | - $this->mimetypeDetector = $mimetypeDetector; |
|
49 | - $this->mimetypeLoader = $mimetypeLoader; |
|
50 | - } |
|
43 | + public function __construct( |
|
44 | + IMimeTypeDetector $mimetypeDetector, |
|
45 | + IMimeTypeLoader $mimetypeLoader |
|
46 | + ) { |
|
47 | + parent::__construct(); |
|
48 | + $this->mimetypeDetector = $mimetypeDetector; |
|
49 | + $this->mimetypeLoader = $mimetypeLoader; |
|
50 | + } |
|
51 | 51 | |
52 | - protected function configure() { |
|
53 | - $this |
|
54 | - ->setName('maintenance:mimetype:update-db') |
|
55 | - ->setDescription('Update database mimetypes and update filecache') |
|
56 | - ->addOption( |
|
57 | - 'repair-filecache', |
|
58 | - null, |
|
59 | - InputOption::VALUE_NONE, |
|
60 | - 'Repair filecache for all mimetypes, not just new ones' |
|
61 | - ) |
|
62 | - ; |
|
63 | - } |
|
52 | + protected function configure() { |
|
53 | + $this |
|
54 | + ->setName('maintenance:mimetype:update-db') |
|
55 | + ->setDescription('Update database mimetypes and update filecache') |
|
56 | + ->addOption( |
|
57 | + 'repair-filecache', |
|
58 | + null, |
|
59 | + InputOption::VALUE_NONE, |
|
60 | + 'Repair filecache for all mimetypes, not just new ones' |
|
61 | + ) |
|
62 | + ; |
|
63 | + } |
|
64 | 64 | |
65 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
66 | - $mappings = $this->mimetypeDetector->getAllMappings(); |
|
65 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
66 | + $mappings = $this->mimetypeDetector->getAllMappings(); |
|
67 | 67 | |
68 | - $totalFilecacheUpdates = 0; |
|
69 | - $totalNewMimetypes = 0; |
|
68 | + $totalFilecacheUpdates = 0; |
|
69 | + $totalNewMimetypes = 0; |
|
70 | 70 | |
71 | - foreach ($mappings as $ext => $mimetypes) { |
|
72 | - if ($ext[0] === '_') { |
|
73 | - // comment |
|
74 | - continue; |
|
75 | - } |
|
76 | - $mimetype = $mimetypes[0]; |
|
77 | - $existing = $this->mimetypeLoader->exists($mimetype); |
|
78 | - // this will add the mimetype if it didn't exist |
|
79 | - $mimetypeId = $this->mimetypeLoader->getId($mimetype); |
|
71 | + foreach ($mappings as $ext => $mimetypes) { |
|
72 | + if ($ext[0] === '_') { |
|
73 | + // comment |
|
74 | + continue; |
|
75 | + } |
|
76 | + $mimetype = $mimetypes[0]; |
|
77 | + $existing = $this->mimetypeLoader->exists($mimetype); |
|
78 | + // this will add the mimetype if it didn't exist |
|
79 | + $mimetypeId = $this->mimetypeLoader->getId($mimetype); |
|
80 | 80 | |
81 | - if (!$existing) { |
|
82 | - $output->writeln('Added mimetype "'.$mimetype.'" to database'); |
|
83 | - $totalNewMimetypes++; |
|
84 | - } |
|
81 | + if (!$existing) { |
|
82 | + $output->writeln('Added mimetype "'.$mimetype.'" to database'); |
|
83 | + $totalNewMimetypes++; |
|
84 | + } |
|
85 | 85 | |
86 | - if (!$existing || $input->getOption('repair-filecache')) { |
|
87 | - $touchedFilecacheRows = $this->mimetypeLoader->updateFilecache($ext, $mimetypeId); |
|
88 | - if ($touchedFilecacheRows > 0) { |
|
89 | - $output->writeln('Updated '.$touchedFilecacheRows.' filecache rows for mimetype "'.$mimetype.'"'); |
|
90 | - } |
|
91 | - $totalFilecacheUpdates += $touchedFilecacheRows; |
|
92 | - } |
|
93 | - } |
|
86 | + if (!$existing || $input->getOption('repair-filecache')) { |
|
87 | + $touchedFilecacheRows = $this->mimetypeLoader->updateFilecache($ext, $mimetypeId); |
|
88 | + if ($touchedFilecacheRows > 0) { |
|
89 | + $output->writeln('Updated '.$touchedFilecacheRows.' filecache rows for mimetype "'.$mimetype.'"'); |
|
90 | + } |
|
91 | + $totalFilecacheUpdates += $touchedFilecacheRows; |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | - $output->writeln('Added '.$totalNewMimetypes.' new mimetypes'); |
|
96 | - $output->writeln('Updated '.$totalFilecacheUpdates.' filecache rows'); |
|
97 | - } |
|
95 | + $output->writeln('Added '.$totalNewMimetypes.' new mimetypes'); |
|
96 | + $output->writeln('Updated '.$totalFilecacheUpdates.' filecache rows'); |
|
97 | + } |
|
98 | 98 | } |
@@ -32,82 +32,82 @@ discard block |
||
32 | 32 | |
33 | 33 | class UpdateJS extends Command { |
34 | 34 | |
35 | - /** @var IMimeTypeDetector */ |
|
36 | - protected $mimetypeDetector; |
|
37 | - |
|
38 | - public function __construct( |
|
39 | - IMimeTypeDetector $mimetypeDetector |
|
40 | - ) { |
|
41 | - parent::__construct(); |
|
42 | - $this->mimetypeDetector = $mimetypeDetector; |
|
43 | - } |
|
44 | - |
|
45 | - protected function configure() { |
|
46 | - $this |
|
47 | - ->setName('maintenance:mimetype:update-js') |
|
48 | - ->setDescription('Update mimetypelist.js'); |
|
49 | - } |
|
50 | - |
|
51 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
52 | - // Fetch all the aliases |
|
53 | - $aliases = $this->mimetypeDetector->getAllAliases(); |
|
54 | - |
|
55 | - // Remove comments |
|
56 | - $keys = array_filter(array_keys($aliases), function($k) { |
|
57 | - return $k[0] === '_'; |
|
58 | - }); |
|
59 | - foreach($keys as $key) { |
|
60 | - unset($aliases[$key]); |
|
61 | - } |
|
62 | - |
|
63 | - // Fetch all files |
|
64 | - $dir = new \DirectoryIterator(\OC::$SERVERROOT.'/core/img/filetypes'); |
|
65 | - |
|
66 | - $files = []; |
|
67 | - foreach($dir as $fileInfo) { |
|
68 | - if ($fileInfo->isFile()) { |
|
69 | - $file = preg_replace('/.[^.]*$/', '', $fileInfo->getFilename()); |
|
70 | - $files[] = $file; |
|
71 | - } |
|
72 | - } |
|
73 | - |
|
74 | - //Remove duplicates |
|
75 | - $files = array_values(array_unique($files)); |
|
76 | - sort($files); |
|
77 | - |
|
78 | - // Fetch all themes! |
|
79 | - $themes = []; |
|
80 | - $dirs = new \DirectoryIterator(\OC::$SERVERROOT.'/themes/'); |
|
81 | - foreach($dirs as $dir) { |
|
82 | - //Valid theme dir |
|
83 | - if ($dir->isFile() || $dir->isDot()) { |
|
84 | - continue; |
|
85 | - } |
|
86 | - |
|
87 | - $theme = $dir->getFilename(); |
|
88 | - $themeDir = $dir->getPath() . '/' . $theme . '/core/img/filetypes/'; |
|
89 | - // Check if this theme has its own filetype icons |
|
90 | - if (!file_exists($themeDir)) { |
|
91 | - continue; |
|
92 | - } |
|
93 | - |
|
94 | - $themes[$theme] = []; |
|
95 | - // Fetch all the theme icons! |
|
96 | - $themeIt = new \DirectoryIterator($themeDir); |
|
97 | - foreach ($themeIt as $fileInfo) { |
|
98 | - if ($fileInfo->isFile()) { |
|
99 | - $file = preg_replace('/.[^.]*$/', '', $fileInfo->getFilename()); |
|
100 | - $themes[$theme][] = $file; |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - //Remove Duplicates |
|
105 | - $themes[$theme] = array_values(array_unique($themes[$theme])); |
|
106 | - sort($themes[$theme]); |
|
107 | - } |
|
108 | - |
|
109 | - //Generate the JS |
|
110 | - $js = '/** |
|
35 | + /** @var IMimeTypeDetector */ |
|
36 | + protected $mimetypeDetector; |
|
37 | + |
|
38 | + public function __construct( |
|
39 | + IMimeTypeDetector $mimetypeDetector |
|
40 | + ) { |
|
41 | + parent::__construct(); |
|
42 | + $this->mimetypeDetector = $mimetypeDetector; |
|
43 | + } |
|
44 | + |
|
45 | + protected function configure() { |
|
46 | + $this |
|
47 | + ->setName('maintenance:mimetype:update-js') |
|
48 | + ->setDescription('Update mimetypelist.js'); |
|
49 | + } |
|
50 | + |
|
51 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
52 | + // Fetch all the aliases |
|
53 | + $aliases = $this->mimetypeDetector->getAllAliases(); |
|
54 | + |
|
55 | + // Remove comments |
|
56 | + $keys = array_filter(array_keys($aliases), function($k) { |
|
57 | + return $k[0] === '_'; |
|
58 | + }); |
|
59 | + foreach($keys as $key) { |
|
60 | + unset($aliases[$key]); |
|
61 | + } |
|
62 | + |
|
63 | + // Fetch all files |
|
64 | + $dir = new \DirectoryIterator(\OC::$SERVERROOT.'/core/img/filetypes'); |
|
65 | + |
|
66 | + $files = []; |
|
67 | + foreach($dir as $fileInfo) { |
|
68 | + if ($fileInfo->isFile()) { |
|
69 | + $file = preg_replace('/.[^.]*$/', '', $fileInfo->getFilename()); |
|
70 | + $files[] = $file; |
|
71 | + } |
|
72 | + } |
|
73 | + |
|
74 | + //Remove duplicates |
|
75 | + $files = array_values(array_unique($files)); |
|
76 | + sort($files); |
|
77 | + |
|
78 | + // Fetch all themes! |
|
79 | + $themes = []; |
|
80 | + $dirs = new \DirectoryIterator(\OC::$SERVERROOT.'/themes/'); |
|
81 | + foreach($dirs as $dir) { |
|
82 | + //Valid theme dir |
|
83 | + if ($dir->isFile() || $dir->isDot()) { |
|
84 | + continue; |
|
85 | + } |
|
86 | + |
|
87 | + $theme = $dir->getFilename(); |
|
88 | + $themeDir = $dir->getPath() . '/' . $theme . '/core/img/filetypes/'; |
|
89 | + // Check if this theme has its own filetype icons |
|
90 | + if (!file_exists($themeDir)) { |
|
91 | + continue; |
|
92 | + } |
|
93 | + |
|
94 | + $themes[$theme] = []; |
|
95 | + // Fetch all the theme icons! |
|
96 | + $themeIt = new \DirectoryIterator($themeDir); |
|
97 | + foreach ($themeIt as $fileInfo) { |
|
98 | + if ($fileInfo->isFile()) { |
|
99 | + $file = preg_replace('/.[^.]*$/', '', $fileInfo->getFilename()); |
|
100 | + $themes[$theme][] = $file; |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + //Remove Duplicates |
|
105 | + $themes[$theme] = array_values(array_unique($themes[$theme])); |
|
106 | + sort($themes[$theme]); |
|
107 | + } |
|
108 | + |
|
109 | + //Generate the JS |
|
110 | + $js = '/** |
|
111 | 111 | * This file is automatically generated |
112 | 112 | * DO NOT EDIT MANUALLY! |
113 | 113 | * |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | }; |
123 | 123 | '; |
124 | 124 | |
125 | - //Output the JS |
|
126 | - file_put_contents(\OC::$SERVERROOT.'/core/js/mimetypelist.js', $js); |
|
125 | + //Output the JS |
|
126 | + file_put_contents(\OC::$SERVERROOT.'/core/js/mimetypelist.js', $js); |
|
127 | 127 | |
128 | - $output->writeln('<info>mimetypelist.js is updated'); |
|
129 | - } |
|
128 | + $output->writeln('<info>mimetypelist.js is updated'); |
|
129 | + } |
|
130 | 130 | } |
@@ -29,48 +29,48 @@ |
||
29 | 29 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 30 | |
31 | 31 | class GetPath extends Base { |
32 | - protected function configure() { |
|
33 | - parent::configure(); |
|
32 | + protected function configure() { |
|
33 | + parent::configure(); |
|
34 | 34 | |
35 | - $this |
|
36 | - ->setName('app:getpath') |
|
37 | - ->setDescription('Get an absolute path to the app directory') |
|
38 | - ->addArgument( |
|
39 | - 'app', |
|
40 | - InputArgument::REQUIRED, |
|
41 | - 'Name of the app' |
|
42 | - ) |
|
43 | - ; |
|
44 | - } |
|
35 | + $this |
|
36 | + ->setName('app:getpath') |
|
37 | + ->setDescription('Get an absolute path to the app directory') |
|
38 | + ->addArgument( |
|
39 | + 'app', |
|
40 | + InputArgument::REQUIRED, |
|
41 | + 'Name of the app' |
|
42 | + ) |
|
43 | + ; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Executes the current command. |
|
48 | - * |
|
49 | - * @param InputInterface $input An InputInterface instance |
|
50 | - * @param OutputInterface $output An OutputInterface instance |
|
51 | - * @return null|int null or 0 if everything went fine, or an error code |
|
52 | - */ |
|
53 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
54 | - $appName = $input->getArgument('app'); |
|
55 | - $path = \OC_App::getAppPath($appName); |
|
56 | - if ($path !== false) { |
|
57 | - $output->writeln($path); |
|
58 | - return 0; |
|
59 | - } |
|
46 | + /** |
|
47 | + * Executes the current command. |
|
48 | + * |
|
49 | + * @param InputInterface $input An InputInterface instance |
|
50 | + * @param OutputInterface $output An OutputInterface instance |
|
51 | + * @return null|int null or 0 if everything went fine, or an error code |
|
52 | + */ |
|
53 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
54 | + $appName = $input->getArgument('app'); |
|
55 | + $path = \OC_App::getAppPath($appName); |
|
56 | + if ($path !== false) { |
|
57 | + $output->writeln($path); |
|
58 | + return 0; |
|
59 | + } |
|
60 | 60 | |
61 | - // App not found, exit with non-zero |
|
62 | - return 1; |
|
63 | - } |
|
61 | + // App not found, exit with non-zero |
|
62 | + return 1; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @param string $argumentName |
|
67 | - * @param CompletionContext $context |
|
68 | - * @return string[] |
|
69 | - */ |
|
70 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
71 | - if ($argumentName === 'app') { |
|
72 | - return \OC_App::getAllApps(); |
|
73 | - } |
|
74 | - return []; |
|
75 | - } |
|
65 | + /** |
|
66 | + * @param string $argumentName |
|
67 | + * @param CompletionContext $context |
|
68 | + * @return string[] |
|
69 | + */ |
|
70 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
71 | + if ($argumentName === 'app') { |
|
72 | + return \OC_App::getAllApps(); |
|
73 | + } |
|
74 | + return []; |
|
75 | + } |
|
76 | 76 | } |
@@ -30,30 +30,30 @@ |
||
30 | 30 | |
31 | 31 | class ShowKeyStorageRoot extends Command{ |
32 | 32 | |
33 | - /** @var Util */ |
|
34 | - protected $util; |
|
35 | - |
|
36 | - /** |
|
37 | - * @param Util $util |
|
38 | - */ |
|
39 | - public function __construct(Util $util) { |
|
40 | - parent::__construct(); |
|
41 | - $this->util = $util; |
|
42 | - } |
|
43 | - |
|
44 | - protected function configure() { |
|
45 | - parent::configure(); |
|
46 | - $this |
|
47 | - ->setName('encryption:show-key-storage-root') |
|
48 | - ->setDescription('Show current key storage root'); |
|
49 | - } |
|
50 | - |
|
51 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
52 | - $currentRoot = $this->util->getKeyStorageRoot(); |
|
53 | - |
|
54 | - $rootDescription = $currentRoot !== '' ? $currentRoot : 'default storage location (data/)'; |
|
55 | - |
|
56 | - $output->writeln("Current key storage root: <info>$rootDescription</info>"); |
|
57 | - } |
|
33 | + /** @var Util */ |
|
34 | + protected $util; |
|
35 | + |
|
36 | + /** |
|
37 | + * @param Util $util |
|
38 | + */ |
|
39 | + public function __construct(Util $util) { |
|
40 | + parent::__construct(); |
|
41 | + $this->util = $util; |
|
42 | + } |
|
43 | + |
|
44 | + protected function configure() { |
|
45 | + parent::configure(); |
|
46 | + $this |
|
47 | + ->setName('encryption:show-key-storage-root') |
|
48 | + ->setDescription('Show current key storage root'); |
|
49 | + } |
|
50 | + |
|
51 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
52 | + $currentRoot = $this->util->getKeyStorageRoot(); |
|
53 | + |
|
54 | + $rootDescription = $currentRoot !== '' ? $currentRoot : 'default storage location (data/)'; |
|
55 | + |
|
56 | + $output->writeln("Current key storage root: <info>$rootDescription</info>"); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | } |
@@ -29,51 +29,51 @@ |
||
29 | 29 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 30 | |
31 | 31 | class Enable extends Command { |
32 | - /** @var IConfig */ |
|
33 | - protected $config; |
|
32 | + /** @var IConfig */ |
|
33 | + protected $config; |
|
34 | 34 | |
35 | - /** @var IManager */ |
|
36 | - protected $encryptionManager; |
|
35 | + /** @var IManager */ |
|
36 | + protected $encryptionManager; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param IConfig $config |
|
40 | - * @param IManager $encryptionManager |
|
41 | - */ |
|
42 | - public function __construct(IConfig $config, IManager $encryptionManager) { |
|
43 | - parent::__construct(); |
|
38 | + /** |
|
39 | + * @param IConfig $config |
|
40 | + * @param IManager $encryptionManager |
|
41 | + */ |
|
42 | + public function __construct(IConfig $config, IManager $encryptionManager) { |
|
43 | + parent::__construct(); |
|
44 | 44 | |
45 | - $this->encryptionManager = $encryptionManager; |
|
46 | - $this->config = $config; |
|
47 | - } |
|
45 | + $this->encryptionManager = $encryptionManager; |
|
46 | + $this->config = $config; |
|
47 | + } |
|
48 | 48 | |
49 | - protected function configure() { |
|
50 | - $this |
|
51 | - ->setName('encryption:enable') |
|
52 | - ->setDescription('Enable encryption') |
|
53 | - ; |
|
54 | - } |
|
49 | + protected function configure() { |
|
50 | + $this |
|
51 | + ->setName('encryption:enable') |
|
52 | + ->setDescription('Enable encryption') |
|
53 | + ; |
|
54 | + } |
|
55 | 55 | |
56 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
57 | - if ($this->config->getAppValue('core', 'encryption_enabled', 'no') === 'yes') { |
|
58 | - $output->writeln('Encryption is already enabled'); |
|
59 | - } else { |
|
60 | - $this->config->setAppValue('core', 'encryption_enabled', 'yes'); |
|
61 | - $output->writeln('<info>Encryption enabled</info>'); |
|
62 | - } |
|
63 | - $output->writeln(''); |
|
56 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
57 | + if ($this->config->getAppValue('core', 'encryption_enabled', 'no') === 'yes') { |
|
58 | + $output->writeln('Encryption is already enabled'); |
|
59 | + } else { |
|
60 | + $this->config->setAppValue('core', 'encryption_enabled', 'yes'); |
|
61 | + $output->writeln('<info>Encryption enabled</info>'); |
|
62 | + } |
|
63 | + $output->writeln(''); |
|
64 | 64 | |
65 | - $modules = $this->encryptionManager->getEncryptionModules(); |
|
66 | - if (empty($modules)) { |
|
67 | - $output->writeln('<error>No encryption module is loaded</error>'); |
|
68 | - } else { |
|
69 | - $defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null); |
|
70 | - if ($defaultModule === null) { |
|
71 | - $output->writeln('<error>No default module is set</error>'); |
|
72 | - } else if (!isset($modules[$defaultModule])) { |
|
73 | - $output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>'); |
|
74 | - } else { |
|
75 | - $output->writeln('Default module: ' . $defaultModule); |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
65 | + $modules = $this->encryptionManager->getEncryptionModules(); |
|
66 | + if (empty($modules)) { |
|
67 | + $output->writeln('<error>No encryption module is loaded</error>'); |
|
68 | + } else { |
|
69 | + $defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null); |
|
70 | + if ($defaultModule === null) { |
|
71 | + $output->writeln('<error>No default module is set</error>'); |
|
72 | + } else if (!isset($modules[$defaultModule])) { |
|
73 | + $output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>'); |
|
74 | + } else { |
|
75 | + $output->writeln('Default module: ' . $defaultModule); |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | 79 | } |