diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-09-02 18:05:10 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-09-02 18:05:10 +0200 |
commit | f9eea901fe8bb51ce000dd20a8da63e4fde5c8a8 (patch) | |
tree | f809ddad087f9ae6c7f4f9db0bd72d076af81b76 /lib/base.php | |
parent | e1d6e63083cc5ff31cd974e3b7196793cbeebc99 (diff) | |
download | nextcloud-server-f9eea901fe8bb51ce000dd20a8da63e4fde5c8a8.tar.gz nextcloud-server-f9eea901fe8bb51ce000dd20a8da63e4fde5c8a8.zip |
backport autoloader magic trying to find class in lib folder
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php index 3a990162210..5a1bd4ecbe3 100644 --- a/lib/base.php +++ b/lib/base.php @@ -96,8 +96,17 @@ class OC { } elseif (strpos($className, 'OCP\\') === 0) { $path = 'public/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php'); } elseif (strpos($className, 'OCA\\') === 0) { + list(, $app, $rest) = explode('\\', $className, 3); + $app = strtolower($app); foreach (self::$APPSROOTS as $appDir) { - $path = $appDir['path'] . '/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php'); + $path = $appDir['path'] . '/' . $app . '/' . strtolower(str_replace('\\', '/', $rest) . '.php'); + $fullPath = stream_resolve_include_path($path); + if (file_exists($fullPath)) { + require_once $fullPath; + return false; + } + // If not found in the root of the app directory, insert '/lib' after app id and try again. + $path = $appDir['path'] . '/' . $app . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php'); $fullPath = stream_resolve_include_path($path); if (file_exists($fullPath)) { require_once $fullPath; |