Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-09-02 20:05:10 +0400
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-09-02 20:05:10 +0400
commitf9eea901fe8bb51ce000dd20a8da63e4fde5c8a8 (patch)
treef809ddad087f9ae6c7f4f9db0bd72d076af81b76 /lib/base.php
parente1d6e63083cc5ff31cd974e3b7196793cbeebc99 (diff)
backport autoloader magic trying to find class in lib folder
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php11
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;