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