Nextcloud version: 27.1.0
Operating system and version: Debian12
Apache version: Apache/2.4.57
PHP version: 8.2.7
Enabling maintenance mode doesn’t take effect until I restart the service.
This is the first time I notice this bug.
Steps to replicate it:
With root access I enable maintenance mode with command php occ maintenance:mode --on which gives me the message: “Maintenance mode enabled”
When I go on instance’s website I see that maintenance mode is not enabled.
Maintenance mode is only activated after restarting Apache2 (But this is not what I want)
At the moment of running php occ maintenance:mode --on I see this message written in Nextcloud’s logs:
{"reqId":"xxxxxxxxx","level":0,"time":"2023-09-19T04:32:29+00:00","remoteAddr":"","user":"--","app":"serverDI","method":"","url":"--","message":"The requested alias \"SystemConfig\" is deprecated. Please request \"OC\\SystemConfig\" directly. This alias will be removed in a future Nextcloud version.","userAgent":"--","version":"27.1.0.7","data":{"app":"serverDI"}}
Hi, I see there is a Please request \"OC\\SystemConfig\" directly
and you are attempting this as root when Nextcloud is using www-data from Debian and Ubuntu.
You can also check the ownership and permissions of nextcloud system folder on the server with ls -la to confirm whether it is owned by some variation or root instead of www-data:www-data
I’m accessing Nexctloud server with root and running the occ command using www-data like so: sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
ls -la of Nextcloud’s directory gives the ownership: www-data:www-data
So, the solution is either to change the value of opcache.validate_timestamps or each time restart PHP, manually clear the cache, or invalidate this particular script in opcache.