summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2013-04-24 13:33:05 -0700
committerThomas Tanghus <thomas@tanghus.net>2013-04-24 13:33:05 -0700
commitc84281990c7d626021b64149fb6776053cb5650f (patch)
tree309146cd20f4bf7de84ec888b0f0a26aa022f3ff /lib/base.php
parent1ee224d8cbaf66d38858d5ec59d5f083052deb4d (diff)
parente09c17de5b25d6c728bc6b828dcc686ce66ae134 (diff)
downloadnextcloud-server-c84281990c7d626021b64149fb6776053cb5650f.tar.gz
nextcloud-server-c84281990c7d626021b64149fb6776053cb5650f.zip
Merge pull request #2993 from owncloud/resolve_apps_lib_path
Let autoloader resolve paths under apps lib directory.
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php
index e3b6a58bb2d..3b421486daf 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -97,8 +97,15 @@ class OC {
$path = 'public/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php');
} elseif (strpos($className, 'OCA\\') === 0) {
foreach (self::$APPSROOTS as $appDir) {
- $path = $appDir['path'] . '/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php');
- $fullPath = stream_resolve_include_path($path);
+ $path = strtolower(str_replace('\\', '/', substr($className, 4)) . '.php');
+ $fullPath = stream_resolve_include_path($appDir['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.
+ $libpath = substr($path, 0, strpos($path, '/')) . '/lib' . substr($path, strpos($path, '/'));
+ $fullPath = stream_resolve_include_path($appDir['path'] . '/' . $libpath);
if (file_exists($fullPath)) {
require_once $fullPath;
return false;