diff --git a/lib/autoloader.php b/lib/autoloader.php
index 9547ddc7d916678d1f9d97d9b17b7c65543d29ff..94c0ac7cb5d456ecf77eedba54f0d1a1625d8880 100644
--- a/lib/autoloader.php
+++ b/lib/autoloader.php
@@ -9,6 +9,8 @@
 namespace OC;
 
 class Autoloader {
+	private $useGlobalClassPath = true;
+
 	private $classPaths = array();
 
 	/**
@@ -21,6 +23,20 @@ class Autoloader {
 		$this->classPaths[$class] = $path;
 	}
 
+	/**
+	 * disable the usage of the global classpath \OC::$CLASSPATH
+	 */
+	public function disableGlobalClassPath() {
+		$this->useGlobalClassPath = false;
+	}
+
+	/**
+	 * enable the usage of the global classpath \OC::$CLASSPATH
+	 */
+	public function enableGlobalClassPath() {
+		$this->useGlobalClassPath = true;
+	}
+
 	/**
 	 * Load the specified class
 	 *
@@ -33,15 +49,15 @@ class Autoloader {
 		$paths = array();
 		if (array_key_exists($class, $this->classPaths)) {
 			$paths[] = $this->classPaths[$class];
-		} else if (array_key_exists($class, \OC::$CLASSPATH)) {
+		} else if ($this->useGlobalClassPath and array_key_exists($class, \OC::$CLASSPATH)) {
 			$paths[] = \OC::$CLASSPATH[$class];
 			/**
 			 * @TODO: Remove this when necessary
 			 * Remove "apps/" from inclusion path for smooth migration to mutli app dir
 			 */
-			if (strpos($path, 'apps/') === 0) {
+			if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
 				\OC_Log::write('core', 'include path for class "' . $class . '" starts with "apps/"', \OC_Log::DEBUG);
-				$path = str_replace('apps/', '', $path);
+				$path = str_replace('apps/', '', \OC::$CLASSPATH[$class]);
 			}
 		} elseif (strpos($class, 'OC_') === 0) {
 			$paths[] = strtolower(str_replace('_', '/', substr($class, 3)) . '.php');