Skip to content

Commit bbfd281

Browse files
authored
Merge pull request #52949 from nextcloud/fix/delete-legacy-autoloader
fix: Remove useless legacy autoloader
2 parents d2356d9 + 7c251e4 commit bbfd281

File tree

3 files changed

+2
-246
lines changed

3 files changed

+2
-246
lines changed

lib/autoloader.php

Lines changed: 0 additions & 163 deletions
This file was deleted.

lib/base.php

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@
3939
* OC_autoload!
4040
*/
4141
class OC {
42-
/**
43-
* Associative array for autoloading. classname => filename
44-
*/
45-
public static array $CLASSPATH = [];
4642
/**
4743
* The installation path for Nextcloud on the server (e.g. /srv/http/nextcloud)
4844
*/
@@ -73,8 +69,6 @@ class OC {
7369
*/
7470
public static bool $CLI = false;
7571

76-
public static \OC\Autoloader $loader;
77-
7872
public static \Composer\Autoload\ClassLoader $composerAutoloader;
7973

8074
public static \OC\Server $server;
@@ -597,12 +591,6 @@ public static function init(): void {
597591

598592
// register autoloader
599593
$loaderStart = microtime(true);
600-
require_once __DIR__ . '/autoloader.php';
601-
self::$loader = new \OC\Autoloader([
602-
OC::$SERVERROOT . '/lib/private/legacy',
603-
]);
604-
spl_autoload_register([self::$loader, 'load']);
605-
$loaderEnd = microtime(true);
606594

607595
self::$CLI = (php_sapi_name() == 'cli');
608596

@@ -628,6 +616,7 @@ public static function init(): void {
628616
print($e->getMessage());
629617
exit();
630618
}
619+
$loaderEnd = microtime(true);
631620

632621
// setup the basic server
633622
self::$server = new \OC\Server(\OC::$WEBROOT, self::$config);
@@ -656,9 +645,6 @@ public static function init(): void {
656645
error_reporting(E_ALL);
657646
}
658647

659-
$systemConfig = Server::get(\OC\SystemConfig::class);
660-
self::registerAutoloaderCache($systemConfig);
661-
662648
// initialize intl fallback if necessary
663649
OC_Util::isSetLocaleWorking();
664650

@@ -692,6 +678,7 @@ public static function init(): void {
692678
throw new \OCP\HintException('The PHP SimpleXML/PHP-XML extension is not installed.', 'Install the extension or make sure it is enabled.');
693679
}
694680

681+
$systemConfig = Server::get(\OC\SystemConfig::class);
695682
$appManager = Server::get(\OCP\App\IAppManager::class);
696683
if ($systemConfig->getValue('installed', false)) {
697684
$appManager->loadApps(['session']);
@@ -975,23 +962,6 @@ public static function registerShareHooks(\OC\SystemConfig $systemConfig): void
975962
}
976963
}
977964

978-
protected static function registerAutoloaderCache(\OC\SystemConfig $systemConfig): void {
979-
// The class loader takes an optional low-latency cache, which MUST be
980-
// namespaced. The instanceid is used for namespacing, but might be
981-
// unavailable at this point. Furthermore, it might not be possible to
982-
// generate an instanceid via \OC_Util::getInstanceId() because the
983-
// config file may not be writable. As such, we only register a class
984-
// loader cache if instanceid is available without trying to create one.
985-
$instanceId = $systemConfig->getValue('instanceid', null);
986-
if ($instanceId) {
987-
try {
988-
$memcacheFactory = Server::get(\OCP\ICacheFactory::class);
989-
self::$loader->setMemoryCache($memcacheFactory->createLocal('Autoloader'));
990-
} catch (\Exception $ex) {
991-
}
992-
}
993-
}
994-
995965
/**
996966
* Handle the request
997967
*/

tests/lib/AutoLoaderTest.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)