aboutsummaryrefslogtreecommitdiffstats
path: root/lib/autoloader.php
diff options
context:
space:
mode:
authorAdam Williamson <awilliam@redhat.com>2014-07-28 18:48:17 -0700
committerThomas Müller <thomas.mueller@tmit.eu>2014-10-28 11:32:20 +0100
commit0e3f2055d2375643b468766c1accfe14857155d4 (patch)
treec75ad5b4756faa907fa57b46da10896ecdd89fad /lib/autoloader.php
parent4461e69873aac223fea410d8e78c3e7674541c17 (diff)
downloadnextcloud-server-0e3f2055d2375643b468766c1accfe14857155d4.tar.gz
nextcloud-server-0e3f2055d2375643b468766c1accfe14857155d4.zip
use Composer autoloader not OC for non-Composer 3rdparty (#9643)
Composer's autoloader is rather better than the OwnCloud autoloader's handling of non-OC classes. Plus we can rely on upstream Composer to maintain it and not worry about it ourselves. With this change, we drop the bits of OwnCloud's autoloader that handled non-OC classes, and register the classes that were being handled by that code with Composer's autoloader instead. As these dependencies are converted to actually being managed by Composer, the explicit registrations can be dropped as they won't be needed any more. Since OwnCloud's autoloader isn't going to handle non-OC classes any more, we no longer need to test to make sure it does it right. drop unneeded registerPrefix() and registerClass() from autoloader Now we're not handling anything but OC's own classes, these are unnecessary. error out if composer autoloader is not found (thanks bantu) We're never going to be able to work without the autoloader, if it's not there we should just throw our hands up and surrender.
Diffstat (limited to 'lib/autoloader.php')
-rw-r--r--lib/autoloader.php28
1 files changed, 0 insertions, 28 deletions
diff --git a/lib/autoloader.php b/lib/autoloader.php
index 54f01d9be94..f5927128820 100644
--- a/lib/autoloader.php
+++ b/lib/autoloader.php
@@ -22,26 +22,6 @@ class Autoloader {
protected $memoryCache;
/**
- * Add a custom prefix to the autoloader
- *
- * @param string $prefix
- * @param string $path
- */
- public function registerPrefix($prefix, $path) {
- $this->prefixPaths[$prefix] = $path;
- }
-
- /**
- * Add a custom classpath to the autoloader
- *
- * @param string $class
- * @param string $path
- */
- public function registerClass($class, $path) {
- $this->classPaths[$class] = $path;
- }
-
- /**
* disable the usage of the global classpath \OC::$CLASSPATH
*/
public function disableGlobalClassPath() {
@@ -99,14 +79,6 @@ class Autoloader {
$paths[] = 'tests/lib/' . strtolower(str_replace('_', '/', substr($class, 5)) . '.php');
} elseif (strpos($class, 'Test\\') === 0) {
$paths[] = 'tests/lib/' . strtolower(str_replace('\\', '/', substr($class, 5)) . '.php');
- } else {
- foreach ($this->prefixPaths as $prefix => $dir) {
- if (0 === strpos($class, $prefix)) {
- $path = str_replace('\\', '/', $class) . '.php';
- $path = str_replace('_', '/', $path);
- $paths[] = $dir . '/' . $path;
- }
- }
}
return $paths;
}