@@ -49,143 +49,143 @@ |
||
49 | 49 | $application->add(new OC\Core\Command\App\CheckCode()); |
50 | 50 | $application->add(new OC\Core\Command\L10n\CreateJs()); |
51 | 51 | $application->add(new \OC\Core\Command\Integrity\SignApp( |
52 | - \OC::$server->getIntegrityCodeChecker(), |
|
53 | - new \OC\IntegrityCheck\Helpers\FileAccessHelper(), |
|
54 | - \OC::$server->getURLGenerator() |
|
52 | + \OC::$server->getIntegrityCodeChecker(), |
|
53 | + new \OC\IntegrityCheck\Helpers\FileAccessHelper(), |
|
54 | + \OC::$server->getURLGenerator() |
|
55 | 55 | )); |
56 | 56 | $application->add(new \OC\Core\Command\Integrity\SignCore( |
57 | - \OC::$server->getIntegrityCodeChecker(), |
|
58 | - new \OC\IntegrityCheck\Helpers\FileAccessHelper() |
|
57 | + \OC::$server->getIntegrityCodeChecker(), |
|
58 | + new \OC\IntegrityCheck\Helpers\FileAccessHelper() |
|
59 | 59 | )); |
60 | 60 | $application->add(new \OC\Core\Command\Integrity\CheckApp( |
61 | - \OC::$server->getIntegrityCodeChecker() |
|
61 | + \OC::$server->getIntegrityCodeChecker() |
|
62 | 62 | )); |
63 | 63 | $application->add(new \OC\Core\Command\Integrity\CheckCore( |
64 | - \OC::$server->getIntegrityCodeChecker() |
|
64 | + \OC::$server->getIntegrityCodeChecker() |
|
65 | 65 | )); |
66 | 66 | |
67 | 67 | |
68 | 68 | if (\OC::$server->getConfig()->getSystemValue('installed', false)) { |
69 | - $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); |
|
70 | - $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager())); |
|
71 | - $application->add(new OC\Core\Command\App\Install()); |
|
72 | - $application->add(new OC\Core\Command\App\GetPath()); |
|
73 | - $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); |
|
74 | - $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger())); |
|
75 | - $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class)); |
|
76 | - |
|
77 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class)); |
|
78 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class)); |
|
79 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class)); |
|
80 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class)); |
|
81 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class)); |
|
82 | - |
|
83 | - $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig())); |
|
84 | - $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); |
|
85 | - $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); |
|
86 | - |
|
87 | - $application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class)); |
|
88 | - |
|
89 | - $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig())); |
|
90 | - $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig())); |
|
91 | - $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig())); |
|
92 | - $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig())); |
|
93 | - $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig())); |
|
94 | - $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig())); |
|
95 | - $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig())); |
|
96 | - $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig())); |
|
97 | - |
|
98 | - $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); |
|
99 | - $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); |
|
100 | - $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); |
|
101 | - $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
102 | - $application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
103 | - $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); |
|
104 | - $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); |
|
105 | - $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager())); |
|
106 | - $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection())); |
|
107 | - $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig())); |
|
108 | - |
|
109 | - $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); |
|
110 | - $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); |
|
111 | - $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig())); |
|
112 | - $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig())); |
|
113 | - $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager())); |
|
114 | - $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper())); |
|
115 | - $application->add(new OC\Core\Command\Encryption\DecryptAll( |
|
116 | - \OC::$server->getEncryptionManager(), |
|
117 | - \OC::$server->getAppManager(), |
|
118 | - \OC::$server->getConfig(), |
|
119 | - new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()), |
|
120 | - new \Symfony\Component\Console\Helper\QuestionHelper()) |
|
121 | - ); |
|
122 | - |
|
123 | - $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig())); |
|
124 | - $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig())); |
|
125 | - |
|
126 | - $view = new \OC\Files\View(); |
|
127 | - $util = new \OC\Encryption\Util( |
|
128 | - $view, |
|
129 | - \OC::$server->getUserManager(), |
|
130 | - \OC::$server->getGroupManager(), |
|
131 | - \OC::$server->getConfig() |
|
132 | - ); |
|
133 | - $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot( |
|
134 | - $view, |
|
135 | - \OC::$server->getUserManager(), |
|
136 | - \OC::$server->getConfig(), |
|
137 | - $util, |
|
138 | - new \Symfony\Component\Console\Helper\QuestionHelper() |
|
139 | - ) |
|
140 | - ); |
|
141 | - $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util)); |
|
142 | - $application->add(new OC\Core\Command\Encryption\MigrateKeyStorage( |
|
143 | - $view, |
|
144 | - \OC::$server->getUserManager(), |
|
145 | - \OC::$server->getConfig(), |
|
146 | - $util, |
|
147 | - \OC::$server->getCrypto() |
|
148 | - ) |
|
149 | - ); |
|
150 | - |
|
151 | - $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory())); |
|
152 | - $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader())); |
|
153 | - $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector())); |
|
154 | - $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); |
|
155 | - $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); |
|
156 | - $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); |
|
157 | - |
|
158 | - $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class))); |
|
159 | - $application->add(new OC\Core\Command\Maintenance\Repair( |
|
160 | - new \OC\Repair([], \OC::$server->getEventDispatcher()), |
|
161 | - \OC::$server->getConfig(), |
|
162 | - \OC::$server->getEventDispatcher(), |
|
163 | - \OC::$server->getAppManager() |
|
164 | - )); |
|
165 | - |
|
166 | - $application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class)); |
|
167 | - |
|
168 | - $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
169 | - $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); |
|
170 | - $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); |
|
171 | - $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); |
|
172 | - $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); |
|
173 | - $application->add(\OC::$server->get(\OC\Core\Command\User\Report::class)); |
|
174 | - $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); |
|
175 | - $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); |
|
176 | - $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
177 | - $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
178 | - |
|
179 | - $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager())); |
|
180 | - $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager())); |
|
181 | - $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager())); |
|
182 | - $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
183 | - $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
184 | - |
|
185 | - $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core'))); |
|
186 | - $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null))); |
|
187 | - $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null))); |
|
188 | - $application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler())); |
|
69 | + $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); |
|
70 | + $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager())); |
|
71 | + $application->add(new OC\Core\Command\App\Install()); |
|
72 | + $application->add(new OC\Core\Command\App\GetPath()); |
|
73 | + $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); |
|
74 | + $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger())); |
|
75 | + $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class)); |
|
76 | + |
|
77 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class)); |
|
78 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class)); |
|
79 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class)); |
|
80 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class)); |
|
81 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class)); |
|
82 | + |
|
83 | + $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig())); |
|
84 | + $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); |
|
85 | + $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); |
|
86 | + |
|
87 | + $application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class)); |
|
88 | + |
|
89 | + $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig())); |
|
90 | + $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig())); |
|
91 | + $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig())); |
|
92 | + $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig())); |
|
93 | + $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig())); |
|
94 | + $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig())); |
|
95 | + $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig())); |
|
96 | + $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig())); |
|
97 | + |
|
98 | + $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); |
|
99 | + $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); |
|
100 | + $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); |
|
101 | + $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
102 | + $application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
103 | + $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); |
|
104 | + $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); |
|
105 | + $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager())); |
|
106 | + $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection())); |
|
107 | + $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig())); |
|
108 | + |
|
109 | + $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); |
|
110 | + $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); |
|
111 | + $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig())); |
|
112 | + $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig())); |
|
113 | + $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager())); |
|
114 | + $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper())); |
|
115 | + $application->add(new OC\Core\Command\Encryption\DecryptAll( |
|
116 | + \OC::$server->getEncryptionManager(), |
|
117 | + \OC::$server->getAppManager(), |
|
118 | + \OC::$server->getConfig(), |
|
119 | + new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()), |
|
120 | + new \Symfony\Component\Console\Helper\QuestionHelper()) |
|
121 | + ); |
|
122 | + |
|
123 | + $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig())); |
|
124 | + $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig())); |
|
125 | + |
|
126 | + $view = new \OC\Files\View(); |
|
127 | + $util = new \OC\Encryption\Util( |
|
128 | + $view, |
|
129 | + \OC::$server->getUserManager(), |
|
130 | + \OC::$server->getGroupManager(), |
|
131 | + \OC::$server->getConfig() |
|
132 | + ); |
|
133 | + $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot( |
|
134 | + $view, |
|
135 | + \OC::$server->getUserManager(), |
|
136 | + \OC::$server->getConfig(), |
|
137 | + $util, |
|
138 | + new \Symfony\Component\Console\Helper\QuestionHelper() |
|
139 | + ) |
|
140 | + ); |
|
141 | + $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util)); |
|
142 | + $application->add(new OC\Core\Command\Encryption\MigrateKeyStorage( |
|
143 | + $view, |
|
144 | + \OC::$server->getUserManager(), |
|
145 | + \OC::$server->getConfig(), |
|
146 | + $util, |
|
147 | + \OC::$server->getCrypto() |
|
148 | + ) |
|
149 | + ); |
|
150 | + |
|
151 | + $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory())); |
|
152 | + $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader())); |
|
153 | + $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector())); |
|
154 | + $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); |
|
155 | + $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); |
|
156 | + $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); |
|
157 | + |
|
158 | + $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class))); |
|
159 | + $application->add(new OC\Core\Command\Maintenance\Repair( |
|
160 | + new \OC\Repair([], \OC::$server->getEventDispatcher()), |
|
161 | + \OC::$server->getConfig(), |
|
162 | + \OC::$server->getEventDispatcher(), |
|
163 | + \OC::$server->getAppManager() |
|
164 | + )); |
|
165 | + |
|
166 | + $application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class)); |
|
167 | + |
|
168 | + $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
169 | + $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); |
|
170 | + $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); |
|
171 | + $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); |
|
172 | + $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); |
|
173 | + $application->add(\OC::$server->get(\OC\Core\Command\User\Report::class)); |
|
174 | + $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); |
|
175 | + $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); |
|
176 | + $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
177 | + $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
178 | + |
|
179 | + $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager())); |
|
180 | + $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager())); |
|
181 | + $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager())); |
|
182 | + $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
183 | + $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
184 | + |
|
185 | + $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core'))); |
|
186 | + $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null))); |
|
187 | + $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null))); |
|
188 | + $application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler())); |
|
189 | 189 | } else { |
190 | - $application->add(\OC::$server->get(\OC\Core\Command\Maintenance\Install::class)); |
|
190 | + $application->add(\OC::$server->get(\OC\Core\Command\Maintenance\Install::class)); |
|
191 | 191 | } |
@@ -47,166 +47,166 @@ |
||
47 | 47 | |
48 | 48 | class Install extends Command { |
49 | 49 | |
50 | - /** @var SystemConfig */ |
|
51 | - private $config; |
|
52 | - /** @var IniGetWrapper */ |
|
53 | - private $iniGetWrapper; |
|
54 | - |
|
55 | - public function __construct(SystemConfig $config, IniGetWrapper $iniGetWrapper) { |
|
56 | - parent::__construct(); |
|
57 | - $this->config = $config; |
|
58 | - $this->iniGetWrapper = $iniGetWrapper; |
|
59 | - } |
|
60 | - |
|
61 | - protected function configure() { |
|
62 | - $this |
|
63 | - ->setName('maintenance:install') |
|
64 | - ->setDescription('install Nextcloud') |
|
65 | - ->addOption('database', null, InputOption::VALUE_REQUIRED, 'Supported database type', 'sqlite') |
|
66 | - ->addOption('database-name', null, InputOption::VALUE_REQUIRED, 'Name of the database') |
|
67 | - ->addOption('database-host', null, InputOption::VALUE_REQUIRED, 'Hostname of the database', 'localhost') |
|
68 | - ->addOption('database-port', null, InputOption::VALUE_REQUIRED, 'Port the database is listening on') |
|
69 | - ->addOption('database-user', null, InputOption::VALUE_REQUIRED, 'User name to connect to the database') |
|
70 | - ->addOption('database-pass', null, InputOption::VALUE_OPTIONAL, 'Password of the database user', null) |
|
71 | - ->addOption('database-table-space', null, InputOption::VALUE_OPTIONAL, 'Table space of the database (oci only)', null) |
|
72 | - ->addOption('admin-user', null, InputOption::VALUE_REQUIRED, 'User name of the admin account', 'admin') |
|
73 | - ->addOption('admin-pass', null, InputOption::VALUE_REQUIRED, 'Password of the admin account') |
|
74 | - ->addOption('admin-email', null, InputOption::VALUE_OPTIONAL, 'E-Mail of the admin account') |
|
75 | - ->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT."/data"); |
|
76 | - } |
|
77 | - |
|
78 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
79 | - |
|
80 | - // validate the environment |
|
81 | - $server = \OC::$server; |
|
82 | - $setupHelper = new Setup( |
|
83 | - $this->config, |
|
84 | - $this->iniGetWrapper, |
|
85 | - $server->getL10N('lib'), |
|
86 | - $server->query(Defaults::class), |
|
87 | - $server->getLogger(), |
|
88 | - $server->getSecureRandom(), |
|
89 | - \OC::$server->query(Installer::class) |
|
90 | - ); |
|
91 | - $sysInfo = $setupHelper->getSystemInfo(true); |
|
92 | - $errors = $sysInfo['errors']; |
|
93 | - if (count($errors) > 0) { |
|
94 | - $this->printErrors($output, $errors); |
|
95 | - |
|
96 | - // ignore the OS X setup warning |
|
97 | - if (count($errors) !== 1 || |
|
98 | - (string)$errors[0]['error'] !== 'Mac OS X is not supported and Nextcloud will not work properly on this platform. Use it at your own risk! ') { |
|
99 | - return 1; |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - // validate user input |
|
104 | - $options = $this->validateInput($input, $output, array_keys($sysInfo['databases'])); |
|
105 | - |
|
106 | - // perform installation |
|
107 | - $errors = $setupHelper->install($options); |
|
108 | - if (count($errors) > 0) { |
|
109 | - $this->printErrors($output, $errors); |
|
110 | - return 1; |
|
111 | - } |
|
112 | - $output->writeln("Nextcloud was successfully installed"); |
|
113 | - return 0; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @param InputInterface $input |
|
118 | - * @param OutputInterface $output |
|
119 | - * @param string[] $supportedDatabases |
|
120 | - * @return array |
|
121 | - */ |
|
122 | - protected function validateInput(InputInterface $input, OutputInterface $output, $supportedDatabases) { |
|
123 | - $db = strtolower($input->getOption('database')); |
|
124 | - |
|
125 | - if (!in_array($db, $supportedDatabases)) { |
|
126 | - throw new InvalidArgumentException("Database <$db> is not supported."); |
|
127 | - } |
|
128 | - |
|
129 | - $dbUser = $input->getOption('database-user'); |
|
130 | - $dbPass = $input->getOption('database-pass'); |
|
131 | - $dbName = $input->getOption('database-name'); |
|
132 | - $dbPort = $input->getOption('database-port'); |
|
133 | - if ($db === 'oci') { |
|
134 | - // an empty hostname needs to be read from the raw parameters |
|
135 | - $dbHost = $input->getParameterOption('--database-host', ''); |
|
136 | - } else { |
|
137 | - $dbHost = $input->getOption('database-host'); |
|
138 | - } |
|
139 | - if ($dbPort) { |
|
140 | - // Append the port to the host so it is the same as in the config (there is no dbport config) |
|
141 | - $dbHost .= ':' . $dbPort; |
|
142 | - } |
|
143 | - if ($input->hasParameterOption('--database-pass')) { |
|
144 | - $dbPass = (string) $input->getOption('database-pass'); |
|
145 | - } |
|
146 | - $adminLogin = $input->getOption('admin-user'); |
|
147 | - $adminPassword = $input->getOption('admin-pass'); |
|
148 | - $adminEmail = $input->getOption('admin-email'); |
|
149 | - $dataDir = $input->getOption('data-dir'); |
|
150 | - |
|
151 | - if ($db !== 'sqlite') { |
|
152 | - if (is_null($dbUser)) { |
|
153 | - throw new InvalidArgumentException("Database user not provided."); |
|
154 | - } |
|
155 | - if (is_null($dbName)) { |
|
156 | - throw new InvalidArgumentException("Database name not provided."); |
|
157 | - } |
|
158 | - if (is_null($dbPass)) { |
|
159 | - /** @var QuestionHelper $helper */ |
|
160 | - $helper = $this->getHelper('question'); |
|
161 | - $question = new Question('What is the password to access the database with user <'.$dbUser.'>?'); |
|
162 | - $question->setHidden(true); |
|
163 | - $question->setHiddenFallback(false); |
|
164 | - $dbPass = $helper->ask($input, $output, $question); |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - if (is_null($adminPassword)) { |
|
169 | - /** @var QuestionHelper $helper */ |
|
170 | - $helper = $this->getHelper('question'); |
|
171 | - $question = new Question('What is the password you like to use for the admin account <'.$adminLogin.'>?'); |
|
172 | - $question->setHidden(true); |
|
173 | - $question->setHiddenFallback(false); |
|
174 | - $adminPassword = $helper->ask($input, $output, $question); |
|
175 | - } |
|
176 | - |
|
177 | - if ($adminEmail !== null && !filter_var($adminEmail, FILTER_VALIDATE_EMAIL)) { |
|
178 | - throw new InvalidArgumentException('Invalid e-mail-address <' . $adminEmail . '> for <' . $adminLogin . '>.'); |
|
179 | - } |
|
180 | - |
|
181 | - $options = [ |
|
182 | - 'dbtype' => $db, |
|
183 | - 'dbuser' => $dbUser, |
|
184 | - 'dbpass' => $dbPass, |
|
185 | - 'dbname' => $dbName, |
|
186 | - 'dbhost' => $dbHost, |
|
187 | - 'adminlogin' => $adminLogin, |
|
188 | - 'adminpass' => $adminPassword, |
|
189 | - 'adminemail' => $adminEmail, |
|
190 | - 'directory' => $dataDir |
|
191 | - ]; |
|
192 | - if ($db === 'oci') { |
|
193 | - $options['dbtablespace'] = $input->getParameterOption('--database-table-space', ''); |
|
194 | - } |
|
195 | - return $options; |
|
196 | - } |
|
197 | - |
|
198 | - /** |
|
199 | - * @param OutputInterface $output |
|
200 | - * @param $errors |
|
201 | - */ |
|
202 | - protected function printErrors(OutputInterface $output, $errors) { |
|
203 | - foreach ($errors as $error) { |
|
204 | - if (is_array($error)) { |
|
205 | - $output->writeln('<error>' . (string)$error['error'] . '</error>'); |
|
206 | - $output->writeln('<info> -> ' . (string)$error['hint'] . '</info>'); |
|
207 | - } else { |
|
208 | - $output->writeln('<error>' . (string)$error . '</error>'); |
|
209 | - } |
|
210 | - } |
|
211 | - } |
|
50 | + /** @var SystemConfig */ |
|
51 | + private $config; |
|
52 | + /** @var IniGetWrapper */ |
|
53 | + private $iniGetWrapper; |
|
54 | + |
|
55 | + public function __construct(SystemConfig $config, IniGetWrapper $iniGetWrapper) { |
|
56 | + parent::__construct(); |
|
57 | + $this->config = $config; |
|
58 | + $this->iniGetWrapper = $iniGetWrapper; |
|
59 | + } |
|
60 | + |
|
61 | + protected function configure() { |
|
62 | + $this |
|
63 | + ->setName('maintenance:install') |
|
64 | + ->setDescription('install Nextcloud') |
|
65 | + ->addOption('database', null, InputOption::VALUE_REQUIRED, 'Supported database type', 'sqlite') |
|
66 | + ->addOption('database-name', null, InputOption::VALUE_REQUIRED, 'Name of the database') |
|
67 | + ->addOption('database-host', null, InputOption::VALUE_REQUIRED, 'Hostname of the database', 'localhost') |
|
68 | + ->addOption('database-port', null, InputOption::VALUE_REQUIRED, 'Port the database is listening on') |
|
69 | + ->addOption('database-user', null, InputOption::VALUE_REQUIRED, 'User name to connect to the database') |
|
70 | + ->addOption('database-pass', null, InputOption::VALUE_OPTIONAL, 'Password of the database user', null) |
|
71 | + ->addOption('database-table-space', null, InputOption::VALUE_OPTIONAL, 'Table space of the database (oci only)', null) |
|
72 | + ->addOption('admin-user', null, InputOption::VALUE_REQUIRED, 'User name of the admin account', 'admin') |
|
73 | + ->addOption('admin-pass', null, InputOption::VALUE_REQUIRED, 'Password of the admin account') |
|
74 | + ->addOption('admin-email', null, InputOption::VALUE_OPTIONAL, 'E-Mail of the admin account') |
|
75 | + ->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT."/data"); |
|
76 | + } |
|
77 | + |
|
78 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
79 | + |
|
80 | + // validate the environment |
|
81 | + $server = \OC::$server; |
|
82 | + $setupHelper = new Setup( |
|
83 | + $this->config, |
|
84 | + $this->iniGetWrapper, |
|
85 | + $server->getL10N('lib'), |
|
86 | + $server->query(Defaults::class), |
|
87 | + $server->getLogger(), |
|
88 | + $server->getSecureRandom(), |
|
89 | + \OC::$server->query(Installer::class) |
|
90 | + ); |
|
91 | + $sysInfo = $setupHelper->getSystemInfo(true); |
|
92 | + $errors = $sysInfo['errors']; |
|
93 | + if (count($errors) > 0) { |
|
94 | + $this->printErrors($output, $errors); |
|
95 | + |
|
96 | + // ignore the OS X setup warning |
|
97 | + if (count($errors) !== 1 || |
|
98 | + (string)$errors[0]['error'] !== 'Mac OS X is not supported and Nextcloud will not work properly on this platform. Use it at your own risk! ') { |
|
99 | + return 1; |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + // validate user input |
|
104 | + $options = $this->validateInput($input, $output, array_keys($sysInfo['databases'])); |
|
105 | + |
|
106 | + // perform installation |
|
107 | + $errors = $setupHelper->install($options); |
|
108 | + if (count($errors) > 0) { |
|
109 | + $this->printErrors($output, $errors); |
|
110 | + return 1; |
|
111 | + } |
|
112 | + $output->writeln("Nextcloud was successfully installed"); |
|
113 | + return 0; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @param InputInterface $input |
|
118 | + * @param OutputInterface $output |
|
119 | + * @param string[] $supportedDatabases |
|
120 | + * @return array |
|
121 | + */ |
|
122 | + protected function validateInput(InputInterface $input, OutputInterface $output, $supportedDatabases) { |
|
123 | + $db = strtolower($input->getOption('database')); |
|
124 | + |
|
125 | + if (!in_array($db, $supportedDatabases)) { |
|
126 | + throw new InvalidArgumentException("Database <$db> is not supported."); |
|
127 | + } |
|
128 | + |
|
129 | + $dbUser = $input->getOption('database-user'); |
|
130 | + $dbPass = $input->getOption('database-pass'); |
|
131 | + $dbName = $input->getOption('database-name'); |
|
132 | + $dbPort = $input->getOption('database-port'); |
|
133 | + if ($db === 'oci') { |
|
134 | + // an empty hostname needs to be read from the raw parameters |
|
135 | + $dbHost = $input->getParameterOption('--database-host', ''); |
|
136 | + } else { |
|
137 | + $dbHost = $input->getOption('database-host'); |
|
138 | + } |
|
139 | + if ($dbPort) { |
|
140 | + // Append the port to the host so it is the same as in the config (there is no dbport config) |
|
141 | + $dbHost .= ':' . $dbPort; |
|
142 | + } |
|
143 | + if ($input->hasParameterOption('--database-pass')) { |
|
144 | + $dbPass = (string) $input->getOption('database-pass'); |
|
145 | + } |
|
146 | + $adminLogin = $input->getOption('admin-user'); |
|
147 | + $adminPassword = $input->getOption('admin-pass'); |
|
148 | + $adminEmail = $input->getOption('admin-email'); |
|
149 | + $dataDir = $input->getOption('data-dir'); |
|
150 | + |
|
151 | + if ($db !== 'sqlite') { |
|
152 | + if (is_null($dbUser)) { |
|
153 | + throw new InvalidArgumentException("Database user not provided."); |
|
154 | + } |
|
155 | + if (is_null($dbName)) { |
|
156 | + throw new InvalidArgumentException("Database name not provided."); |
|
157 | + } |
|
158 | + if (is_null($dbPass)) { |
|
159 | + /** @var QuestionHelper $helper */ |
|
160 | + $helper = $this->getHelper('question'); |
|
161 | + $question = new Question('What is the password to access the database with user <'.$dbUser.'>?'); |
|
162 | + $question->setHidden(true); |
|
163 | + $question->setHiddenFallback(false); |
|
164 | + $dbPass = $helper->ask($input, $output, $question); |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + if (is_null($adminPassword)) { |
|
169 | + /** @var QuestionHelper $helper */ |
|
170 | + $helper = $this->getHelper('question'); |
|
171 | + $question = new Question('What is the password you like to use for the admin account <'.$adminLogin.'>?'); |
|
172 | + $question->setHidden(true); |
|
173 | + $question->setHiddenFallback(false); |
|
174 | + $adminPassword = $helper->ask($input, $output, $question); |
|
175 | + } |
|
176 | + |
|
177 | + if ($adminEmail !== null && !filter_var($adminEmail, FILTER_VALIDATE_EMAIL)) { |
|
178 | + throw new InvalidArgumentException('Invalid e-mail-address <' . $adminEmail . '> for <' . $adminLogin . '>.'); |
|
179 | + } |
|
180 | + |
|
181 | + $options = [ |
|
182 | + 'dbtype' => $db, |
|
183 | + 'dbuser' => $dbUser, |
|
184 | + 'dbpass' => $dbPass, |
|
185 | + 'dbname' => $dbName, |
|
186 | + 'dbhost' => $dbHost, |
|
187 | + 'adminlogin' => $adminLogin, |
|
188 | + 'adminpass' => $adminPassword, |
|
189 | + 'adminemail' => $adminEmail, |
|
190 | + 'directory' => $dataDir |
|
191 | + ]; |
|
192 | + if ($db === 'oci') { |
|
193 | + $options['dbtablespace'] = $input->getParameterOption('--database-table-space', ''); |
|
194 | + } |
|
195 | + return $options; |
|
196 | + } |
|
197 | + |
|
198 | + /** |
|
199 | + * @param OutputInterface $output |
|
200 | + * @param $errors |
|
201 | + */ |
|
202 | + protected function printErrors(OutputInterface $output, $errors) { |
|
203 | + foreach ($errors as $error) { |
|
204 | + if (is_array($error)) { |
|
205 | + $output->writeln('<error>' . (string)$error['error'] . '</error>'); |
|
206 | + $output->writeln('<info> -> ' . (string)$error['hint'] . '</info>'); |
|
207 | + } else { |
|
208 | + $output->writeln('<error>' . (string)$error . '</error>'); |
|
209 | + } |
|
210 | + } |
|
211 | + } |
|
212 | 212 | } |
@@ -74,292 +74,292 @@ discard block |
||
74 | 74 | use Symfony\Component\EventDispatcher\GenericEvent; |
75 | 75 | |
76 | 76 | class CheckSetupController extends Controller { |
77 | - /** @var IConfig */ |
|
78 | - private $config; |
|
79 | - /** @var IClientService */ |
|
80 | - private $clientService; |
|
81 | - /** @var IURLGenerator */ |
|
82 | - private $urlGenerator; |
|
83 | - /** @var IL10N */ |
|
84 | - private $l10n; |
|
85 | - /** @var Checker */ |
|
86 | - private $checker; |
|
87 | - /** @var ILogger */ |
|
88 | - private $logger; |
|
89 | - /** @var EventDispatcherInterface */ |
|
90 | - private $dispatcher; |
|
91 | - /** @var IDBConnection|Connection */ |
|
92 | - private $db; |
|
93 | - /** @var ILockingProvider */ |
|
94 | - private $lockingProvider; |
|
95 | - /** @var IDateTimeFormatter */ |
|
96 | - private $dateTimeFormatter; |
|
97 | - /** @var MemoryInfo */ |
|
98 | - private $memoryInfo; |
|
99 | - /** @var ISecureRandom */ |
|
100 | - private $secureRandom; |
|
101 | - /** @var IniGetWrapper */ |
|
102 | - private $iniGetWrapper; |
|
103 | - |
|
104 | - public function __construct($AppName, |
|
105 | - IRequest $request, |
|
106 | - IConfig $config, |
|
107 | - IClientService $clientService, |
|
108 | - IURLGenerator $urlGenerator, |
|
109 | - IL10N $l10n, |
|
110 | - Checker $checker, |
|
111 | - ILogger $logger, |
|
112 | - EventDispatcherInterface $dispatcher, |
|
113 | - IDBConnection $db, |
|
114 | - ILockingProvider $lockingProvider, |
|
115 | - IDateTimeFormatter $dateTimeFormatter, |
|
116 | - MemoryInfo $memoryInfo, |
|
117 | - ISecureRandom $secureRandom, |
|
118 | - IniGetWrapper $iniGetWrapper) { |
|
119 | - parent::__construct($AppName, $request); |
|
120 | - $this->config = $config; |
|
121 | - $this->clientService = $clientService; |
|
122 | - $this->urlGenerator = $urlGenerator; |
|
123 | - $this->l10n = $l10n; |
|
124 | - $this->checker = $checker; |
|
125 | - $this->logger = $logger; |
|
126 | - $this->dispatcher = $dispatcher; |
|
127 | - $this->db = $db; |
|
128 | - $this->lockingProvider = $lockingProvider; |
|
129 | - $this->dateTimeFormatter = $dateTimeFormatter; |
|
130 | - $this->memoryInfo = $memoryInfo; |
|
131 | - $this->secureRandom = $secureRandom; |
|
132 | - $this->iniGetWrapper = $iniGetWrapper; |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Checks if the server can connect to the internet using HTTPS and HTTP |
|
137 | - * @return bool |
|
138 | - */ |
|
139 | - private function hasInternetConnectivityProblems(): bool { |
|
140 | - if ($this->config->getSystemValue('has_internet_connection', true) === false) { |
|
141 | - return false; |
|
142 | - } |
|
143 | - |
|
144 | - $siteArray = $this->config->getSystemValue('connectivity_check_domains', [ |
|
145 | - 'www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org' |
|
146 | - ]); |
|
147 | - |
|
148 | - foreach ($siteArray as $site) { |
|
149 | - if ($this->isSiteReachable($site)) { |
|
150 | - return false; |
|
151 | - } |
|
152 | - } |
|
153 | - return true; |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * Checks if the Nextcloud server can connect to a specific URL using both HTTPS and HTTP |
|
158 | - * @return bool |
|
159 | - */ |
|
160 | - private function isSiteReachable($sitename) { |
|
161 | - $httpSiteName = 'http://' . $sitename . '/'; |
|
162 | - $httpsSiteName = 'https://' . $sitename . '/'; |
|
163 | - |
|
164 | - try { |
|
165 | - $client = $this->clientService->newClient(); |
|
166 | - $client->get($httpSiteName); |
|
167 | - $client->get($httpsSiteName); |
|
168 | - } catch (\Exception $e) { |
|
169 | - $this->logger->logException($e, ['app' => 'internet_connection_check']); |
|
170 | - return false; |
|
171 | - } |
|
172 | - return true; |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * Checks whether a local memcache is installed or not |
|
177 | - * @return bool |
|
178 | - */ |
|
179 | - private function isMemcacheConfigured() { |
|
180 | - return $this->config->getSystemValue('memcache.local', null) !== null; |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * Whether PHP can generate "secure" pseudorandom integers |
|
185 | - * |
|
186 | - * @return bool |
|
187 | - */ |
|
188 | - private function isRandomnessSecure() { |
|
189 | - try { |
|
190 | - $this->secureRandom->generate(1); |
|
191 | - } catch (\Exception $ex) { |
|
192 | - return false; |
|
193 | - } |
|
194 | - return true; |
|
195 | - } |
|
196 | - |
|
197 | - /** |
|
198 | - * Public for the sake of unit-testing |
|
199 | - * |
|
200 | - * @return array |
|
201 | - */ |
|
202 | - protected function getCurlVersion() { |
|
203 | - return curl_version(); |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * Check if the used SSL lib is outdated. Older OpenSSL and NSS versions do |
|
208 | - * have multiple bugs which likely lead to problems in combination with |
|
209 | - * functionality required by ownCloud such as SNI. |
|
210 | - * |
|
211 | - * @link https://github.com/owncloud/core/issues/17446#issuecomment-122877546 |
|
212 | - * @link https://bugzilla.redhat.com/show_bug.cgi?id=1241172 |
|
213 | - * @return string |
|
214 | - */ |
|
215 | - private function isUsedTlsLibOutdated() { |
|
216 | - // Don't run check when: |
|
217 | - // 1. Server has `has_internet_connection` set to false |
|
218 | - // 2. AppStore AND S2S is disabled |
|
219 | - if (!$this->config->getSystemValue('has_internet_connection', true)) { |
|
220 | - return ''; |
|
221 | - } |
|
222 | - if (!$this->config->getSystemValue('appstoreenabled', true) |
|
223 | - && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no' |
|
224 | - && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') { |
|
225 | - return ''; |
|
226 | - } |
|
227 | - |
|
228 | - $versionString = $this->getCurlVersion(); |
|
229 | - if (isset($versionString['ssl_version'])) { |
|
230 | - $versionString = $versionString['ssl_version']; |
|
231 | - } else { |
|
232 | - return ''; |
|
233 | - } |
|
234 | - |
|
235 | - $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); |
|
236 | - if (!$this->config->getSystemValue('appstoreenabled', true)) { |
|
237 | - $features = (string)$this->l10n->t('Federated Cloud Sharing'); |
|
238 | - } |
|
239 | - |
|
240 | - // Check if at least OpenSSL after 1.01d or 1.0.2b |
|
241 | - if (strpos($versionString, 'OpenSSL/') === 0) { |
|
242 | - $majorVersion = substr($versionString, 8, 5); |
|
243 | - $patchRelease = substr($versionString, 13, 6); |
|
244 | - |
|
245 | - if (($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || |
|
246 | - ($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) { |
|
247 | - return $this->l10n->t('cURL is using an outdated %1$s version (%2$s). Please update your operating system or features such as %3$s will not work reliably.', ['OpenSSL', $versionString, $features]); |
|
248 | - } |
|
249 | - } |
|
250 | - |
|
251 | - // Check if NSS and perform heuristic check |
|
252 | - if (strpos($versionString, 'NSS/') === 0) { |
|
253 | - try { |
|
254 | - $firstClient = $this->clientService->newClient(); |
|
255 | - $firstClient->get('https://nextcloud.com/'); |
|
256 | - |
|
257 | - $secondClient = $this->clientService->newClient(); |
|
258 | - $secondClient->get('https://nextcloud.com/'); |
|
259 | - } catch (ClientException $e) { |
|
260 | - if ($e->getResponse()->getStatusCode() === 400) { |
|
261 | - return $this->l10n->t('cURL is using an outdated %1$s version (%2$s). Please update your operating system or features such as %3$s will not work reliably.', ['NSS', $versionString, $features]); |
|
262 | - } |
|
263 | - } |
|
264 | - } |
|
265 | - |
|
266 | - return ''; |
|
267 | - } |
|
268 | - |
|
269 | - /** |
|
270 | - * Whether the version is outdated |
|
271 | - * |
|
272 | - * @return bool |
|
273 | - */ |
|
274 | - protected function isPhpOutdated(): bool { |
|
275 | - return PHP_VERSION_ID < 70300; |
|
276 | - } |
|
277 | - |
|
278 | - /** |
|
279 | - * Whether the php version is still supported (at time of release) |
|
280 | - * according to: https://secure.php.net/supported-versions.php |
|
281 | - * |
|
282 | - * @return array |
|
283 | - */ |
|
284 | - private function isPhpSupported(): array { |
|
285 | - return ['eol' => $this->isPhpOutdated(), 'version' => PHP_VERSION]; |
|
286 | - } |
|
287 | - |
|
288 | - /** |
|
289 | - * Check if the reverse proxy configuration is working as expected |
|
290 | - * |
|
291 | - * @return bool |
|
292 | - */ |
|
293 | - private function forwardedForHeadersWorking() { |
|
294 | - $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); |
|
295 | - $remoteAddress = $this->request->getHeader('REMOTE_ADDR'); |
|
296 | - |
|
297 | - if (empty($trustedProxies) && $this->request->getHeader('X-Forwarded-Host') !== '') { |
|
298 | - return false; |
|
299 | - } |
|
300 | - |
|
301 | - if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies, true)) { |
|
302 | - return $remoteAddress !== $this->request->getRemoteAddress(); |
|
303 | - } |
|
304 | - |
|
305 | - // either not enabled or working correctly |
|
306 | - return true; |
|
307 | - } |
|
308 | - |
|
309 | - /** |
|
310 | - * Checks if the correct memcache module for PHP is installed. Only |
|
311 | - * fails if memcached is configured and the working module is not installed. |
|
312 | - * |
|
313 | - * @return bool |
|
314 | - */ |
|
315 | - private function isCorrectMemcachedPHPModuleInstalled() { |
|
316 | - if ($this->config->getSystemValue('memcache.distributed', null) !== '\OC\Memcache\Memcached') { |
|
317 | - return true; |
|
318 | - } |
|
319 | - |
|
320 | - // there are two different memcached modules for PHP |
|
321 | - // we only support memcached and not memcache |
|
322 | - // https://code.google.com/p/memcached/wiki/PHPClientComparison |
|
323 | - return !(!extension_loaded('memcached') && extension_loaded('memcache')); |
|
324 | - } |
|
325 | - |
|
326 | - /** |
|
327 | - * Checks if set_time_limit is not disabled. |
|
328 | - * |
|
329 | - * @return bool |
|
330 | - */ |
|
331 | - private function isSettimelimitAvailable() { |
|
332 | - if (function_exists('set_time_limit') |
|
333 | - && strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
334 | - return true; |
|
335 | - } |
|
336 | - |
|
337 | - return false; |
|
338 | - } |
|
339 | - |
|
340 | - /** |
|
341 | - * @return RedirectResponse |
|
342 | - */ |
|
343 | - public function rescanFailedIntegrityCheck() { |
|
344 | - $this->checker->runInstanceVerification(); |
|
345 | - return new RedirectResponse( |
|
346 | - $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'overview']) |
|
347 | - ); |
|
348 | - } |
|
349 | - |
|
350 | - /** |
|
351 | - * @NoCSRFRequired |
|
352 | - * @return DataResponse |
|
353 | - */ |
|
354 | - public function getFailedIntegrityCheckFiles() { |
|
355 | - if (!$this->checker->isCodeCheckEnforced()) { |
|
356 | - return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.'); |
|
357 | - } |
|
358 | - |
|
359 | - $completeResults = $this->checker->getResults(); |
|
360 | - |
|
361 | - if (!empty($completeResults)) { |
|
362 | - $formattedTextResponse = 'Technical information |
|
77 | + /** @var IConfig */ |
|
78 | + private $config; |
|
79 | + /** @var IClientService */ |
|
80 | + private $clientService; |
|
81 | + /** @var IURLGenerator */ |
|
82 | + private $urlGenerator; |
|
83 | + /** @var IL10N */ |
|
84 | + private $l10n; |
|
85 | + /** @var Checker */ |
|
86 | + private $checker; |
|
87 | + /** @var ILogger */ |
|
88 | + private $logger; |
|
89 | + /** @var EventDispatcherInterface */ |
|
90 | + private $dispatcher; |
|
91 | + /** @var IDBConnection|Connection */ |
|
92 | + private $db; |
|
93 | + /** @var ILockingProvider */ |
|
94 | + private $lockingProvider; |
|
95 | + /** @var IDateTimeFormatter */ |
|
96 | + private $dateTimeFormatter; |
|
97 | + /** @var MemoryInfo */ |
|
98 | + private $memoryInfo; |
|
99 | + /** @var ISecureRandom */ |
|
100 | + private $secureRandom; |
|
101 | + /** @var IniGetWrapper */ |
|
102 | + private $iniGetWrapper; |
|
103 | + |
|
104 | + public function __construct($AppName, |
|
105 | + IRequest $request, |
|
106 | + IConfig $config, |
|
107 | + IClientService $clientService, |
|
108 | + IURLGenerator $urlGenerator, |
|
109 | + IL10N $l10n, |
|
110 | + Checker $checker, |
|
111 | + ILogger $logger, |
|
112 | + EventDispatcherInterface $dispatcher, |
|
113 | + IDBConnection $db, |
|
114 | + ILockingProvider $lockingProvider, |
|
115 | + IDateTimeFormatter $dateTimeFormatter, |
|
116 | + MemoryInfo $memoryInfo, |
|
117 | + ISecureRandom $secureRandom, |
|
118 | + IniGetWrapper $iniGetWrapper) { |
|
119 | + parent::__construct($AppName, $request); |
|
120 | + $this->config = $config; |
|
121 | + $this->clientService = $clientService; |
|
122 | + $this->urlGenerator = $urlGenerator; |
|
123 | + $this->l10n = $l10n; |
|
124 | + $this->checker = $checker; |
|
125 | + $this->logger = $logger; |
|
126 | + $this->dispatcher = $dispatcher; |
|
127 | + $this->db = $db; |
|
128 | + $this->lockingProvider = $lockingProvider; |
|
129 | + $this->dateTimeFormatter = $dateTimeFormatter; |
|
130 | + $this->memoryInfo = $memoryInfo; |
|
131 | + $this->secureRandom = $secureRandom; |
|
132 | + $this->iniGetWrapper = $iniGetWrapper; |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Checks if the server can connect to the internet using HTTPS and HTTP |
|
137 | + * @return bool |
|
138 | + */ |
|
139 | + private function hasInternetConnectivityProblems(): bool { |
|
140 | + if ($this->config->getSystemValue('has_internet_connection', true) === false) { |
|
141 | + return false; |
|
142 | + } |
|
143 | + |
|
144 | + $siteArray = $this->config->getSystemValue('connectivity_check_domains', [ |
|
145 | + 'www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org' |
|
146 | + ]); |
|
147 | + |
|
148 | + foreach ($siteArray as $site) { |
|
149 | + if ($this->isSiteReachable($site)) { |
|
150 | + return false; |
|
151 | + } |
|
152 | + } |
|
153 | + return true; |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * Checks if the Nextcloud server can connect to a specific URL using both HTTPS and HTTP |
|
158 | + * @return bool |
|
159 | + */ |
|
160 | + private function isSiteReachable($sitename) { |
|
161 | + $httpSiteName = 'http://' . $sitename . '/'; |
|
162 | + $httpsSiteName = 'https://' . $sitename . '/'; |
|
163 | + |
|
164 | + try { |
|
165 | + $client = $this->clientService->newClient(); |
|
166 | + $client->get($httpSiteName); |
|
167 | + $client->get($httpsSiteName); |
|
168 | + } catch (\Exception $e) { |
|
169 | + $this->logger->logException($e, ['app' => 'internet_connection_check']); |
|
170 | + return false; |
|
171 | + } |
|
172 | + return true; |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * Checks whether a local memcache is installed or not |
|
177 | + * @return bool |
|
178 | + */ |
|
179 | + private function isMemcacheConfigured() { |
|
180 | + return $this->config->getSystemValue('memcache.local', null) !== null; |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * Whether PHP can generate "secure" pseudorandom integers |
|
185 | + * |
|
186 | + * @return bool |
|
187 | + */ |
|
188 | + private function isRandomnessSecure() { |
|
189 | + try { |
|
190 | + $this->secureRandom->generate(1); |
|
191 | + } catch (\Exception $ex) { |
|
192 | + return false; |
|
193 | + } |
|
194 | + return true; |
|
195 | + } |
|
196 | + |
|
197 | + /** |
|
198 | + * Public for the sake of unit-testing |
|
199 | + * |
|
200 | + * @return array |
|
201 | + */ |
|
202 | + protected function getCurlVersion() { |
|
203 | + return curl_version(); |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * Check if the used SSL lib is outdated. Older OpenSSL and NSS versions do |
|
208 | + * have multiple bugs which likely lead to problems in combination with |
|
209 | + * functionality required by ownCloud such as SNI. |
|
210 | + * |
|
211 | + * @link https://github.com/owncloud/core/issues/17446#issuecomment-122877546 |
|
212 | + * @link https://bugzilla.redhat.com/show_bug.cgi?id=1241172 |
|
213 | + * @return string |
|
214 | + */ |
|
215 | + private function isUsedTlsLibOutdated() { |
|
216 | + // Don't run check when: |
|
217 | + // 1. Server has `has_internet_connection` set to false |
|
218 | + // 2. AppStore AND S2S is disabled |
|
219 | + if (!$this->config->getSystemValue('has_internet_connection', true)) { |
|
220 | + return ''; |
|
221 | + } |
|
222 | + if (!$this->config->getSystemValue('appstoreenabled', true) |
|
223 | + && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no' |
|
224 | + && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') { |
|
225 | + return ''; |
|
226 | + } |
|
227 | + |
|
228 | + $versionString = $this->getCurlVersion(); |
|
229 | + if (isset($versionString['ssl_version'])) { |
|
230 | + $versionString = $versionString['ssl_version']; |
|
231 | + } else { |
|
232 | + return ''; |
|
233 | + } |
|
234 | + |
|
235 | + $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); |
|
236 | + if (!$this->config->getSystemValue('appstoreenabled', true)) { |
|
237 | + $features = (string)$this->l10n->t('Federated Cloud Sharing'); |
|
238 | + } |
|
239 | + |
|
240 | + // Check if at least OpenSSL after 1.01d or 1.0.2b |
|
241 | + if (strpos($versionString, 'OpenSSL/') === 0) { |
|
242 | + $majorVersion = substr($versionString, 8, 5); |
|
243 | + $patchRelease = substr($versionString, 13, 6); |
|
244 | + |
|
245 | + if (($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || |
|
246 | + ($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) { |
|
247 | + return $this->l10n->t('cURL is using an outdated %1$s version (%2$s). Please update your operating system or features such as %3$s will not work reliably.', ['OpenSSL', $versionString, $features]); |
|
248 | + } |
|
249 | + } |
|
250 | + |
|
251 | + // Check if NSS and perform heuristic check |
|
252 | + if (strpos($versionString, 'NSS/') === 0) { |
|
253 | + try { |
|
254 | + $firstClient = $this->clientService->newClient(); |
|
255 | + $firstClient->get('https://nextcloud.com/'); |
|
256 | + |
|
257 | + $secondClient = $this->clientService->newClient(); |
|
258 | + $secondClient->get('https://nextcloud.com/'); |
|
259 | + } catch (ClientException $e) { |
|
260 | + if ($e->getResponse()->getStatusCode() === 400) { |
|
261 | + return $this->l10n->t('cURL is using an outdated %1$s version (%2$s). Please update your operating system or features such as %3$s will not work reliably.', ['NSS', $versionString, $features]); |
|
262 | + } |
|
263 | + } |
|
264 | + } |
|
265 | + |
|
266 | + return ''; |
|
267 | + } |
|
268 | + |
|
269 | + /** |
|
270 | + * Whether the version is outdated |
|
271 | + * |
|
272 | + * @return bool |
|
273 | + */ |
|
274 | + protected function isPhpOutdated(): bool { |
|
275 | + return PHP_VERSION_ID < 70300; |
|
276 | + } |
|
277 | + |
|
278 | + /** |
|
279 | + * Whether the php version is still supported (at time of release) |
|
280 | + * according to: https://secure.php.net/supported-versions.php |
|
281 | + * |
|
282 | + * @return array |
|
283 | + */ |
|
284 | + private function isPhpSupported(): array { |
|
285 | + return ['eol' => $this->isPhpOutdated(), 'version' => PHP_VERSION]; |
|
286 | + } |
|
287 | + |
|
288 | + /** |
|
289 | + * Check if the reverse proxy configuration is working as expected |
|
290 | + * |
|
291 | + * @return bool |
|
292 | + */ |
|
293 | + private function forwardedForHeadersWorking() { |
|
294 | + $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); |
|
295 | + $remoteAddress = $this->request->getHeader('REMOTE_ADDR'); |
|
296 | + |
|
297 | + if (empty($trustedProxies) && $this->request->getHeader('X-Forwarded-Host') !== '') { |
|
298 | + return false; |
|
299 | + } |
|
300 | + |
|
301 | + if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies, true)) { |
|
302 | + return $remoteAddress !== $this->request->getRemoteAddress(); |
|
303 | + } |
|
304 | + |
|
305 | + // either not enabled or working correctly |
|
306 | + return true; |
|
307 | + } |
|
308 | + |
|
309 | + /** |
|
310 | + * Checks if the correct memcache module for PHP is installed. Only |
|
311 | + * fails if memcached is configured and the working module is not installed. |
|
312 | + * |
|
313 | + * @return bool |
|
314 | + */ |
|
315 | + private function isCorrectMemcachedPHPModuleInstalled() { |
|
316 | + if ($this->config->getSystemValue('memcache.distributed', null) !== '\OC\Memcache\Memcached') { |
|
317 | + return true; |
|
318 | + } |
|
319 | + |
|
320 | + // there are two different memcached modules for PHP |
|
321 | + // we only support memcached and not memcache |
|
322 | + // https://code.google.com/p/memcached/wiki/PHPClientComparison |
|
323 | + return !(!extension_loaded('memcached') && extension_loaded('memcache')); |
|
324 | + } |
|
325 | + |
|
326 | + /** |
|
327 | + * Checks if set_time_limit is not disabled. |
|
328 | + * |
|
329 | + * @return bool |
|
330 | + */ |
|
331 | + private function isSettimelimitAvailable() { |
|
332 | + if (function_exists('set_time_limit') |
|
333 | + && strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
334 | + return true; |
|
335 | + } |
|
336 | + |
|
337 | + return false; |
|
338 | + } |
|
339 | + |
|
340 | + /** |
|
341 | + * @return RedirectResponse |
|
342 | + */ |
|
343 | + public function rescanFailedIntegrityCheck() { |
|
344 | + $this->checker->runInstanceVerification(); |
|
345 | + return new RedirectResponse( |
|
346 | + $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'overview']) |
|
347 | + ); |
|
348 | + } |
|
349 | + |
|
350 | + /** |
|
351 | + * @NoCSRFRequired |
|
352 | + * @return DataResponse |
|
353 | + */ |
|
354 | + public function getFailedIntegrityCheckFiles() { |
|
355 | + if (!$this->checker->isCodeCheckEnforced()) { |
|
356 | + return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.'); |
|
357 | + } |
|
358 | + |
|
359 | + $completeResults = $this->checker->getResults(); |
|
360 | + |
|
361 | + if (!empty($completeResults)) { |
|
362 | + $formattedTextResponse = 'Technical information |
|
363 | 363 | ===================== |
364 | 364 | The following list covers which files have failed the integrity check. Please read |
365 | 365 | the previous linked documentation to learn more about the errors and how to fix |
@@ -368,373 +368,373 @@ discard block |
||
368 | 368 | Results |
369 | 369 | ======= |
370 | 370 | '; |
371 | - foreach ($completeResults as $context => $contextResult) { |
|
372 | - $formattedTextResponse .= "- $context\n"; |
|
373 | - |
|
374 | - foreach ($contextResult as $category => $result) { |
|
375 | - $formattedTextResponse .= "\t- $category\n"; |
|
376 | - if ($category !== 'EXCEPTION') { |
|
377 | - foreach ($result as $key => $results) { |
|
378 | - $formattedTextResponse .= "\t\t- $key\n"; |
|
379 | - } |
|
380 | - } else { |
|
381 | - foreach ($result as $key => $results) { |
|
382 | - $formattedTextResponse .= "\t\t- $results\n"; |
|
383 | - } |
|
384 | - } |
|
385 | - } |
|
386 | - } |
|
387 | - |
|
388 | - $formattedTextResponse .= ' |
|
371 | + foreach ($completeResults as $context => $contextResult) { |
|
372 | + $formattedTextResponse .= "- $context\n"; |
|
373 | + |
|
374 | + foreach ($contextResult as $category => $result) { |
|
375 | + $formattedTextResponse .= "\t- $category\n"; |
|
376 | + if ($category !== 'EXCEPTION') { |
|
377 | + foreach ($result as $key => $results) { |
|
378 | + $formattedTextResponse .= "\t\t- $key\n"; |
|
379 | + } |
|
380 | + } else { |
|
381 | + foreach ($result as $key => $results) { |
|
382 | + $formattedTextResponse .= "\t\t- $results\n"; |
|
383 | + } |
|
384 | + } |
|
385 | + } |
|
386 | + } |
|
387 | + |
|
388 | + $formattedTextResponse .= ' |
|
389 | 389 | Raw output |
390 | 390 | ========== |
391 | 391 | '; |
392 | - $formattedTextResponse .= print_r($completeResults, true); |
|
393 | - } else { |
|
394 | - $formattedTextResponse = 'No errors have been found.'; |
|
395 | - } |
|
396 | - |
|
397 | - |
|
398 | - $response = new DataDisplayResponse( |
|
399 | - $formattedTextResponse, |
|
400 | - Http::STATUS_OK, |
|
401 | - [ |
|
402 | - 'Content-Type' => 'text/plain', |
|
403 | - ] |
|
404 | - ); |
|
405 | - |
|
406 | - return $response; |
|
407 | - } |
|
408 | - |
|
409 | - /** |
|
410 | - * Checks whether a PHP opcache is properly set up |
|
411 | - * @return bool |
|
412 | - */ |
|
413 | - protected function isOpcacheProperlySetup() { |
|
414 | - if (!$this->iniGetWrapper->getBool('opcache.enable')) { |
|
415 | - return false; |
|
416 | - } |
|
417 | - |
|
418 | - if (!$this->iniGetWrapper->getBool('opcache.save_comments')) { |
|
419 | - return false; |
|
420 | - } |
|
421 | - |
|
422 | - if ($this->iniGetWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { |
|
423 | - return false; |
|
424 | - } |
|
425 | - |
|
426 | - if ($this->iniGetWrapper->getNumeric('opcache.memory_consumption') < 128) { |
|
427 | - return false; |
|
428 | - } |
|
429 | - |
|
430 | - if ($this->iniGetWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { |
|
431 | - return false; |
|
432 | - } |
|
433 | - |
|
434 | - return true; |
|
435 | - } |
|
436 | - |
|
437 | - /** |
|
438 | - * Check if the required FreeType functions are present |
|
439 | - * @return bool |
|
440 | - */ |
|
441 | - protected function hasFreeTypeSupport() { |
|
442 | - return function_exists('imagettfbbox') && function_exists('imagettftext'); |
|
443 | - } |
|
444 | - |
|
445 | - protected function hasMissingIndexes(): array { |
|
446 | - $indexInfo = new MissingIndexInformation(); |
|
447 | - // Dispatch event so apps can also hint for pending index updates if needed |
|
448 | - $event = new GenericEvent($indexInfo); |
|
449 | - $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_INDEXES_EVENT, $event); |
|
450 | - |
|
451 | - return $indexInfo->getListOfMissingIndexes(); |
|
452 | - } |
|
453 | - |
|
454 | - protected function hasMissingColumns(): array { |
|
455 | - $indexInfo = new MissingColumnInformation(); |
|
456 | - // Dispatch event so apps can also hint for pending index updates if needed |
|
457 | - $event = new GenericEvent($indexInfo); |
|
458 | - $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, $event); |
|
459 | - |
|
460 | - return $indexInfo->getListOfMissingColumns(); |
|
461 | - } |
|
462 | - |
|
463 | - protected function isSqliteUsed() { |
|
464 | - return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false; |
|
465 | - } |
|
466 | - |
|
467 | - protected function isReadOnlyConfig(): bool { |
|
468 | - return \OC_Helper::isReadOnlyConfigEnabled(); |
|
469 | - } |
|
470 | - |
|
471 | - protected function hasValidTransactionIsolationLevel(): bool { |
|
472 | - try { |
|
473 | - if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { |
|
474 | - return true; |
|
475 | - } |
|
476 | - |
|
477 | - return $this->db->getTransactionIsolation() === Connection::TRANSACTION_READ_COMMITTED; |
|
478 | - } catch (DBALException $e) { |
|
479 | - // ignore |
|
480 | - } |
|
481 | - |
|
482 | - return true; |
|
483 | - } |
|
484 | - |
|
485 | - protected function hasFileinfoInstalled(): bool { |
|
486 | - return \OC_Util::fileInfoLoaded(); |
|
487 | - } |
|
488 | - |
|
489 | - protected function hasWorkingFileLocking(): bool { |
|
490 | - return !($this->lockingProvider instanceof NoopLockingProvider); |
|
491 | - } |
|
492 | - |
|
493 | - protected function getSuggestedOverwriteCliURL(): string { |
|
494 | - $suggestedOverwriteCliUrl = ''; |
|
495 | - if ($this->config->getSystemValue('overwrite.cli.url', '') === '') { |
|
496 | - $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT; |
|
497 | - if (!$this->config->getSystemValue('config_is_read_only', false)) { |
|
498 | - // Set the overwrite URL when it was not set yet. |
|
499 | - $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl); |
|
500 | - $suggestedOverwriteCliUrl = ''; |
|
501 | - } |
|
502 | - } |
|
503 | - return $suggestedOverwriteCliUrl; |
|
504 | - } |
|
505 | - |
|
506 | - protected function getLastCronInfo(): array { |
|
507 | - $lastCronRun = $this->config->getAppValue('core', 'lastcron', 0); |
|
508 | - return [ |
|
509 | - 'diffInSeconds' => time() - $lastCronRun, |
|
510 | - 'relativeTime' => $this->dateTimeFormatter->formatTimeSpan($lastCronRun), |
|
511 | - 'backgroundJobsUrl' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'server']) . '#backgroundjobs', |
|
512 | - ]; |
|
513 | - } |
|
514 | - |
|
515 | - protected function getCronErrors() { |
|
516 | - $errors = json_decode($this->config->getAppValue('core', 'cronErrors', ''), true); |
|
517 | - |
|
518 | - if (is_array($errors)) { |
|
519 | - return $errors; |
|
520 | - } |
|
521 | - |
|
522 | - return []; |
|
523 | - } |
|
524 | - |
|
525 | - protected function isPHPMailerUsed(): bool { |
|
526 | - return $this->config->getSystemValue('mail_smtpmode', 'smtp') === 'php'; |
|
527 | - } |
|
528 | - |
|
529 | - protected function hasOpcacheLoaded(): bool { |
|
530 | - return extension_loaded('Zend OPcache'); |
|
531 | - } |
|
532 | - |
|
533 | - /** |
|
534 | - * Iterates through the configured app roots and |
|
535 | - * tests if the subdirectories are owned by the same user than the current user. |
|
536 | - * |
|
537 | - * @return array |
|
538 | - */ |
|
539 | - protected function getAppDirsWithDifferentOwner(): array { |
|
540 | - $currentUser = posix_getuid(); |
|
541 | - $appDirsWithDifferentOwner = [[]]; |
|
542 | - |
|
543 | - foreach (OC::$APPSROOTS as $appRoot) { |
|
544 | - if ($appRoot['writable'] === true) { |
|
545 | - $appDirsWithDifferentOwner[] = $this->getAppDirsWithDifferentOwnerForAppRoot($currentUser, $appRoot); |
|
546 | - } |
|
547 | - } |
|
548 | - |
|
549 | - $appDirsWithDifferentOwner = array_merge(...$appDirsWithDifferentOwner); |
|
550 | - sort($appDirsWithDifferentOwner); |
|
551 | - |
|
552 | - return $appDirsWithDifferentOwner; |
|
553 | - } |
|
554 | - |
|
555 | - /** |
|
556 | - * Tests if the directories for one apps directory are writable by the current user. |
|
557 | - * |
|
558 | - * @param int $currentUser The current user |
|
559 | - * @param array $appRoot The app root config |
|
560 | - * @return string[] The none writable directory paths inside the app root |
|
561 | - */ |
|
562 | - private function getAppDirsWithDifferentOwnerForAppRoot(int $currentUser, array $appRoot): array { |
|
563 | - $appDirsWithDifferentOwner = []; |
|
564 | - $appsPath = $appRoot['path']; |
|
565 | - $appsDir = new DirectoryIterator($appRoot['path']); |
|
566 | - |
|
567 | - foreach ($appsDir as $fileInfo) { |
|
568 | - if ($fileInfo->isDir() && !$fileInfo->isDot()) { |
|
569 | - $absAppPath = $appsPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename(); |
|
570 | - $appDirUser = fileowner($absAppPath); |
|
571 | - if ($appDirUser !== $currentUser) { |
|
572 | - $appDirsWithDifferentOwner[] = $absAppPath; |
|
573 | - } |
|
574 | - } |
|
575 | - } |
|
576 | - |
|
577 | - return $appDirsWithDifferentOwner; |
|
578 | - } |
|
579 | - |
|
580 | - /** |
|
581 | - * Checks for potential PHP modules that would improve the instance |
|
582 | - * |
|
583 | - * @return string[] A list of PHP modules that is recommended |
|
584 | - */ |
|
585 | - protected function hasRecommendedPHPModules(): array { |
|
586 | - $recommendedPHPModules = []; |
|
587 | - |
|
588 | - if (!extension_loaded('intl')) { |
|
589 | - $recommendedPHPModules[] = 'intl'; |
|
590 | - } |
|
591 | - |
|
592 | - if (!extension_loaded('bcmath')) { |
|
593 | - $recommendedPHPModules[] = 'bcmath'; |
|
594 | - } |
|
595 | - |
|
596 | - if (!extension_loaded('gmp')) { |
|
597 | - $recommendedPHPModules[] = 'gmp'; |
|
598 | - } |
|
599 | - |
|
600 | - if ($this->config->getAppValue('theming', 'enabled', 'no') === 'yes') { |
|
601 | - if (!extension_loaded('imagick')) { |
|
602 | - $recommendedPHPModules[] = 'imagick'; |
|
603 | - } |
|
604 | - } |
|
605 | - |
|
606 | - return $recommendedPHPModules; |
|
607 | - } |
|
608 | - |
|
609 | - protected function isMysqlUsedWithoutUTF8MB4(): bool { |
|
610 | - return ($this->config->getSystemValue('dbtype', 'sqlite') === 'mysql') && ($this->config->getSystemValue('mysql.utf8mb4', false) === false); |
|
611 | - } |
|
612 | - |
|
613 | - protected function hasBigIntConversionPendingColumns(): array { |
|
614 | - // copy of ConvertFilecacheBigInt::getColumnsByTable() |
|
615 | - $tables = [ |
|
616 | - 'activity' => ['activity_id', 'object_id'], |
|
617 | - 'activity_mq' => ['mail_id'], |
|
618 | - 'authtoken' => ['id'], |
|
619 | - 'bruteforce_attempts' => ['id'], |
|
620 | - 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'], |
|
621 | - 'file_locks' => ['id'], |
|
622 | - 'jobs' => ['id'], |
|
623 | - 'mimetypes' => ['id'], |
|
624 | - 'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'], |
|
625 | - 'storages' => ['numeric_id'], |
|
626 | - ]; |
|
627 | - |
|
628 | - $schema = new SchemaWrapper($this->db); |
|
629 | - $isSqlite = $this->db->getDatabasePlatform() instanceof SqlitePlatform; |
|
630 | - $pendingColumns = []; |
|
631 | - |
|
632 | - foreach ($tables as $tableName => $columns) { |
|
633 | - if (!$schema->hasTable($tableName)) { |
|
634 | - continue; |
|
635 | - } |
|
636 | - |
|
637 | - $table = $schema->getTable($tableName); |
|
638 | - foreach ($columns as $columnName) { |
|
639 | - $column = $table->getColumn($columnName); |
|
640 | - $isAutoIncrement = $column->getAutoincrement(); |
|
641 | - $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; |
|
642 | - if ($column->getType()->getName() !== Types::BIGINT && !$isAutoIncrementOnSqlite) { |
|
643 | - $pendingColumns[] = $tableName . '.' . $columnName; |
|
644 | - } |
|
645 | - } |
|
646 | - } |
|
647 | - |
|
648 | - return $pendingColumns; |
|
649 | - } |
|
650 | - |
|
651 | - protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool { |
|
652 | - $objectStore = $this->config->getSystemValue('objectstore', null); |
|
653 | - $objectStoreMultibucket = $this->config->getSystemValue('objectstore_multibucket', null); |
|
654 | - |
|
655 | - if (!isset($objectStoreMultibucket) && !isset($objectStore)) { |
|
656 | - return true; |
|
657 | - } |
|
658 | - |
|
659 | - if (isset($objectStoreMultibucket['class']) && $objectStoreMultibucket['class'] !== 'OC\\Files\\ObjectStore\\S3') { |
|
660 | - return true; |
|
661 | - } |
|
662 | - |
|
663 | - if (isset($objectStore['class']) && $objectStore['class'] !== 'OC\\Files\\ObjectStore\\S3') { |
|
664 | - return true; |
|
665 | - } |
|
666 | - |
|
667 | - $tempPath = sys_get_temp_dir(); |
|
668 | - if (!is_dir($tempPath)) { |
|
669 | - $this->logger->error('Error while checking the temporary PHP path - it was not properly set to a directory. value: ' . $tempPath); |
|
670 | - return false; |
|
671 | - } |
|
672 | - $freeSpaceInTemp = disk_free_space($tempPath); |
|
673 | - if ($freeSpaceInTemp === false) { |
|
674 | - $this->logger->error('Error while checking the available disk space of temporary PHP path - no free disk space returned. temporary path: ' . $tempPath); |
|
675 | - return false; |
|
676 | - } |
|
677 | - |
|
678 | - $freeSpaceInTempInGB = $freeSpaceInTemp / 1024 / 1024 / 1024; |
|
679 | - if ($freeSpaceInTempInGB > 50) { |
|
680 | - return true; |
|
681 | - } |
|
682 | - |
|
683 | - $this->logger->warning('Checking the available space in the temporary path resulted in ' . round($freeSpaceInTempInGB, 1) . ' GB instead of the recommended 50GB. Path: ' . $tempPath); |
|
684 | - return false; |
|
685 | - } |
|
686 | - |
|
687 | - /** |
|
688 | - * @return DataResponse |
|
689 | - */ |
|
690 | - public function check() { |
|
691 | - $phpDefaultCharset = new PhpDefaultCharset(); |
|
692 | - $phpOutputBuffering = new PhpOutputBuffering(); |
|
693 | - $legacySSEKeyFormat = new LegacySSEKeyFormat($this->l10n, $this->config, $this->urlGenerator); |
|
694 | - return new DataResponse( |
|
695 | - [ |
|
696 | - 'isGetenvServerWorking' => !empty(getenv('PATH')), |
|
697 | - 'isReadOnlyConfig' => $this->isReadOnlyConfig(), |
|
698 | - 'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(), |
|
699 | - 'hasFileinfoInstalled' => $this->hasFileinfoInstalled(), |
|
700 | - 'hasWorkingFileLocking' => $this->hasWorkingFileLocking(), |
|
701 | - 'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(), |
|
702 | - 'cronInfo' => $this->getLastCronInfo(), |
|
703 | - 'cronErrors' => $this->getCronErrors(), |
|
704 | - 'serverHasInternetConnectionProblems' => $this->hasInternetConnectivityProblems(), |
|
705 | - 'isMemcacheConfigured' => $this->isMemcacheConfigured(), |
|
706 | - 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), |
|
707 | - 'isRandomnessSecure' => $this->isRandomnessSecure(), |
|
708 | - 'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'), |
|
709 | - 'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(), |
|
710 | - 'phpSupported' => $this->isPhpSupported(), |
|
711 | - 'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(), |
|
712 | - 'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'), |
|
713 | - 'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(), |
|
714 | - 'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(), |
|
715 | - 'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'), |
|
716 | - 'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(), |
|
717 | - 'hasOpcacheLoaded' => $this->hasOpcacheLoaded(), |
|
718 | - 'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'), |
|
719 | - 'isSettimelimitAvailable' => $this->isSettimelimitAvailable(), |
|
720 | - 'hasFreeTypeSupport' => $this->hasFreeTypeSupport(), |
|
721 | - 'missingIndexes' => $this->hasMissingIndexes(), |
|
722 | - 'missingColumns' => $this->hasMissingColumns(), |
|
723 | - 'isSqliteUsed' => $this->isSqliteUsed(), |
|
724 | - 'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'), |
|
725 | - 'isPHPMailerUsed' => $this->isPHPMailerUsed(), |
|
726 | - 'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin'), |
|
727 | - 'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(), |
|
728 | - 'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(), |
|
729 | - 'recommendedPHPModules' => $this->hasRecommendedPHPModules(), |
|
730 | - 'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(), |
|
731 | - 'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(), |
|
732 | - 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(), |
|
733 | - 'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'), |
|
734 | - PhpDefaultCharset::class => ['pass' => $phpDefaultCharset->run(), 'description' => $phpDefaultCharset->description(), 'severity' => $phpDefaultCharset->severity()], |
|
735 | - PhpOutputBuffering::class => ['pass' => $phpOutputBuffering->run(), 'description' => $phpOutputBuffering->description(), 'severity' => $phpOutputBuffering->severity()], |
|
736 | - LegacySSEKeyFormat::class => ['pass' => $legacySSEKeyFormat->run(), 'description' => $legacySSEKeyFormat->description(), 'severity' => $legacySSEKeyFormat->severity(), 'linkToDocumentation' => $legacySSEKeyFormat->linkToDocumentation()], |
|
737 | - ] |
|
738 | - ); |
|
739 | - } |
|
392 | + $formattedTextResponse .= print_r($completeResults, true); |
|
393 | + } else { |
|
394 | + $formattedTextResponse = 'No errors have been found.'; |
|
395 | + } |
|
396 | + |
|
397 | + |
|
398 | + $response = new DataDisplayResponse( |
|
399 | + $formattedTextResponse, |
|
400 | + Http::STATUS_OK, |
|
401 | + [ |
|
402 | + 'Content-Type' => 'text/plain', |
|
403 | + ] |
|
404 | + ); |
|
405 | + |
|
406 | + return $response; |
|
407 | + } |
|
408 | + |
|
409 | + /** |
|
410 | + * Checks whether a PHP opcache is properly set up |
|
411 | + * @return bool |
|
412 | + */ |
|
413 | + protected function isOpcacheProperlySetup() { |
|
414 | + if (!$this->iniGetWrapper->getBool('opcache.enable')) { |
|
415 | + return false; |
|
416 | + } |
|
417 | + |
|
418 | + if (!$this->iniGetWrapper->getBool('opcache.save_comments')) { |
|
419 | + return false; |
|
420 | + } |
|
421 | + |
|
422 | + if ($this->iniGetWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { |
|
423 | + return false; |
|
424 | + } |
|
425 | + |
|
426 | + if ($this->iniGetWrapper->getNumeric('opcache.memory_consumption') < 128) { |
|
427 | + return false; |
|
428 | + } |
|
429 | + |
|
430 | + if ($this->iniGetWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { |
|
431 | + return false; |
|
432 | + } |
|
433 | + |
|
434 | + return true; |
|
435 | + } |
|
436 | + |
|
437 | + /** |
|
438 | + * Check if the required FreeType functions are present |
|
439 | + * @return bool |
|
440 | + */ |
|
441 | + protected function hasFreeTypeSupport() { |
|
442 | + return function_exists('imagettfbbox') && function_exists('imagettftext'); |
|
443 | + } |
|
444 | + |
|
445 | + protected function hasMissingIndexes(): array { |
|
446 | + $indexInfo = new MissingIndexInformation(); |
|
447 | + // Dispatch event so apps can also hint for pending index updates if needed |
|
448 | + $event = new GenericEvent($indexInfo); |
|
449 | + $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_INDEXES_EVENT, $event); |
|
450 | + |
|
451 | + return $indexInfo->getListOfMissingIndexes(); |
|
452 | + } |
|
453 | + |
|
454 | + protected function hasMissingColumns(): array { |
|
455 | + $indexInfo = new MissingColumnInformation(); |
|
456 | + // Dispatch event so apps can also hint for pending index updates if needed |
|
457 | + $event = new GenericEvent($indexInfo); |
|
458 | + $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, $event); |
|
459 | + |
|
460 | + return $indexInfo->getListOfMissingColumns(); |
|
461 | + } |
|
462 | + |
|
463 | + protected function isSqliteUsed() { |
|
464 | + return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false; |
|
465 | + } |
|
466 | + |
|
467 | + protected function isReadOnlyConfig(): bool { |
|
468 | + return \OC_Helper::isReadOnlyConfigEnabled(); |
|
469 | + } |
|
470 | + |
|
471 | + protected function hasValidTransactionIsolationLevel(): bool { |
|
472 | + try { |
|
473 | + if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { |
|
474 | + return true; |
|
475 | + } |
|
476 | + |
|
477 | + return $this->db->getTransactionIsolation() === Connection::TRANSACTION_READ_COMMITTED; |
|
478 | + } catch (DBALException $e) { |
|
479 | + // ignore |
|
480 | + } |
|
481 | + |
|
482 | + return true; |
|
483 | + } |
|
484 | + |
|
485 | + protected function hasFileinfoInstalled(): bool { |
|
486 | + return \OC_Util::fileInfoLoaded(); |
|
487 | + } |
|
488 | + |
|
489 | + protected function hasWorkingFileLocking(): bool { |
|
490 | + return !($this->lockingProvider instanceof NoopLockingProvider); |
|
491 | + } |
|
492 | + |
|
493 | + protected function getSuggestedOverwriteCliURL(): string { |
|
494 | + $suggestedOverwriteCliUrl = ''; |
|
495 | + if ($this->config->getSystemValue('overwrite.cli.url', '') === '') { |
|
496 | + $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT; |
|
497 | + if (!$this->config->getSystemValue('config_is_read_only', false)) { |
|
498 | + // Set the overwrite URL when it was not set yet. |
|
499 | + $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl); |
|
500 | + $suggestedOverwriteCliUrl = ''; |
|
501 | + } |
|
502 | + } |
|
503 | + return $suggestedOverwriteCliUrl; |
|
504 | + } |
|
505 | + |
|
506 | + protected function getLastCronInfo(): array { |
|
507 | + $lastCronRun = $this->config->getAppValue('core', 'lastcron', 0); |
|
508 | + return [ |
|
509 | + 'diffInSeconds' => time() - $lastCronRun, |
|
510 | + 'relativeTime' => $this->dateTimeFormatter->formatTimeSpan($lastCronRun), |
|
511 | + 'backgroundJobsUrl' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'server']) . '#backgroundjobs', |
|
512 | + ]; |
|
513 | + } |
|
514 | + |
|
515 | + protected function getCronErrors() { |
|
516 | + $errors = json_decode($this->config->getAppValue('core', 'cronErrors', ''), true); |
|
517 | + |
|
518 | + if (is_array($errors)) { |
|
519 | + return $errors; |
|
520 | + } |
|
521 | + |
|
522 | + return []; |
|
523 | + } |
|
524 | + |
|
525 | + protected function isPHPMailerUsed(): bool { |
|
526 | + return $this->config->getSystemValue('mail_smtpmode', 'smtp') === 'php'; |
|
527 | + } |
|
528 | + |
|
529 | + protected function hasOpcacheLoaded(): bool { |
|
530 | + return extension_loaded('Zend OPcache'); |
|
531 | + } |
|
532 | + |
|
533 | + /** |
|
534 | + * Iterates through the configured app roots and |
|
535 | + * tests if the subdirectories are owned by the same user than the current user. |
|
536 | + * |
|
537 | + * @return array |
|
538 | + */ |
|
539 | + protected function getAppDirsWithDifferentOwner(): array { |
|
540 | + $currentUser = posix_getuid(); |
|
541 | + $appDirsWithDifferentOwner = [[]]; |
|
542 | + |
|
543 | + foreach (OC::$APPSROOTS as $appRoot) { |
|
544 | + if ($appRoot['writable'] === true) { |
|
545 | + $appDirsWithDifferentOwner[] = $this->getAppDirsWithDifferentOwnerForAppRoot($currentUser, $appRoot); |
|
546 | + } |
|
547 | + } |
|
548 | + |
|
549 | + $appDirsWithDifferentOwner = array_merge(...$appDirsWithDifferentOwner); |
|
550 | + sort($appDirsWithDifferentOwner); |
|
551 | + |
|
552 | + return $appDirsWithDifferentOwner; |
|
553 | + } |
|
554 | + |
|
555 | + /** |
|
556 | + * Tests if the directories for one apps directory are writable by the current user. |
|
557 | + * |
|
558 | + * @param int $currentUser The current user |
|
559 | + * @param array $appRoot The app root config |
|
560 | + * @return string[] The none writable directory paths inside the app root |
|
561 | + */ |
|
562 | + private function getAppDirsWithDifferentOwnerForAppRoot(int $currentUser, array $appRoot): array { |
|
563 | + $appDirsWithDifferentOwner = []; |
|
564 | + $appsPath = $appRoot['path']; |
|
565 | + $appsDir = new DirectoryIterator($appRoot['path']); |
|
566 | + |
|
567 | + foreach ($appsDir as $fileInfo) { |
|
568 | + if ($fileInfo->isDir() && !$fileInfo->isDot()) { |
|
569 | + $absAppPath = $appsPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename(); |
|
570 | + $appDirUser = fileowner($absAppPath); |
|
571 | + if ($appDirUser !== $currentUser) { |
|
572 | + $appDirsWithDifferentOwner[] = $absAppPath; |
|
573 | + } |
|
574 | + } |
|
575 | + } |
|
576 | + |
|
577 | + return $appDirsWithDifferentOwner; |
|
578 | + } |
|
579 | + |
|
580 | + /** |
|
581 | + * Checks for potential PHP modules that would improve the instance |
|
582 | + * |
|
583 | + * @return string[] A list of PHP modules that is recommended |
|
584 | + */ |
|
585 | + protected function hasRecommendedPHPModules(): array { |
|
586 | + $recommendedPHPModules = []; |
|
587 | + |
|
588 | + if (!extension_loaded('intl')) { |
|
589 | + $recommendedPHPModules[] = 'intl'; |
|
590 | + } |
|
591 | + |
|
592 | + if (!extension_loaded('bcmath')) { |
|
593 | + $recommendedPHPModules[] = 'bcmath'; |
|
594 | + } |
|
595 | + |
|
596 | + if (!extension_loaded('gmp')) { |
|
597 | + $recommendedPHPModules[] = 'gmp'; |
|
598 | + } |
|
599 | + |
|
600 | + if ($this->config->getAppValue('theming', 'enabled', 'no') === 'yes') { |
|
601 | + if (!extension_loaded('imagick')) { |
|
602 | + $recommendedPHPModules[] = 'imagick'; |
|
603 | + } |
|
604 | + } |
|
605 | + |
|
606 | + return $recommendedPHPModules; |
|
607 | + } |
|
608 | + |
|
609 | + protected function isMysqlUsedWithoutUTF8MB4(): bool { |
|
610 | + return ($this->config->getSystemValue('dbtype', 'sqlite') === 'mysql') && ($this->config->getSystemValue('mysql.utf8mb4', false) === false); |
|
611 | + } |
|
612 | + |
|
613 | + protected function hasBigIntConversionPendingColumns(): array { |
|
614 | + // copy of ConvertFilecacheBigInt::getColumnsByTable() |
|
615 | + $tables = [ |
|
616 | + 'activity' => ['activity_id', 'object_id'], |
|
617 | + 'activity_mq' => ['mail_id'], |
|
618 | + 'authtoken' => ['id'], |
|
619 | + 'bruteforce_attempts' => ['id'], |
|
620 | + 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'], |
|
621 | + 'file_locks' => ['id'], |
|
622 | + 'jobs' => ['id'], |
|
623 | + 'mimetypes' => ['id'], |
|
624 | + 'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'], |
|
625 | + 'storages' => ['numeric_id'], |
|
626 | + ]; |
|
627 | + |
|
628 | + $schema = new SchemaWrapper($this->db); |
|
629 | + $isSqlite = $this->db->getDatabasePlatform() instanceof SqlitePlatform; |
|
630 | + $pendingColumns = []; |
|
631 | + |
|
632 | + foreach ($tables as $tableName => $columns) { |
|
633 | + if (!$schema->hasTable($tableName)) { |
|
634 | + continue; |
|
635 | + } |
|
636 | + |
|
637 | + $table = $schema->getTable($tableName); |
|
638 | + foreach ($columns as $columnName) { |
|
639 | + $column = $table->getColumn($columnName); |
|
640 | + $isAutoIncrement = $column->getAutoincrement(); |
|
641 | + $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; |
|
642 | + if ($column->getType()->getName() !== Types::BIGINT && !$isAutoIncrementOnSqlite) { |
|
643 | + $pendingColumns[] = $tableName . '.' . $columnName; |
|
644 | + } |
|
645 | + } |
|
646 | + } |
|
647 | + |
|
648 | + return $pendingColumns; |
|
649 | + } |
|
650 | + |
|
651 | + protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool { |
|
652 | + $objectStore = $this->config->getSystemValue('objectstore', null); |
|
653 | + $objectStoreMultibucket = $this->config->getSystemValue('objectstore_multibucket', null); |
|
654 | + |
|
655 | + if (!isset($objectStoreMultibucket) && !isset($objectStore)) { |
|
656 | + return true; |
|
657 | + } |
|
658 | + |
|
659 | + if (isset($objectStoreMultibucket['class']) && $objectStoreMultibucket['class'] !== 'OC\\Files\\ObjectStore\\S3') { |
|
660 | + return true; |
|
661 | + } |
|
662 | + |
|
663 | + if (isset($objectStore['class']) && $objectStore['class'] !== 'OC\\Files\\ObjectStore\\S3') { |
|
664 | + return true; |
|
665 | + } |
|
666 | + |
|
667 | + $tempPath = sys_get_temp_dir(); |
|
668 | + if (!is_dir($tempPath)) { |
|
669 | + $this->logger->error('Error while checking the temporary PHP path - it was not properly set to a directory. value: ' . $tempPath); |
|
670 | + return false; |
|
671 | + } |
|
672 | + $freeSpaceInTemp = disk_free_space($tempPath); |
|
673 | + if ($freeSpaceInTemp === false) { |
|
674 | + $this->logger->error('Error while checking the available disk space of temporary PHP path - no free disk space returned. temporary path: ' . $tempPath); |
|
675 | + return false; |
|
676 | + } |
|
677 | + |
|
678 | + $freeSpaceInTempInGB = $freeSpaceInTemp / 1024 / 1024 / 1024; |
|
679 | + if ($freeSpaceInTempInGB > 50) { |
|
680 | + return true; |
|
681 | + } |
|
682 | + |
|
683 | + $this->logger->warning('Checking the available space in the temporary path resulted in ' . round($freeSpaceInTempInGB, 1) . ' GB instead of the recommended 50GB. Path: ' . $tempPath); |
|
684 | + return false; |
|
685 | + } |
|
686 | + |
|
687 | + /** |
|
688 | + * @return DataResponse |
|
689 | + */ |
|
690 | + public function check() { |
|
691 | + $phpDefaultCharset = new PhpDefaultCharset(); |
|
692 | + $phpOutputBuffering = new PhpOutputBuffering(); |
|
693 | + $legacySSEKeyFormat = new LegacySSEKeyFormat($this->l10n, $this->config, $this->urlGenerator); |
|
694 | + return new DataResponse( |
|
695 | + [ |
|
696 | + 'isGetenvServerWorking' => !empty(getenv('PATH')), |
|
697 | + 'isReadOnlyConfig' => $this->isReadOnlyConfig(), |
|
698 | + 'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(), |
|
699 | + 'hasFileinfoInstalled' => $this->hasFileinfoInstalled(), |
|
700 | + 'hasWorkingFileLocking' => $this->hasWorkingFileLocking(), |
|
701 | + 'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(), |
|
702 | + 'cronInfo' => $this->getLastCronInfo(), |
|
703 | + 'cronErrors' => $this->getCronErrors(), |
|
704 | + 'serverHasInternetConnectionProblems' => $this->hasInternetConnectivityProblems(), |
|
705 | + 'isMemcacheConfigured' => $this->isMemcacheConfigured(), |
|
706 | + 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), |
|
707 | + 'isRandomnessSecure' => $this->isRandomnessSecure(), |
|
708 | + 'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'), |
|
709 | + 'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(), |
|
710 | + 'phpSupported' => $this->isPhpSupported(), |
|
711 | + 'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(), |
|
712 | + 'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'), |
|
713 | + 'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(), |
|
714 | + 'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(), |
|
715 | + 'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'), |
|
716 | + 'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(), |
|
717 | + 'hasOpcacheLoaded' => $this->hasOpcacheLoaded(), |
|
718 | + 'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'), |
|
719 | + 'isSettimelimitAvailable' => $this->isSettimelimitAvailable(), |
|
720 | + 'hasFreeTypeSupport' => $this->hasFreeTypeSupport(), |
|
721 | + 'missingIndexes' => $this->hasMissingIndexes(), |
|
722 | + 'missingColumns' => $this->hasMissingColumns(), |
|
723 | + 'isSqliteUsed' => $this->isSqliteUsed(), |
|
724 | + 'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'), |
|
725 | + 'isPHPMailerUsed' => $this->isPHPMailerUsed(), |
|
726 | + 'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin'), |
|
727 | + 'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(), |
|
728 | + 'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(), |
|
729 | + 'recommendedPHPModules' => $this->hasRecommendedPHPModules(), |
|
730 | + 'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(), |
|
731 | + 'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(), |
|
732 | + 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(), |
|
733 | + 'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'), |
|
734 | + PhpDefaultCharset::class => ['pass' => $phpDefaultCharset->run(), 'description' => $phpDefaultCharset->description(), 'severity' => $phpDefaultCharset->severity()], |
|
735 | + PhpOutputBuffering::class => ['pass' => $phpOutputBuffering->run(), 'description' => $phpOutputBuffering->description(), 'severity' => $phpOutputBuffering->severity()], |
|
736 | + LegacySSEKeyFormat::class => ['pass' => $legacySSEKeyFormat->run(), 'description' => $legacySSEKeyFormat->description(), 'severity' => $legacySSEKeyFormat->severity(), 'linkToDocumentation' => $legacySSEKeyFormat->linkToDocumentation()], |
|
737 | + ] |
|
738 | + ); |
|
739 | + } |
|
740 | 740 | } |