1 | <?php |
||
28 | class CheckSystemCommand extends Command { |
||
29 | |||
30 | protected $message = 'Checking system health.'; |
||
31 | |||
32 | protected function configure(){ |
||
38 | |||
39 | protected function execute(InputInterface $input, OutputInterface $output){ |
||
40 | $locator = $this->container['utils.locator']; |
||
41 | $fsHelper = $this->container['utils.filesystemhelper']; |
||
42 | /** @var \Owncloud\Updater\Utils\Registry $registry */ |
||
43 | $registry = $this->container['utils.registry']; |
||
44 | /** @var \Owncloud\Updater\Utils\AppManager $occRunner */ |
||
45 | $appManager = $this->container['utils.appmanager']; |
||
46 | $registry->set( |
||
47 | 'notShippedApps', |
||
48 | $appManager->getNotShippedApps() |
||
49 | ); |
||
50 | $occRunner = $this->container['utils.occrunner']; |
||
|
|||
51 | |||
52 | $collection = new Collection(); |
||
53 | |||
54 | $rootDirItems= $locator->getRootDirItems(); |
||
55 | foreach ($rootDirItems as $item){ |
||
56 | $fsHelper->checkr($item, $collection); |
||
57 | } |
||
58 | $notReadableFiles = $collection->getNotReadable(); |
||
59 | $notWritableFiles = $collection->getNotWritable(); |
||
60 | |||
61 | if (count($notReadableFiles)){ |
||
62 | $output->writeln('<error>The following files and directories are not readable:</error>'); |
||
63 | $output->writeln($this->longArrayToString($notReadableFiles)); |
||
64 | } |
||
65 | |||
66 | if (count($notWritableFiles)){ |
||
67 | $output->writeln('<error>The following files and directories are not writable:</error>'); |
||
68 | $output->writeln($this->longArrayToString($notWritableFiles)); |
||
69 | } |
||
70 | |||
71 | if (count($notReadableFiles) || count($notWritableFiles)){ |
||
72 | $output->writeln('<info>Please check if owner and permissions for these files are correct.</info>'); |
||
73 | $output->writeln('<info>See https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#strong-perms-label for details.</info>'); |
||
74 | return 2; |
||
75 | } else { |
||
76 | $output->writeln(' - file permissions are ok.'); |
||
77 | } |
||
78 | } |
||
79 | |||
80 | protected function longArrayToString($array){ |
||
91 | |||
92 | } |
||
93 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.