Page MenuHomePhabricator

D11115.diff
No OneTemporary

D11115.diff

diff --git a/src/moduleutils/PhutilBootloader.php b/src/moduleutils/PhutilBootloader.php
--- a/src/moduleutils/PhutilBootloader.php
+++ b/src/moduleutils/PhutilBootloader.php
@@ -9,6 +9,7 @@
private $extensionMaps = array();
private $currentLibrary = null;
private $classTree = array();
+ private $inMemoryMaps = array();
public static function getInstance() {
if (!self::$instance) {
@@ -25,6 +26,13 @@
return $this->classTree;
}
+ public function registerInMemoryLibrary($name, $map) {
+ $this->registeredLibraries[$name] = "memory:$name";
+ $this->inMemoryMaps[$name] = $map;
+
+ $this->getLibraryMap($name);
+ }
+
public function registerLibrary($name, $path) {
if (basename($path) != '__phutil_library_init__.php') {
throw new PhutilBootloaderException(
@@ -104,10 +112,15 @@
if (empty($this->libraryMaps[$name])) {
$root = $this->getLibraryRoot($name);
$this->currentLibrary = $name;
- $okay = include $root.'/__phutil_library_map__.php';
- if (!$okay) {
- throw new PhutilBootloaderException(
- "Include of '{$root}/__phutil_library_map__.php' failed!");
+
+ if (isset($this->inMemoryMaps[$name])) {
+ $this->libraryMaps[$name] = $this->inMemoryMaps[$name];
+ } else {
+ $okay = include $root.'/__phutil_library_map__.php';
+ if (!$okay) {
+ throw new PhutilBootloaderException(
+ "Include of '{$root}/__phutil_library_map__.php' failed!");
+ }
}
$map = $this->libraryMaps[$name];

File Metadata

Mime Type
text/plain
Expires
May 9 2024, 9:07 PM (5 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6277566
Default Alt Text
D11115.diff (1 KB)

Event Timeline