Skip to content
Snippets Groups Projects
Commit c8428199 authored by Thomas Tanghus's avatar Thomas Tanghus
Browse files

Merge pull request #2993 from owncloud/resolve_apps_lib_path

Let autoloader resolve paths under apps lib directory.
parents 1ee224d8 e09c17de
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment