Skip to content

Commit

Permalink
Merge pull request #32203 from owncloud/tech-dept/drop-CLASSPATH-support
Browse files Browse the repository at this point in the history
Remove $CLASSPATH - this is no longer needed. Apps are using proper n…
  • Loading branch information
DeepDiver1975 authored Jul 31, 2018
2 parents 8a811f5 + 047a2aa commit 3eee971
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 45 deletions.
3 changes: 3 additions & 0 deletions apps/files_external/3rdparty/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"require": {
"icewind/smb": "3.0.0",
"icewind/streams": "0.5.2"
},
"autoload": {
"files": ["../lib/config.php"]
}
}

8 changes: 0 additions & 8 deletions apps/files_external/3rdparty/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@
'Icewind\\SMB\\Native\\NativeWriteStream' => $vendorDir . '/icewind/smb/src/Native/NativeWriteStream.php',
'Icewind\\SMB\\ServerFactory' => $vendorDir . '/icewind/smb/src/ServerFactory.php',
'Icewind\\SMB\\System' => $vendorDir . '/icewind/smb/src/System.php',
'Icewind\\SMB\\Test\\AbstractShareTest' => $vendorDir . '/icewind/smb/tests/AbstractShareTest.php',
'Icewind\\SMB\\Test\\NativeShareTest' => $vendorDir . '/icewind/smb/tests/NativeShareTest.php',
'Icewind\\SMB\\Test\\NativeStreamTest' => $vendorDir . '/icewind/smb/tests/NativeStreamTest.php',
'Icewind\\SMB\\Test\\NotifyHandlerTest' => $vendorDir . '/icewind/smb/tests/NotifyHandlerTest.php',
'Icewind\\SMB\\Test\\ParserTest' => $vendorDir . '/icewind/smb/tests/ParserTest.php',
'Icewind\\SMB\\Test\\ServerTest' => $vendorDir . '/icewind/smb/tests/ServerTest.php',
'Icewind\\SMB\\Test\\ShareTest' => $vendorDir . '/icewind/smb/tests/ShareTest.php',
'Icewind\\SMB\\Test\\TestCase' => $vendorDir . '/icewind/smb/tests/TestCase.php',
'Icewind\\SMB\\TimeZoneProvider' => $vendorDir . '/icewind/smb/src/TimeZoneProvider.php',
'Icewind\\SMB\\Wrapped\\Connection' => $vendorDir . '/icewind/smb/src/Wrapped/Connection.php',
'Icewind\\SMB\\Wrapped\\ErrorCodes' => $vendorDir . '/icewind/smb/src/Wrapped/ErrorCodes.php',
Expand Down
10 changes: 10 additions & 0 deletions apps/files_external/3rdparty/composer/autoload_files.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

// autoload_files.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = $vendorDir;

return array(
'66d1e6eade98ab5874edb7f59d55f619' => $baseDir . '/../lib/config.php',
);
18 changes: 18 additions & 0 deletions apps/files_external/3rdparty/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ public static function getLoader()
$loader->setClassMapAuthoritative(true);
$loader->register(true);

if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire98fe9b281934250b3a93f69a5ce843b3($fileIdentifier, $file);
}

return $loader;
}
}

function composerRequire98fe9b281934250b3a93f69a5ce843b3($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}
12 changes: 4 additions & 8 deletions apps/files_external/3rdparty/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
{
public static $files = array (
'66d1e6eade98ab5874edb7f59d55f619' => __DIR__ . '/..' . '/../lib/config.php',
);

public static $prefixLengthsPsr4 = array (
'I' =>
array (
Expand Down Expand Up @@ -76,14 +80,6 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
'Icewind\\SMB\\Native\\NativeWriteStream' => __DIR__ . '/..' . '/icewind/smb/src/Native/NativeWriteStream.php',
'Icewind\\SMB\\ServerFactory' => __DIR__ . '/..' . '/icewind/smb/src/ServerFactory.php',
'Icewind\\SMB\\System' => __DIR__ . '/..' . '/icewind/smb/src/System.php',
'Icewind\\SMB\\Test\\AbstractShareTest' => __DIR__ . '/..' . '/icewind/smb/tests/AbstractShareTest.php',
'Icewind\\SMB\\Test\\NativeShareTest' => __DIR__ . '/..' . '/icewind/smb/tests/NativeShareTest.php',
'Icewind\\SMB\\Test\\NativeStreamTest' => __DIR__ . '/..' . '/icewind/smb/tests/NativeStreamTest.php',
'Icewind\\SMB\\Test\\NotifyHandlerTest' => __DIR__ . '/..' . '/icewind/smb/tests/NotifyHandlerTest.php',
'Icewind\\SMB\\Test\\ParserTest' => __DIR__ . '/..' . '/icewind/smb/tests/ParserTest.php',
'Icewind\\SMB\\Test\\ServerTest' => __DIR__ . '/..' . '/icewind/smb/tests/ServerTest.php',
'Icewind\\SMB\\Test\\ShareTest' => __DIR__ . '/..' . '/icewind/smb/tests/ShareTest.php',
'Icewind\\SMB\\Test\\TestCase' => __DIR__ . '/..' . '/icewind/smb/tests/TestCase.php',
'Icewind\\SMB\\TimeZoneProvider' => __DIR__ . '/..' . '/icewind/smb/src/TimeZoneProvider.php',
'Icewind\\SMB\\Wrapped\\Connection' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/Connection.php',
'Icewind\\SMB\\Wrapped\\ErrorCodes' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/ErrorCodes.php',
Expand Down
2 changes: 0 additions & 2 deletions apps/files_external/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
*
*/

OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';

require_once __DIR__ . '/../3rdparty/autoload.php';

// register Application object singleton
Expand Down
28 changes: 1 addition & 27 deletions lib/autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
use \OCP\AutoloadNotAllowedException;

class Autoloader {
/** @var bool */
private $useGlobalClassPath = true;
/** @var array */
private $validRoots = [];

Expand Down Expand Up @@ -67,20 +65,6 @@ public function addValidRoot($root) {
$this->validRoots[$root] = true;
}

/**
* 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;
}

/**
* get the possible paths for a class
*
Expand All @@ -91,17 +75,7 @@ public function findClass($class) {
$class = \trim($class, '\\');

$paths = [];
if ($this->useGlobalClassPath && \array_key_exists($class, \OC::$CLASSPATH)) {
$paths[] = \OC::$CLASSPATH[$class];
/**
* @TODO: Remove this when necessary
* Remove "apps/" from inclusion path for smooth migration to multi app dir
*/
if (\strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
\OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG);
$paths[] = \str_replace('apps/', '', \OC::$CLASSPATH[$class]);
}
} elseif (\strpos($class, 'OC_') === 0) {
if (\strpos($class, 'OC_') === 0) {
$paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . \strtolower(\str_replace('_', '/', \substr($class, 3)) . '.php');
} elseif (\strpos($class, 'OCA\\') === 0) {
list(, $app, $rest) = \explode('\\', $class, 3);
Expand Down

0 comments on commit 3eee971

Please sign in to comment.