]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(autoloader): no apcu no side effects 40349/head
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Fri, 8 Sep 2023 14:40:48 +0000 (16:40 +0200)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Fri, 8 Sep 2023 14:55:39 +0000 (16:55 +0200)
apcu lead to side effects especially with app management and (soft)
inter-dependencies, and lead also to 500 server errors. While we could
add management to clear apcu cache in many cases (may stil leave edge
cases) the performance benefit is marginally as also class maps are
already cached in opcache. Hence, the simple and effective way to go is
to not use apcu for autoloading.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
lib/base.php
lib/private/legacy/OC_Util.php

index d96f91ddcd4ddba22e7d20a72fa3ac031fd7c5f1..26e88979a483be0f448ebe83ef931790f0b52d68 100644 (file)
@@ -114,8 +114,6 @@ class OC {
 
        public static string $configDir;
 
-       public static int $VERSION_MTIME = 0;
-
        /**
         * requested app
         */
@@ -610,10 +608,9 @@ class OC {
 
                self::$CLI = (php_sapi_name() == 'cli');
 
-               // Add default composer PSR-4 autoloader
+               // Add default composer PSR-4 autoloader, ensure apcu to be disabled
                self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php';
-               OC::$VERSION_MTIME = filemtime(OC::$SERVERROOT . '/version.php');
-               self::$composerAutoloader->setApcuPrefix('composer_autoload_' . md5(OC::$SERVERROOT . '_' . OC::$VERSION_MTIME));
+               self::$composerAutoloader->setApcuPrefix(null);
 
                try {
                        self::initPaths();
index 9d62c46137e612fe4f7f6d90ac0f7ef49ed97d7e..f82ddcc78ee03fe422076ac72458a784beb83557 100644 (file)
@@ -325,9 +325,10 @@ class OC_Util {
                        return;
                }
 
+               $timestamp = filemtime(OC::$SERVERROOT . '/version.php');
                require OC::$SERVERROOT . '/version.php';
                /** @var int $timestamp */
-               self::$versionCache['OC_Version_Timestamp'] = \OC::$VERSION_MTIME;
+               self::$versionCache['OC_Version_Timestamp'] = $timestamp;
                /** @var string $OC_Version */
                self::$versionCache['OC_Version'] = $OC_Version;
                /** @var string $OC_VersionString */