Let autoloader resolve paths under apps lib directory.

remotes/origin/stable6
Thomas Tanghus 12 years ago
parent a3e5da834b
commit 9facb67fab
  1. 10
      lib/base.php

@ -97,8 +97,14 @@ class OC {
$path = 'public/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php'); $path = 'public/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php');
} elseif (strpos($className, 'OCA\\') === 0) { } elseif (strpos($className, 'OCA\\') === 0) {
foreach (self::$APPSROOTS as $appDir) { foreach (self::$APPSROOTS as $appDir) {
$path = $appDir['path'] . '/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php'); $path = strtolower(str_replace('\\', '/', substr($className, 4)) . '.php');
$fullPath = stream_resolve_include_path($path); $fullPath = stream_resolve_include_path($appDir['path'] . '/' . $path);
if (file_exists($fullPath)) {
require_once $fullPath;
return false;
}
$libpath = substr($path, 0, strpos($path, '/')) . '/lib' . substr($path, strpos($path, '/'));
$fullPath = stream_resolve_include_path($appDir['path'] . '/' . $libpath);
if (file_exists($fullPath)) { if (file_exists($fullPath)) {
require_once $fullPath; require_once $fullPath;
return false; return false;

Loading…
Cancel
Save