Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14476706
D11115.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11115.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 29, 7:28 AM (9 h, 11 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6941807
Default Alt Text
D11115.diff (1 KB)
Attached To
Mode
D11115: Allow in-memory maps to be registered in libphutil
Attached
Detach File
Event Timeline
Log In to Comment