Passed
Push — master ( 301327...19171d )
by Roeland
11:33 queued 14s
created
apps/settings/lib/Controller/CheckSetupController.php 1 patch
Indentation   +644 added lines, -644 removed lines patch added patch discarded remove patch
@@ -70,288 +70,288 @@  discard block
 block discarded – undo
70 70
 use Symfony\Component\EventDispatcher\GenericEvent;
71 71
 
72 72
 class CheckSetupController extends Controller {
73
-	/** @var IConfig */
74
-	private $config;
75
-	/** @var IClientService */
76
-	private $clientService;
77
-	/** @var IURLGenerator */
78
-	private $urlGenerator;
79
-	/** @var IL10N */
80
-	private $l10n;
81
-	/** @var Checker */
82
-	private $checker;
83
-	/** @var ILogger */
84
-	private $logger;
85
-	/** @var EventDispatcherInterface */
86
-	private $dispatcher;
87
-	/** @var IDBConnection|Connection */
88
-	private $db;
89
-	/** @var ILockingProvider */
90
-	private $lockingProvider;
91
-	/** @var IDateTimeFormatter */
92
-	private $dateTimeFormatter;
93
-	/** @var MemoryInfo */
94
-	private $memoryInfo;
95
-	/** @var ISecureRandom */
96
-	private $secureRandom;
97
-
98
-	public function __construct($AppName,
99
-								IRequest $request,
100
-								IConfig $config,
101
-								IClientService $clientService,
102
-								IURLGenerator $urlGenerator,
103
-								IL10N $l10n,
104
-								Checker $checker,
105
-								ILogger $logger,
106
-								EventDispatcherInterface $dispatcher,
107
-								IDBConnection $db,
108
-								ILockingProvider $lockingProvider,
109
-								IDateTimeFormatter $dateTimeFormatter,
110
-								MemoryInfo $memoryInfo,
111
-								ISecureRandom $secureRandom) {
112
-		parent::__construct($AppName, $request);
113
-		$this->config = $config;
114
-		$this->clientService = $clientService;
115
-		$this->urlGenerator = $urlGenerator;
116
-		$this->l10n = $l10n;
117
-		$this->checker = $checker;
118
-		$this->logger = $logger;
119
-		$this->dispatcher = $dispatcher;
120
-		$this->db = $db;
121
-		$this->lockingProvider = $lockingProvider;
122
-		$this->dateTimeFormatter = $dateTimeFormatter;
123
-		$this->memoryInfo = $memoryInfo;
124
-		$this->secureRandom = $secureRandom;
125
-	}
126
-
127
-	/**
128
-	 * Checks if the server can connect to the internet using HTTPS and HTTP
129
-	 * @return bool
130
-	 */
131
-	private function hasInternetConnectivityProblems(): bool {
132
-		if ($this->config->getSystemValue('has_internet_connection', true) === false) {
133
-			return false;
134
-		}
135
-
136
-		$siteArray = $this->config->getSystemValue('connectivity_check_domains', [
137
-			'www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org'
138
-		]);
139
-
140
-		foreach ($siteArray as $site) {
141
-			if ($this->isSiteReachable($site)) {
142
-				return false;
143
-			}
144
-		}
145
-		return true;
146
-	}
147
-
148
-	/**
149
-	 * Checks if the Nextcloud server can connect to a specific URL using both HTTPS and HTTP
150
-	 * @return bool
151
-	 */
152
-	private function isSiteReachable($sitename) {
153
-		$httpSiteName = 'http://' . $sitename . '/';
154
-		$httpsSiteName = 'https://' . $sitename . '/';
155
-
156
-		try {
157
-			$client = $this->clientService->newClient();
158
-			$client->get($httpSiteName);
159
-			$client->get($httpsSiteName);
160
-		} catch (\Exception $e) {
161
-			$this->logger->logException($e, ['app' => 'internet_connection_check']);
162
-			return false;
163
-		}
164
-		return true;
165
-	}
166
-
167
-	/**
168
-	 * Checks whether a local memcache is installed or not
169
-	 * @return bool
170
-	 */
171
-	private function isMemcacheConfigured() {
172
-		return $this->config->getSystemValue('memcache.local', null) !== null;
173
-	}
174
-
175
-	/**
176
-	 * Whether PHP can generate "secure" pseudorandom integers
177
-	 *
178
-	 * @return bool
179
-	 */
180
-	private function isRandomnessSecure() {
181
-		try {
182
-			$this->secureRandom->generate(1);
183
-		} catch (\Exception $ex) {
184
-			return false;
185
-		}
186
-		return true;
187
-	}
188
-
189
-	/**
190
-	 * Public for the sake of unit-testing
191
-	 *
192
-	 * @return array
193
-	 */
194
-	protected function getCurlVersion() {
195
-		return curl_version();
196
-	}
197
-
198
-	/**
199
-	 * Check if the used  SSL lib is outdated. Older OpenSSL and NSS versions do
200
-	 * have multiple bugs which likely lead to problems in combination with
201
-	 * functionality required by ownCloud such as SNI.
202
-	 *
203
-	 * @link https://github.com/owncloud/core/issues/17446#issuecomment-122877546
204
-	 * @link https://bugzilla.redhat.com/show_bug.cgi?id=1241172
205
-	 * @return string
206
-	 */
207
-	private function isUsedTlsLibOutdated() {
208
-		// Don't run check when:
209
-		// 1. Server has `has_internet_connection` set to false
210
-		// 2. AppStore AND S2S is disabled
211
-		if (!$this->config->getSystemValue('has_internet_connection', true)) {
212
-			return '';
213
-		}
214
-		if (!$this->config->getSystemValue('appstoreenabled', true)
215
-			&& $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no'
216
-			&& $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') {
217
-			return '';
218
-		}
219
-
220
-		$versionString = $this->getCurlVersion();
221
-		if (isset($versionString['ssl_version'])) {
222
-			$versionString = $versionString['ssl_version'];
223
-		} else {
224
-			return '';
225
-		}
226
-
227
-		$features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing');
228
-		if (!$this->config->getSystemValue('appstoreenabled', true)) {
229
-			$features = (string)$this->l10n->t('Federated Cloud Sharing');
230
-		}
231
-
232
-		// Check if at least OpenSSL after 1.01d or 1.0.2b
233
-		if (strpos($versionString, 'OpenSSL/') === 0) {
234
-			$majorVersion = substr($versionString, 8, 5);
235
-			$patchRelease = substr($versionString, 13, 6);
236
-
237
-			if (($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) ||
238
-				($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) {
239
-				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]);
240
-			}
241
-		}
242
-
243
-		// Check if NSS and perform heuristic check
244
-		if (strpos($versionString, 'NSS/') === 0) {
245
-			try {
246
-				$firstClient = $this->clientService->newClient();
247
-				$firstClient->get('https://nextcloud.com/');
248
-
249
-				$secondClient = $this->clientService->newClient();
250
-				$secondClient->get('https://nextcloud.com/');
251
-			} catch (ClientException $e) {
252
-				if ($e->getResponse()->getStatusCode() === 400) {
253
-					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]);
254
-				}
255
-			}
256
-		}
257
-
258
-		return '';
259
-	}
260
-
261
-	/**
262
-	 * Whether the version is outdated
263
-	 *
264
-	 * @return bool
265
-	 */
266
-	protected function isPhpOutdated(): bool {
267
-		return PHP_VERSION_ID < 70300;
268
-	}
269
-
270
-	/**
271
-	 * Whether the php version is still supported (at time of release)
272
-	 * according to: https://secure.php.net/supported-versions.php
273
-	 *
274
-	 * @return array
275
-	 */
276
-	private function isPhpSupported(): array {
277
-		return ['eol' => $this->isPhpOutdated(), 'version' => PHP_VERSION];
278
-	}
279
-
280
-	/**
281
-	 * Check if the reverse proxy configuration is working as expected
282
-	 *
283
-	 * @return bool
284
-	 */
285
-	private function forwardedForHeadersWorking() {
286
-		$trustedProxies = $this->config->getSystemValue('trusted_proxies', []);
287
-		$remoteAddress = $this->request->getHeader('REMOTE_ADDR');
288
-
289
-		if (empty($trustedProxies) && $this->request->getHeader('X-Forwarded-Host') !== '') {
290
-			return false;
291
-		}
292
-
293
-		if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies, true)) {
294
-			return $remoteAddress !== $this->request->getRemoteAddress();
295
-		}
296
-
297
-		// either not enabled or working correctly
298
-		return true;
299
-	}
300
-
301
-	/**
302
-	 * Checks if the correct memcache module for PHP is installed. Only
303
-	 * fails if memcached is configured and the working module is not installed.
304
-	 *
305
-	 * @return bool
306
-	 */
307
-	private function isCorrectMemcachedPHPModuleInstalled() {
308
-		if ($this->config->getSystemValue('memcache.distributed', null) !== '\OC\Memcache\Memcached') {
309
-			return true;
310
-		}
311
-
312
-		// there are two different memcached modules for PHP
313
-		// we only support memcached and not memcache
314
-		// https://code.google.com/p/memcached/wiki/PHPClientComparison
315
-		return !(!extension_loaded('memcached') && extension_loaded('memcache'));
316
-	}
317
-
318
-	/**
319
-	 * Checks if set_time_limit is not disabled.
320
-	 *
321
-	 * @return bool
322
-	 */
323
-	private function isSettimelimitAvailable() {
324
-		if (function_exists('set_time_limit')
325
-			&& strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
326
-			return true;
327
-		}
328
-
329
-		return false;
330
-	}
331
-
332
-	/**
333
-	 * @return RedirectResponse
334
-	 */
335
-	public function rescanFailedIntegrityCheck() {
336
-		$this->checker->runInstanceVerification();
337
-		return new RedirectResponse(
338
-			$this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'overview'])
339
-		);
340
-	}
341
-
342
-	/**
343
-	 * @NoCSRFRequired
344
-	 * @return DataResponse
345
-	 */
346
-	public function getFailedIntegrityCheckFiles() {
347
-		if (!$this->checker->isCodeCheckEnforced()) {
348
-			return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.');
349
-		}
350
-
351
-		$completeResults = $this->checker->getResults();
352
-
353
-		if (!empty($completeResults)) {
354
-			$formattedTextResponse = 'Technical information
73
+    /** @var IConfig */
74
+    private $config;
75
+    /** @var IClientService */
76
+    private $clientService;
77
+    /** @var IURLGenerator */
78
+    private $urlGenerator;
79
+    /** @var IL10N */
80
+    private $l10n;
81
+    /** @var Checker */
82
+    private $checker;
83
+    /** @var ILogger */
84
+    private $logger;
85
+    /** @var EventDispatcherInterface */
86
+    private $dispatcher;
87
+    /** @var IDBConnection|Connection */
88
+    private $db;
89
+    /** @var ILockingProvider */
90
+    private $lockingProvider;
91
+    /** @var IDateTimeFormatter */
92
+    private $dateTimeFormatter;
93
+    /** @var MemoryInfo */
94
+    private $memoryInfo;
95
+    /** @var ISecureRandom */
96
+    private $secureRandom;
97
+
98
+    public function __construct($AppName,
99
+                                IRequest $request,
100
+                                IConfig $config,
101
+                                IClientService $clientService,
102
+                                IURLGenerator $urlGenerator,
103
+                                IL10N $l10n,
104
+                                Checker $checker,
105
+                                ILogger $logger,
106
+                                EventDispatcherInterface $dispatcher,
107
+                                IDBConnection $db,
108
+                                ILockingProvider $lockingProvider,
109
+                                IDateTimeFormatter $dateTimeFormatter,
110
+                                MemoryInfo $memoryInfo,
111
+                                ISecureRandom $secureRandom) {
112
+        parent::__construct($AppName, $request);
113
+        $this->config = $config;
114
+        $this->clientService = $clientService;
115
+        $this->urlGenerator = $urlGenerator;
116
+        $this->l10n = $l10n;
117
+        $this->checker = $checker;
118
+        $this->logger = $logger;
119
+        $this->dispatcher = $dispatcher;
120
+        $this->db = $db;
121
+        $this->lockingProvider = $lockingProvider;
122
+        $this->dateTimeFormatter = $dateTimeFormatter;
123
+        $this->memoryInfo = $memoryInfo;
124
+        $this->secureRandom = $secureRandom;
125
+    }
126
+
127
+    /**
128
+     * Checks if the server can connect to the internet using HTTPS and HTTP
129
+     * @return bool
130
+     */
131
+    private function hasInternetConnectivityProblems(): bool {
132
+        if ($this->config->getSystemValue('has_internet_connection', true) === false) {
133
+            return false;
134
+        }
135
+
136
+        $siteArray = $this->config->getSystemValue('connectivity_check_domains', [
137
+            'www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org'
138
+        ]);
139
+
140
+        foreach ($siteArray as $site) {
141
+            if ($this->isSiteReachable($site)) {
142
+                return false;
143
+            }
144
+        }
145
+        return true;
146
+    }
147
+
148
+    /**
149
+     * Checks if the Nextcloud server can connect to a specific URL using both HTTPS and HTTP
150
+     * @return bool
151
+     */
152
+    private function isSiteReachable($sitename) {
153
+        $httpSiteName = 'http://' . $sitename . '/';
154
+        $httpsSiteName = 'https://' . $sitename . '/';
155
+
156
+        try {
157
+            $client = $this->clientService->newClient();
158
+            $client->get($httpSiteName);
159
+            $client->get($httpsSiteName);
160
+        } catch (\Exception $e) {
161
+            $this->logger->logException($e, ['app' => 'internet_connection_check']);
162
+            return false;
163
+        }
164
+        return true;
165
+    }
166
+
167
+    /**
168
+     * Checks whether a local memcache is installed or not
169
+     * @return bool
170
+     */
171
+    private function isMemcacheConfigured() {
172
+        return $this->config->getSystemValue('memcache.local', null) !== null;
173
+    }
174
+
175
+    /**
176
+     * Whether PHP can generate "secure" pseudorandom integers
177
+     *
178
+     * @return bool
179
+     */
180
+    private function isRandomnessSecure() {
181
+        try {
182
+            $this->secureRandom->generate(1);
183
+        } catch (\Exception $ex) {
184
+            return false;
185
+        }
186
+        return true;
187
+    }
188
+
189
+    /**
190
+     * Public for the sake of unit-testing
191
+     *
192
+     * @return array
193
+     */
194
+    protected function getCurlVersion() {
195
+        return curl_version();
196
+    }
197
+
198
+    /**
199
+     * Check if the used  SSL lib is outdated. Older OpenSSL and NSS versions do
200
+     * have multiple bugs which likely lead to problems in combination with
201
+     * functionality required by ownCloud such as SNI.
202
+     *
203
+     * @link https://github.com/owncloud/core/issues/17446#issuecomment-122877546
204
+     * @link https://bugzilla.redhat.com/show_bug.cgi?id=1241172
205
+     * @return string
206
+     */
207
+    private function isUsedTlsLibOutdated() {
208
+        // Don't run check when:
209
+        // 1. Server has `has_internet_connection` set to false
210
+        // 2. AppStore AND S2S is disabled
211
+        if (!$this->config->getSystemValue('has_internet_connection', true)) {
212
+            return '';
213
+        }
214
+        if (!$this->config->getSystemValue('appstoreenabled', true)
215
+            && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no'
216
+            && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') {
217
+            return '';
218
+        }
219
+
220
+        $versionString = $this->getCurlVersion();
221
+        if (isset($versionString['ssl_version'])) {
222
+            $versionString = $versionString['ssl_version'];
223
+        } else {
224
+            return '';
225
+        }
226
+
227
+        $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing');
228
+        if (!$this->config->getSystemValue('appstoreenabled', true)) {
229
+            $features = (string)$this->l10n->t('Federated Cloud Sharing');
230
+        }
231
+
232
+        // Check if at least OpenSSL after 1.01d or 1.0.2b
233
+        if (strpos($versionString, 'OpenSSL/') === 0) {
234
+            $majorVersion = substr($versionString, 8, 5);
235
+            $patchRelease = substr($versionString, 13, 6);
236
+
237
+            if (($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) ||
238
+                ($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) {
239
+                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]);
240
+            }
241
+        }
242
+
243
+        // Check if NSS and perform heuristic check
244
+        if (strpos($versionString, 'NSS/') === 0) {
245
+            try {
246
+                $firstClient = $this->clientService->newClient();
247
+                $firstClient->get('https://nextcloud.com/');
248
+
249
+                $secondClient = $this->clientService->newClient();
250
+                $secondClient->get('https://nextcloud.com/');
251
+            } catch (ClientException $e) {
252
+                if ($e->getResponse()->getStatusCode() === 400) {
253
+                    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]);
254
+                }
255
+            }
256
+        }
257
+
258
+        return '';
259
+    }
260
+
261
+    /**
262
+     * Whether the version is outdated
263
+     *
264
+     * @return bool
265
+     */
266
+    protected function isPhpOutdated(): bool {
267
+        return PHP_VERSION_ID < 70300;
268
+    }
269
+
270
+    /**
271
+     * Whether the php version is still supported (at time of release)
272
+     * according to: https://secure.php.net/supported-versions.php
273
+     *
274
+     * @return array
275
+     */
276
+    private function isPhpSupported(): array {
277
+        return ['eol' => $this->isPhpOutdated(), 'version' => PHP_VERSION];
278
+    }
279
+
280
+    /**
281
+     * Check if the reverse proxy configuration is working as expected
282
+     *
283
+     * @return bool
284
+     */
285
+    private function forwardedForHeadersWorking() {
286
+        $trustedProxies = $this->config->getSystemValue('trusted_proxies', []);
287
+        $remoteAddress = $this->request->getHeader('REMOTE_ADDR');
288
+
289
+        if (empty($trustedProxies) && $this->request->getHeader('X-Forwarded-Host') !== '') {
290
+            return false;
291
+        }
292
+
293
+        if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies, true)) {
294
+            return $remoteAddress !== $this->request->getRemoteAddress();
295
+        }
296
+
297
+        // either not enabled or working correctly
298
+        return true;
299
+    }
300
+
301
+    /**
302
+     * Checks if the correct memcache module for PHP is installed. Only
303
+     * fails if memcached is configured and the working module is not installed.
304
+     *
305
+     * @return bool
306
+     */
307
+    private function isCorrectMemcachedPHPModuleInstalled() {
308
+        if ($this->config->getSystemValue('memcache.distributed', null) !== '\OC\Memcache\Memcached') {
309
+            return true;
310
+        }
311
+
312
+        // there are two different memcached modules for PHP
313
+        // we only support memcached and not memcache
314
+        // https://code.google.com/p/memcached/wiki/PHPClientComparison
315
+        return !(!extension_loaded('memcached') && extension_loaded('memcache'));
316
+    }
317
+
318
+    /**
319
+     * Checks if set_time_limit is not disabled.
320
+     *
321
+     * @return bool
322
+     */
323
+    private function isSettimelimitAvailable() {
324
+        if (function_exists('set_time_limit')
325
+            && strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
326
+            return true;
327
+        }
328
+
329
+        return false;
330
+    }
331
+
332
+    /**
333
+     * @return RedirectResponse
334
+     */
335
+    public function rescanFailedIntegrityCheck() {
336
+        $this->checker->runInstanceVerification();
337
+        return new RedirectResponse(
338
+            $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'overview'])
339
+        );
340
+    }
341
+
342
+    /**
343
+     * @NoCSRFRequired
344
+     * @return DataResponse
345
+     */
346
+    public function getFailedIntegrityCheckFiles() {
347
+        if (!$this->checker->isCodeCheckEnforced()) {
348
+            return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.');
349
+        }
350
+
351
+        $completeResults = $this->checker->getResults();
352
+
353
+        if (!empty($completeResults)) {
354
+            $formattedTextResponse = 'Technical information
355 355
 =====================
356 356
 The following list covers which files have failed the integrity check. Please read
357 357
 the previous linked documentation to learn more about the errors and how to fix
@@ -360,369 +360,369 @@  discard block
 block discarded – undo
360 360
 Results
361 361
 =======
362 362
 ';
363
-			foreach ($completeResults as $context => $contextResult) {
364
-				$formattedTextResponse .= "- $context\n";
365
-
366
-				foreach ($contextResult as $category => $result) {
367
-					$formattedTextResponse .= "\t- $category\n";
368
-					if ($category !== 'EXCEPTION') {
369
-						foreach ($result as $key => $results) {
370
-							$formattedTextResponse .= "\t\t- $key\n";
371
-						}
372
-					} else {
373
-						foreach ($result as $key => $results) {
374
-							$formattedTextResponse .= "\t\t- $results\n";
375
-						}
376
-					}
377
-				}
378
-			}
379
-
380
-			$formattedTextResponse .= '
363
+            foreach ($completeResults as $context => $contextResult) {
364
+                $formattedTextResponse .= "- $context\n";
365
+
366
+                foreach ($contextResult as $category => $result) {
367
+                    $formattedTextResponse .= "\t- $category\n";
368
+                    if ($category !== 'EXCEPTION') {
369
+                        foreach ($result as $key => $results) {
370
+                            $formattedTextResponse .= "\t\t- $key\n";
371
+                        }
372
+                    } else {
373
+                        foreach ($result as $key => $results) {
374
+                            $formattedTextResponse .= "\t\t- $results\n";
375
+                        }
376
+                    }
377
+                }
378
+            }
379
+
380
+            $formattedTextResponse .= '
381 381
 Raw output
382 382
 ==========
383 383
 ';
384
-			$formattedTextResponse .= print_r($completeResults, true);
385
-		} else {
386
-			$formattedTextResponse = 'No errors have been found.';
387
-		}
388
-
389
-
390
-		$response = new DataDisplayResponse(
391
-			$formattedTextResponse,
392
-			Http::STATUS_OK,
393
-			[
394
-				'Content-Type' => 'text/plain',
395
-			]
396
-		);
397
-
398
-		return $response;
399
-	}
400
-
401
-	/**
402
-	 * Checks whether a PHP opcache is properly set up
403
-	 * @return bool
404
-	 */
405
-	protected function isOpcacheProperlySetup() {
406
-		$iniWrapper = new IniGetWrapper();
407
-
408
-		if (!$iniWrapper->getBool('opcache.enable')) {
409
-			return false;
410
-		}
411
-
412
-		if (!$iniWrapper->getBool('opcache.save_comments')) {
413
-			return false;
414
-		}
415
-
416
-		if ($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) {
417
-			return false;
418
-		}
419
-
420
-		if ($iniWrapper->getNumeric('opcache.memory_consumption') < 128) {
421
-			return false;
422
-		}
423
-
424
-		if ($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) {
425
-			return false;
426
-		}
427
-
428
-		return true;
429
-	}
430
-
431
-	/**
432
-	 * Check if the required FreeType functions are present
433
-	 * @return bool
434
-	 */
435
-	protected function hasFreeTypeSupport() {
436
-		return function_exists('imagettfbbox') && function_exists('imagettftext');
437
-	}
438
-
439
-	protected function hasMissingIndexes(): array {
440
-		$indexInfo = new MissingIndexInformation();
441
-		// Dispatch event so apps can also hint for pending index updates if needed
442
-		$event = new GenericEvent($indexInfo);
443
-		$this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_INDEXES_EVENT, $event);
444
-
445
-		return $indexInfo->getListOfMissingIndexes();
446
-	}
447
-
448
-	protected function hasMissingColumns(): array {
449
-		$indexInfo = new MissingColumnInformation();
450
-		// Dispatch event so apps can also hint for pending index updates if needed
451
-		$event = new GenericEvent($indexInfo);
452
-		$this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, $event);
453
-
454
-		return $indexInfo->getListOfMissingColumns();
455
-	}
456
-
457
-	protected function isSqliteUsed() {
458
-		return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false;
459
-	}
460
-
461
-	protected function isReadOnlyConfig(): bool {
462
-		return \OC_Helper::isReadOnlyConfigEnabled();
463
-	}
464
-
465
-	protected function hasValidTransactionIsolationLevel(): bool {
466
-		try {
467
-			if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) {
468
-				return true;
469
-			}
470
-
471
-			return $this->db->getTransactionIsolation() === Connection::TRANSACTION_READ_COMMITTED;
472
-		} catch (DBALException $e) {
473
-			// ignore
474
-		}
475
-
476
-		return true;
477
-	}
478
-
479
-	protected function hasFileinfoInstalled(): bool {
480
-		return \OC_Util::fileInfoLoaded();
481
-	}
482
-
483
-	protected function hasWorkingFileLocking(): bool {
484
-		return !($this->lockingProvider instanceof NoopLockingProvider);
485
-	}
486
-
487
-	protected function getSuggestedOverwriteCliURL(): string {
488
-		$suggestedOverwriteCliUrl = '';
489
-		if ($this->config->getSystemValue('overwrite.cli.url', '') === '') {
490
-			$suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
491
-			if (!$this->config->getSystemValue('config_is_read_only', false)) {
492
-				// Set the overwrite URL when it was not set yet.
493
-				$this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl);
494
-				$suggestedOverwriteCliUrl = '';
495
-			}
496
-		}
497
-		return $suggestedOverwriteCliUrl;
498
-	}
499
-
500
-	protected function getLastCronInfo(): array {
501
-		$lastCronRun = $this->config->getAppValue('core', 'lastcron', 0);
502
-		return [
503
-			'diffInSeconds' => time() - $lastCronRun,
504
-			'relativeTime' => $this->dateTimeFormatter->formatTimeSpan($lastCronRun),
505
-			'backgroundJobsUrl' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'server']) . '#backgroundjobs',
506
-		];
507
-	}
508
-
509
-	protected function getCronErrors() {
510
-		$errors = json_decode($this->config->getAppValue('core', 'cronErrors', ''), true);
511
-
512
-		if (is_array($errors)) {
513
-			return $errors;
514
-		}
515
-
516
-		return [];
517
-	}
518
-
519
-	protected function isPHPMailerUsed(): bool {
520
-		return $this->config->getSystemValue('mail_smtpmode', 'smtp') === 'php';
521
-	}
522
-
523
-	protected function hasOpcacheLoaded(): bool {
524
-		return extension_loaded('Zend OPcache');
525
-	}
526
-
527
-	/**
528
-	 * Iterates through the configured app roots and
529
-	 * tests if the subdirectories are owned by the same user than the current user.
530
-	 *
531
-	 * @return array
532
-	 */
533
-	protected function getAppDirsWithDifferentOwner(): array {
534
-		$currentUser = posix_getuid();
535
-		$appDirsWithDifferentOwner = [[]];
536
-
537
-		foreach (OC::$APPSROOTS as $appRoot) {
538
-			if ($appRoot['writable'] === true) {
539
-				$appDirsWithDifferentOwner[] = $this->getAppDirsWithDifferentOwnerForAppRoot($currentUser, $appRoot);
540
-			}
541
-		}
542
-
543
-		$appDirsWithDifferentOwner = array_merge(...$appDirsWithDifferentOwner);
544
-		sort($appDirsWithDifferentOwner);
545
-
546
-		return $appDirsWithDifferentOwner;
547
-	}
548
-
549
-	/**
550
-	 * Tests if the directories for one apps directory are writable by the current user.
551
-	 *
552
-	 * @param int $currentUser The current user
553
-	 * @param array $appRoot The app root config
554
-	 * @return string[] The none writable directory paths inside the app root
555
-	 */
556
-	private function getAppDirsWithDifferentOwnerForAppRoot(int $currentUser, array $appRoot): array {
557
-		$appDirsWithDifferentOwner = [];
558
-		$appsPath = $appRoot['path'];
559
-		$appsDir = new DirectoryIterator($appRoot['path']);
560
-
561
-		foreach ($appsDir as $fileInfo) {
562
-			if ($fileInfo->isDir() && !$fileInfo->isDot()) {
563
-				$absAppPath = $appsPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename();
564
-				$appDirUser = fileowner($absAppPath);
565
-				if ($appDirUser !== $currentUser) {
566
-					$appDirsWithDifferentOwner[] = $absAppPath;
567
-				}
568
-			}
569
-		}
570
-
571
-		return $appDirsWithDifferentOwner;
572
-	}
573
-
574
-	/**
575
-	 * Checks for potential PHP modules that would improve the instance
576
-	 *
577
-	 * @return string[] A list of PHP modules that is recommended
578
-	 */
579
-	protected function hasRecommendedPHPModules(): array {
580
-		$recommendedPHPModules = [];
581
-
582
-		if (!extension_loaded('intl')) {
583
-			$recommendedPHPModules[] = 'intl';
584
-		}
585
-
586
-		if (!extension_loaded('bcmath')) {
587
-			$recommendedPHPModules[] = 'bcmath';
588
-		}
589
-
590
-		if (!extension_loaded('gmp')) {
591
-			$recommendedPHPModules[] = 'gmp';
592
-		}
593
-
594
-		if ($this->config->getAppValue('theming', 'enabled', 'no') === 'yes') {
595
-			if (!extension_loaded('imagick')) {
596
-				$recommendedPHPModules[] = 'imagick';
597
-			}
598
-		}
599
-
600
-		return $recommendedPHPModules;
601
-	}
602
-
603
-	protected function isMysqlUsedWithoutUTF8MB4(): bool {
604
-		return ($this->config->getSystemValue('dbtype', 'sqlite') === 'mysql') && ($this->config->getSystemValue('mysql.utf8mb4', false) === false);
605
-	}
606
-
607
-	protected function hasBigIntConversionPendingColumns(): array {
608
-		// copy of ConvertFilecacheBigInt::getColumnsByTable()
609
-		$tables = [
610
-			'activity' => ['activity_id', 'object_id'],
611
-			'activity_mq' => ['mail_id'],
612
-			'authtoken' => ['id'],
613
-			'bruteforce_attempts' => ['id'],
614
-			'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'],
615
-			'file_locks' => ['id'],
616
-			'jobs' => ['id'],
617
-			'mimetypes' => ['id'],
618
-			'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'],
619
-			'storages' => ['numeric_id'],
620
-		];
621
-
622
-		$schema = new SchemaWrapper($this->db);
623
-		$isSqlite = $this->db->getDatabasePlatform() instanceof SqlitePlatform;
624
-		$pendingColumns = [];
625
-
626
-		foreach ($tables as $tableName => $columns) {
627
-			if (!$schema->hasTable($tableName)) {
628
-				continue;
629
-			}
630
-
631
-			$table = $schema->getTable($tableName);
632
-			foreach ($columns as $columnName) {
633
-				$column = $table->getColumn($columnName);
634
-				$isAutoIncrement = $column->getAutoincrement();
635
-				$isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement;
636
-				if ($column->getType()->getName() !== Type::BIGINT && !$isAutoIncrementOnSqlite) {
637
-					$pendingColumns[] = $tableName . '.' . $columnName;
638
-				}
639
-			}
640
-		}
641
-
642
-		return $pendingColumns;
643
-	}
644
-
645
-	protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool {
646
-		$objectStore = $this->config->getSystemValue('objectstore', null);
647
-		$objectStoreMultibucket = $this->config->getSystemValue('objectstore_multibucket', null);
648
-
649
-		if (!isset($objectStoreMultibucket) && !isset($objectStore)) {
650
-			return true;
651
-		}
652
-
653
-		if (isset($objectStoreMultibucket['class']) && $objectStoreMultibucket['class'] !== 'OC\\Files\\ObjectStore\\S3') {
654
-			return true;
655
-		}
656
-
657
-		if (isset($objectStore['class']) && $objectStore['class'] !== 'OC\\Files\\ObjectStore\\S3') {
658
-			return true;
659
-		}
660
-
661
-		$tempPath = sys_get_temp_dir();
662
-		if (!is_dir($tempPath)) {
663
-			$this->logger->error('Error while checking the temporary PHP path - it was not properly set to a directory. value: ' . $tempPath);
664
-			return false;
665
-		}
666
-		$freeSpaceInTemp = disk_free_space($tempPath);
667
-		if ($freeSpaceInTemp === false) {
668
-			$this->logger->error('Error while checking the available disk space of temporary PHP path - no free disk space returned. temporary path: ' . $tempPath);
669
-			return false;
670
-		}
671
-
672
-		$freeSpaceInTempInGB = $freeSpaceInTemp / 1024 / 1024 / 1024;
673
-		if ($freeSpaceInTempInGB > 50) {
674
-			return true;
675
-		}
676
-
677
-		$this->logger->warning('Checking the available space in the temporary path resulted in ' . round($freeSpaceInTempInGB, 1) . ' GB instead of the recommended 50GB. Path: ' . $tempPath);
678
-		return false;
679
-	}
680
-
681
-	/**
682
-	 * @return DataResponse
683
-	 */
684
-	public function check() {
685
-		return new DataResponse(
686
-			[
687
-				'isGetenvServerWorking' => !empty(getenv('PATH')),
688
-				'isReadOnlyConfig' => $this->isReadOnlyConfig(),
689
-				'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(),
690
-				'hasFileinfoInstalled' => $this->hasFileinfoInstalled(),
691
-				'hasWorkingFileLocking' => $this->hasWorkingFileLocking(),
692
-				'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(),
693
-				'cronInfo' => $this->getLastCronInfo(),
694
-				'cronErrors' => $this->getCronErrors(),
695
-				'serverHasInternetConnectionProblems' => $this->hasInternetConnectivityProblems(),
696
-				'isMemcacheConfigured' => $this->isMemcacheConfigured(),
697
-				'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'),
698
-				'isRandomnessSecure' => $this->isRandomnessSecure(),
699
-				'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'),
700
-				'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(),
701
-				'phpSupported' => $this->isPhpSupported(),
702
-				'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(),
703
-				'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'),
704
-				'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(),
705
-				'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(),
706
-				'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'),
707
-				'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(),
708
-				'hasOpcacheLoaded' => $this->hasOpcacheLoaded(),
709
-				'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'),
710
-				'isSettimelimitAvailable' => $this->isSettimelimitAvailable(),
711
-				'hasFreeTypeSupport' => $this->hasFreeTypeSupport(),
712
-				'missingIndexes' => $this->hasMissingIndexes(),
713
-				'missingColumns' => $this->hasMissingColumns(),
714
-				'isSqliteUsed' => $this->isSqliteUsed(),
715
-				'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'),
716
-				'isPHPMailerUsed' => $this->isPHPMailerUsed(),
717
-				'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin'),
718
-				'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(),
719
-				'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(),
720
-				'recommendedPHPModules' => $this->hasRecommendedPHPModules(),
721
-				'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(),
722
-				'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(),
723
-				'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(),
724
-				'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'),
725
-			]
726
-		);
727
-	}
384
+            $formattedTextResponse .= print_r($completeResults, true);
385
+        } else {
386
+            $formattedTextResponse = 'No errors have been found.';
387
+        }
388
+
389
+
390
+        $response = new DataDisplayResponse(
391
+            $formattedTextResponse,
392
+            Http::STATUS_OK,
393
+            [
394
+                'Content-Type' => 'text/plain',
395
+            ]
396
+        );
397
+
398
+        return $response;
399
+    }
400
+
401
+    /**
402
+     * Checks whether a PHP opcache is properly set up
403
+     * @return bool
404
+     */
405
+    protected function isOpcacheProperlySetup() {
406
+        $iniWrapper = new IniGetWrapper();
407
+
408
+        if (!$iniWrapper->getBool('opcache.enable')) {
409
+            return false;
410
+        }
411
+
412
+        if (!$iniWrapper->getBool('opcache.save_comments')) {
413
+            return false;
414
+        }
415
+
416
+        if ($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) {
417
+            return false;
418
+        }
419
+
420
+        if ($iniWrapper->getNumeric('opcache.memory_consumption') < 128) {
421
+            return false;
422
+        }
423
+
424
+        if ($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) {
425
+            return false;
426
+        }
427
+
428
+        return true;
429
+    }
430
+
431
+    /**
432
+     * Check if the required FreeType functions are present
433
+     * @return bool
434
+     */
435
+    protected function hasFreeTypeSupport() {
436
+        return function_exists('imagettfbbox') && function_exists('imagettftext');
437
+    }
438
+
439
+    protected function hasMissingIndexes(): array {
440
+        $indexInfo = new MissingIndexInformation();
441
+        // Dispatch event so apps can also hint for pending index updates if needed
442
+        $event = new GenericEvent($indexInfo);
443
+        $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_INDEXES_EVENT, $event);
444
+
445
+        return $indexInfo->getListOfMissingIndexes();
446
+    }
447
+
448
+    protected function hasMissingColumns(): array {
449
+        $indexInfo = new MissingColumnInformation();
450
+        // Dispatch event so apps can also hint for pending index updates if needed
451
+        $event = new GenericEvent($indexInfo);
452
+        $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, $event);
453
+
454
+        return $indexInfo->getListOfMissingColumns();
455
+    }
456
+
457
+    protected function isSqliteUsed() {
458
+        return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false;
459
+    }
460
+
461
+    protected function isReadOnlyConfig(): bool {
462
+        return \OC_Helper::isReadOnlyConfigEnabled();
463
+    }
464
+
465
+    protected function hasValidTransactionIsolationLevel(): bool {
466
+        try {
467
+            if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) {
468
+                return true;
469
+            }
470
+
471
+            return $this->db->getTransactionIsolation() === Connection::TRANSACTION_READ_COMMITTED;
472
+        } catch (DBALException $e) {
473
+            // ignore
474
+        }
475
+
476
+        return true;
477
+    }
478
+
479
+    protected function hasFileinfoInstalled(): bool {
480
+        return \OC_Util::fileInfoLoaded();
481
+    }
482
+
483
+    protected function hasWorkingFileLocking(): bool {
484
+        return !($this->lockingProvider instanceof NoopLockingProvider);
485
+    }
486
+
487
+    protected function getSuggestedOverwriteCliURL(): string {
488
+        $suggestedOverwriteCliUrl = '';
489
+        if ($this->config->getSystemValue('overwrite.cli.url', '') === '') {
490
+            $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
491
+            if (!$this->config->getSystemValue('config_is_read_only', false)) {
492
+                // Set the overwrite URL when it was not set yet.
493
+                $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl);
494
+                $suggestedOverwriteCliUrl = '';
495
+            }
496
+        }
497
+        return $suggestedOverwriteCliUrl;
498
+    }
499
+
500
+    protected function getLastCronInfo(): array {
501
+        $lastCronRun = $this->config->getAppValue('core', 'lastcron', 0);
502
+        return [
503
+            'diffInSeconds' => time() - $lastCronRun,
504
+            'relativeTime' => $this->dateTimeFormatter->formatTimeSpan($lastCronRun),
505
+            'backgroundJobsUrl' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'server']) . '#backgroundjobs',
506
+        ];
507
+    }
508
+
509
+    protected function getCronErrors() {
510
+        $errors = json_decode($this->config->getAppValue('core', 'cronErrors', ''), true);
511
+
512
+        if (is_array($errors)) {
513
+            return $errors;
514
+        }
515
+
516
+        return [];
517
+    }
518
+
519
+    protected function isPHPMailerUsed(): bool {
520
+        return $this->config->getSystemValue('mail_smtpmode', 'smtp') === 'php';
521
+    }
522
+
523
+    protected function hasOpcacheLoaded(): bool {
524
+        return extension_loaded('Zend OPcache');
525
+    }
526
+
527
+    /**
528
+     * Iterates through the configured app roots and
529
+     * tests if the subdirectories are owned by the same user than the current user.
530
+     *
531
+     * @return array
532
+     */
533
+    protected function getAppDirsWithDifferentOwner(): array {
534
+        $currentUser = posix_getuid();
535
+        $appDirsWithDifferentOwner = [[]];
536
+
537
+        foreach (OC::$APPSROOTS as $appRoot) {
538
+            if ($appRoot['writable'] === true) {
539
+                $appDirsWithDifferentOwner[] = $this->getAppDirsWithDifferentOwnerForAppRoot($currentUser, $appRoot);
540
+            }
541
+        }
542
+
543
+        $appDirsWithDifferentOwner = array_merge(...$appDirsWithDifferentOwner);
544
+        sort($appDirsWithDifferentOwner);
545
+
546
+        return $appDirsWithDifferentOwner;
547
+    }
548
+
549
+    /**
550
+     * Tests if the directories for one apps directory are writable by the current user.
551
+     *
552
+     * @param int $currentUser The current user
553
+     * @param array $appRoot The app root config
554
+     * @return string[] The none writable directory paths inside the app root
555
+     */
556
+    private function getAppDirsWithDifferentOwnerForAppRoot(int $currentUser, array $appRoot): array {
557
+        $appDirsWithDifferentOwner = [];
558
+        $appsPath = $appRoot['path'];
559
+        $appsDir = new DirectoryIterator($appRoot['path']);
560
+
561
+        foreach ($appsDir as $fileInfo) {
562
+            if ($fileInfo->isDir() && !$fileInfo->isDot()) {
563
+                $absAppPath = $appsPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename();
564
+                $appDirUser = fileowner($absAppPath);
565
+                if ($appDirUser !== $currentUser) {
566
+                    $appDirsWithDifferentOwner[] = $absAppPath;
567
+                }
568
+            }
569
+        }
570
+
571
+        return $appDirsWithDifferentOwner;
572
+    }
573
+
574
+    /**
575
+     * Checks for potential PHP modules that would improve the instance
576
+     *
577
+     * @return string[] A list of PHP modules that is recommended
578
+     */
579
+    protected function hasRecommendedPHPModules(): array {
580
+        $recommendedPHPModules = [];
581
+
582
+        if (!extension_loaded('intl')) {
583
+            $recommendedPHPModules[] = 'intl';
584
+        }
585
+
586
+        if (!extension_loaded('bcmath')) {
587
+            $recommendedPHPModules[] = 'bcmath';
588
+        }
589
+
590
+        if (!extension_loaded('gmp')) {
591
+            $recommendedPHPModules[] = 'gmp';
592
+        }
593
+
594
+        if ($this->config->getAppValue('theming', 'enabled', 'no') === 'yes') {
595
+            if (!extension_loaded('imagick')) {
596
+                $recommendedPHPModules[] = 'imagick';
597
+            }
598
+        }
599
+
600
+        return $recommendedPHPModules;
601
+    }
602
+
603
+    protected function isMysqlUsedWithoutUTF8MB4(): bool {
604
+        return ($this->config->getSystemValue('dbtype', 'sqlite') === 'mysql') && ($this->config->getSystemValue('mysql.utf8mb4', false) === false);
605
+    }
606
+
607
+    protected function hasBigIntConversionPendingColumns(): array {
608
+        // copy of ConvertFilecacheBigInt::getColumnsByTable()
609
+        $tables = [
610
+            'activity' => ['activity_id', 'object_id'],
611
+            'activity_mq' => ['mail_id'],
612
+            'authtoken' => ['id'],
613
+            'bruteforce_attempts' => ['id'],
614
+            'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'],
615
+            'file_locks' => ['id'],
616
+            'jobs' => ['id'],
617
+            'mimetypes' => ['id'],
618
+            'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'],
619
+            'storages' => ['numeric_id'],
620
+        ];
621
+
622
+        $schema = new SchemaWrapper($this->db);
623
+        $isSqlite = $this->db->getDatabasePlatform() instanceof SqlitePlatform;
624
+        $pendingColumns = [];
625
+
626
+        foreach ($tables as $tableName => $columns) {
627
+            if (!$schema->hasTable($tableName)) {
628
+                continue;
629
+            }
630
+
631
+            $table = $schema->getTable($tableName);
632
+            foreach ($columns as $columnName) {
633
+                $column = $table->getColumn($columnName);
634
+                $isAutoIncrement = $column->getAutoincrement();
635
+                $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement;
636
+                if ($column->getType()->getName() !== Type::BIGINT && !$isAutoIncrementOnSqlite) {
637
+                    $pendingColumns[] = $tableName . '.' . $columnName;
638
+                }
639
+            }
640
+        }
641
+
642
+        return $pendingColumns;
643
+    }
644
+
645
+    protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool {
646
+        $objectStore = $this->config->getSystemValue('objectstore', null);
647
+        $objectStoreMultibucket = $this->config->getSystemValue('objectstore_multibucket', null);
648
+
649
+        if (!isset($objectStoreMultibucket) && !isset($objectStore)) {
650
+            return true;
651
+        }
652
+
653
+        if (isset($objectStoreMultibucket['class']) && $objectStoreMultibucket['class'] !== 'OC\\Files\\ObjectStore\\S3') {
654
+            return true;
655
+        }
656
+
657
+        if (isset($objectStore['class']) && $objectStore['class'] !== 'OC\\Files\\ObjectStore\\S3') {
658
+            return true;
659
+        }
660
+
661
+        $tempPath = sys_get_temp_dir();
662
+        if (!is_dir($tempPath)) {
663
+            $this->logger->error('Error while checking the temporary PHP path - it was not properly set to a directory. value: ' . $tempPath);
664
+            return false;
665
+        }
666
+        $freeSpaceInTemp = disk_free_space($tempPath);
667
+        if ($freeSpaceInTemp === false) {
668
+            $this->logger->error('Error while checking the available disk space of temporary PHP path - no free disk space returned. temporary path: ' . $tempPath);
669
+            return false;
670
+        }
671
+
672
+        $freeSpaceInTempInGB = $freeSpaceInTemp / 1024 / 1024 / 1024;
673
+        if ($freeSpaceInTempInGB > 50) {
674
+            return true;
675
+        }
676
+
677
+        $this->logger->warning('Checking the available space in the temporary path resulted in ' . round($freeSpaceInTempInGB, 1) . ' GB instead of the recommended 50GB. Path: ' . $tempPath);
678
+        return false;
679
+    }
680
+
681
+    /**
682
+     * @return DataResponse
683
+     */
684
+    public function check() {
685
+        return new DataResponse(
686
+            [
687
+                'isGetenvServerWorking' => !empty(getenv('PATH')),
688
+                'isReadOnlyConfig' => $this->isReadOnlyConfig(),
689
+                'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(),
690
+                'hasFileinfoInstalled' => $this->hasFileinfoInstalled(),
691
+                'hasWorkingFileLocking' => $this->hasWorkingFileLocking(),
692
+                'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(),
693
+                'cronInfo' => $this->getLastCronInfo(),
694
+                'cronErrors' => $this->getCronErrors(),
695
+                'serverHasInternetConnectionProblems' => $this->hasInternetConnectivityProblems(),
696
+                'isMemcacheConfigured' => $this->isMemcacheConfigured(),
697
+                'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'),
698
+                'isRandomnessSecure' => $this->isRandomnessSecure(),
699
+                'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'),
700
+                'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(),
701
+                'phpSupported' => $this->isPhpSupported(),
702
+                'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(),
703
+                'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'),
704
+                'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(),
705
+                'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(),
706
+                'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'),
707
+                'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(),
708
+                'hasOpcacheLoaded' => $this->hasOpcacheLoaded(),
709
+                'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'),
710
+                'isSettimelimitAvailable' => $this->isSettimelimitAvailable(),
711
+                'hasFreeTypeSupport' => $this->hasFreeTypeSupport(),
712
+                'missingIndexes' => $this->hasMissingIndexes(),
713
+                'missingColumns' => $this->hasMissingColumns(),
714
+                'isSqliteUsed' => $this->isSqliteUsed(),
715
+                'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'),
716
+                'isPHPMailerUsed' => $this->isPHPMailerUsed(),
717
+                'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin'),
718
+                'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(),
719
+                'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(),
720
+                'recommendedPHPModules' => $this->hasRecommendedPHPModules(),
721
+                'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(),
722
+                'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(),
723
+                'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(),
724
+                'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'),
725
+            ]
726
+        );
727
+    }
728 728
 }
Please login to merge, or discard this patch.