1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Matthew Setter <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2018, ownCloud GmbH |
6
|
|
|
* @license AGPL-3.0 |
7
|
|
|
* |
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
10
|
|
|
* as published by the Free Software Foundation. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace OC\Core\Command\App; |
23
|
|
|
|
24
|
|
|
use OC\Core\Command\Base; |
25
|
|
|
use OCP\App\IAppManager; |
26
|
|
|
use OCP\IConfig; |
27
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
28
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
29
|
|
|
use Symfony\Component\Console\Input\InputOption; |
30
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
31
|
|
|
|
32
|
|
|
class MoveApps extends Base { |
33
|
|
|
|
34
|
|
|
/** @var IAppManager */ |
35
|
|
|
protected $manager; |
36
|
|
|
|
37
|
|
|
/** * @var IConfig */ |
38
|
|
|
private $config; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param IAppManager $manager |
42
|
|
|
* @param IConfig $config |
43
|
|
|
*/ |
44
|
|
|
public function __construct(IAppManager $manager, IConfig $config) { |
45
|
|
|
parent::__construct(); |
46
|
|
|
|
47
|
|
|
$this->manager = $manager; |
48
|
|
|
$this->config = $config; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
protected function configure() { |
52
|
|
|
parent::configure(); |
53
|
|
|
|
54
|
|
|
$this |
55
|
|
|
->setName('app:move') |
56
|
|
|
->setDescription('Move apps from the core apps directory to a non-core apps directory.') |
57
|
|
|
->addArgument( |
58
|
|
|
'listNonCoreDirectories', |
59
|
|
|
InputArgument::OPTIONAL, |
60
|
|
|
'List any non-core app directories' |
61
|
|
|
) |
62
|
|
|
; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param InputInterface $input |
67
|
|
|
* @param OutputInterface $output |
68
|
|
|
* @return int|null|void |
69
|
|
|
*/ |
70
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) { |
71
|
|
|
if ($input->hasArgument('listNonCoreDirectories')) { |
72
|
|
|
$this->writeNonAppDirectories($input, $output); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param InputInterface $input |
78
|
|
|
* @param OutputInterface $output |
79
|
|
|
* @param array $items |
|
|
|
|
80
|
|
|
*/ |
81
|
|
|
protected function writeNonAppDirectories(InputInterface $input, OutputInterface $output) { |
82
|
|
|
$appPaths = $this->config->getSystemValue('apps_paths'); |
83
|
|
|
$output->writeln('Non-App Directories:'); |
84
|
|
|
$directories = []; |
85
|
|
|
foreach ($appPaths as $path) { |
86
|
|
|
if ($path['url'] !== '/apps' && $path['writable'] === true) { |
87
|
|
|
$directories[] = sprintf("%s -> %s", $path['url'], $path['path']); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
parent::writeArrayInOutputFormat($input, $output, $directories); |
|
|
|
|
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.