Changeset View
Changeset View
Standalone View
Standalone View
src/moduleutils/PhutilBootloader.php
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if (isset($this->registeredLibraries[$name])) { | ||||
$old_path = $this->registeredLibraries[$name]; | $old_path = $this->registeredLibraries[$name]; | ||||
if ($old_path != $path) { | if ($old_path != $path) { | ||||
throw new PhutilLibraryConflictException($name, $old_path, $path); | throw new PhutilLibraryConflictException($name, $old_path, $path); | ||||
} | } | ||||
} | } | ||||
$this->registeredLibraries[$name] = $path; | $this->registeredLibraries[$name] = $path; | ||||
// If we're loading libphutil itself, load the utility functions first so | |||||
// we can safely call functions like "id()" when handling errors. In | |||||
// particular, this improves error behavior when "utils.php" itself can | |||||
// not load. | |||||
if ($name === 'phutil') { | |||||
$root = $this->getLibraryRoot('phutil'); | |||||
$this->executeInclude($root.'/utils/utils.php'); | |||||
} | |||||
// For libphutil v2 libraries, load all functions when we load the library. | // For libphutil v2 libraries, load all functions when we load the library. | ||||
if (!class_exists('PhutilSymbolLoader', false)) { | if (!class_exists('PhutilSymbolLoader', false)) { | ||||
$root = $this->getLibraryRoot('phutil'); | $root = $this->getLibraryRoot('phutil'); | ||||
$this->executeInclude($root.'/symbols/PhutilSymbolLoader.php'); | $this->executeInclude($root.'/symbols/PhutilSymbolLoader.php'); | ||||
} | } | ||||
$loader = new PhutilSymbolLoader(); | $loader = new PhutilSymbolLoader(); | ||||
▲ Show 20 Lines • Show All 266 Lines • Show Last 20 Lines |