MDL-66903 core: Move core_component to \core\component
This commit is contained in:
@@ -22,6 +22,15 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
use core\exception\coding_exception;
|
||||
use stdClass;
|
||||
use ArrayIterator;
|
||||
use DirectoryIterator;
|
||||
use Exception;
|
||||
use RegexIterator;
|
||||
|
||||
// Constants used in version.php files, these must exist when core_component executes.
|
||||
|
||||
// We make use of error_log as debugging is not always available.
|
||||
@@ -43,7 +52,7 @@ define('ANY_VERSION', 'any');
|
||||
/**
|
||||
* Collection of components related methods.
|
||||
*/
|
||||
class core_component {
|
||||
class component {
|
||||
/** @var array list of ignored directories in plugin type roots - watch out for auth/db exception */
|
||||
protected static $ignoreddirs = [
|
||||
'CVS' => true,
|
||||
@@ -160,7 +169,7 @@ class core_component {
|
||||
$debugging = "Class '%s' has been renamed for the autoloader and is now deprecated. Please use '%s' instead.";
|
||||
debugging(sprintf($debugging, $classname, $newclassname), DEBUG_DEVELOPER);
|
||||
if (PHP_VERSION_ID >= 70000 && preg_match('#\\\null(\\\|$)#', $classname)) {
|
||||
throw new \coding_exception("Cannot alias $classname to $newclassname");
|
||||
throw new coding_exception("Cannot alias $classname to $newclassname");
|
||||
}
|
||||
class_alias($newclassname, $classname);
|
||||
return;
|
||||
@@ -728,7 +737,7 @@ $cache = ' . var_export($cache, true) . ';
|
||||
if (!is_dir($fulldir)) {
|
||||
continue;
|
||||
}
|
||||
$items = new \DirectoryIterator($fulldir);
|
||||
$items = new DirectoryIterator($fulldir);
|
||||
foreach ($items as $item) {
|
||||
if ($item->isDot() || !$item->isDir()) {
|
||||
continue;
|
||||
@@ -826,7 +835,7 @@ $cache = ' . var_export($cache, true) . ';
|
||||
return;
|
||||
}
|
||||
|
||||
$items = new \DirectoryIterator($fulldir);
|
||||
$items = new DirectoryIterator($fulldir);
|
||||
foreach ($items as $item) {
|
||||
if ($item->isDot()) {
|
||||
continue;
|
||||
@@ -1500,13 +1509,13 @@ $cache = ' . var_export($cache, true) . ';
|
||||
foreach ($legacyclasses as $classname => $path) {
|
||||
if (is_array($path)) {
|
||||
if (!$allowsubsystems) {
|
||||
throw new \Exception(
|
||||
throw new Exception(
|
||||
"Invalid legacy classes path entry for {$classname}. " .
|
||||
"Only files within the component can be specified.",
|
||||
);
|
||||
}
|
||||
if (count($path) !== 2) {
|
||||
throw new \Exception(
|
||||
throw new Exception(
|
||||
"Invalid legacy classes path entry for {$classname}. " .
|
||||
"Entries must be in the format [subsystem, path].",
|
||||
);
|
||||
@@ -1514,7 +1523,7 @@ $cache = ' . var_export($cache, true) . ';
|
||||
[$subsystem, $path] = $path;
|
||||
$subsystem = substr($subsystem, 5);
|
||||
if (!array_key_exists($subsystem, self::$subsystems)) {
|
||||
throw new \Exception(
|
||||
throw new Exception(
|
||||
"Unknown subsystem '{$subsystem}' for legacy classes entry of '{$classname}'",
|
||||
);
|
||||
}
|
||||
@@ -1620,3 +1629,7 @@ $cache = ' . var_export($cache, true) . ';
|
||||
return file_exists("$plugindir/pix/monologo.svg") || file_exists("$plugindir/pix/monologo.png");
|
||||
}
|
||||
}
|
||||
|
||||
// Alias this class to the old name.
|
||||
// This should be kept here because we use this class in external tooling.
|
||||
class_alias(component::class, \core_component::class);
|
||||
|
||||
Reference in New Issue
Block a user