You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge the checks whether the module is loaded and whether the OPcache is properly configured. Reduce the overhead of OPcache configuration checks when the module is not loaded.
Add a check whether Nextcloud is permitted to use the OPcache API. Without this, inconsistencies during core or app upgrades may cause errors and OPcache usage cannot be determined.
Skip OPcache usage based checks when Nextcloud is not permitted to use the API.
// If the module is not loaded, return directly to skip inapplicable checks
440
+
if (!extension_loaded('Zend OPcache')) {
441
+
returnarray('The PHP OPcache module is not loaded. <a target="_blank" rel="noreferrer noopener" class="external" href="' + $this->urlGenerator->linkToDocs('admin-php-opcache') + '">For better performance it is recommended</a> to load it into your PHP installation.');
442
+
}
443
+
439
444
$recommendations = [];
440
445
446
+
// Check whether Nextcloud is allowed to use the OPcache API
if ($permittedPath) && !str_starts_with(\OC::$SERVERROOT, $permittedPath)) {
450
+
$isPermitted = false;
451
+
}
452
+
441
453
if (!$this->iniGetWrapper->getBool('opcache.enable')) {
442
454
$recommendations[] = 'OPcache is disabled. For better performance, it is recommended to apply <code>opcache.enable=1</code> to your PHP configuration.';
443
455
444
456
// Check for saved comments only when OPcache is currently disabled. If it was enabled, opcache.save_comments=0 would break Nextcloud in the first place.
445
457
if (!$this->iniGetWrapper->getBool('opcache.save_comments')) {
446
458
$recommendations[] = 'OPcache is configured to remove code comments. With OPcache enabled, <code>opcache.save_comments=1</code> must be set for Nextcloud to function.';
447
459
}
460
+
461
+
if (!$isPermitted) {
462
+
$recommendations[] = 'Nextcloud is not allowed to use the OPcache API. With OPcache enabled, it is highly recommended to include all Nextcloud directories with <code>opcache.restrict_api</code> or unset this setting to disable OPcache API restrictions, to prevent errors during Nextcloud core or app upgrades.';
463
+
}
464
+
} elseif (!$isPermitted) {
465
+
$recommendations[] = 'Nextcloud is not allowed to use the OPcache API. It is highly recommended to include all Nextcloud directories with <code>opcache.restrict_api</code> or unset this setting to disable OPcache API restrictions, to prevent errors during Nextcloud core or app upgrades.';
448
466
} else {
449
-
// Mute error when opcache.restrict_api is set and does not permit Nextcloud to use opcache_get_status(). All below conditions will then return false.
450
-
// ToDo: Add a check for opcache.restrict_api, since it can cause issues when Nextcloud cannot evict cached scripts: https://github.com/nextcloud/server/pull/8188
451
-
$status = @opcache_get_status(false);
467
+
$status = opcache_get_status(false);
452
468
453
469
// Recommend to raise value, if more than 90% of max value is reached
454
470
if ($status['opcache_statistics']['num_cached_keys'] / $status['opcache_statistics']['max_cached_keys'] > 0.9) {
@@ -564,10 +580,6 @@ protected function getCronErrors() {
Copy file name to clipboardExpand all lines: core/js/setupchecks.js
+5-12Lines changed: 5 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -322,23 +322,16 @@
322
322
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
323
323
});
324
324
}
325
-
if(!data.hasOpcacheLoaded){
326
-
messages.push({
327
-
msg: t('core','The PHP OPcache module is not loaded. {linkstart}For better performance it is recommended ↗{linkend} to load it into your PHP installation.')
0 commit comments