Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14009320
D9828.id23607.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9828.id23607.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -219,6 +219,7 @@
'PhutilMarkupTestCase' => 'markup/__tests__/PhutilMarkupTestCase.php',
'PhutilMetricsChannel' => 'channel/PhutilMetricsChannel.php',
'PhutilMissingSymbolException' => 'symbols/exception/PhutilMissingSymbolException.php',
+ 'PhutilModuleUtilsTestCase' => 'moduleutils/__tests__/PhutilModuleUtilsTestCase.php',
'PhutilNiceDaemon' => 'daemon/torture/PhutilNiceDaemon.php',
'PhutilNumber' => 'internationalization/PhutilNumber.php',
'PhutilOAuth1Future' => 'future/oauth/PhutilOAuth1Future.php',
@@ -391,6 +392,7 @@
'phutil_escape_uri_path_component' => 'markup/render.php',
'phutil_exit' => 'utils/utils.php',
'phutil_fwrite_nonblocking_stream' => 'utils/utils.php',
+ 'phutil_get_current_library_name' => 'moduleutils/moduleutils.php',
'phutil_get_library_name_for_root' => 'moduleutils/moduleutils.php',
'phutil_get_library_root' => 'moduleutils/moduleutils.php',
'phutil_get_library_root_for_path' => 'moduleutils/moduleutils.php',
@@ -621,6 +623,7 @@
'PhutilMarkupTestCase' => 'PhutilTestCase',
'PhutilMetricsChannel' => 'PhutilChannelChannel',
'PhutilMissingSymbolException' => 'Exception',
+ 'PhutilModuleUtilsTestCase' => 'PhutilTestCase',
'PhutilNiceDaemon' => 'PhutilTortureTestDaemon',
'PhutilOAuth1Future' => 'FutureProxy',
'PhutilOAuth1FutureTestCase' => 'PhutilTestCase',
diff --git a/src/moduleutils/__tests__/PhutilModuleUtilsTestCase.php b/src/moduleutils/__tests__/PhutilModuleUtilsTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/moduleutils/__tests__/PhutilModuleUtilsTestCase.php
@@ -0,0 +1,9 @@
+<?php
+
+final class PhutilModuleUtilsTestCase extends PhutilTestCase {
+
+ public function testGetCurrentLibraryName() {
+ $this->assertEqual('phutil', phutil_get_current_library_name());
+ }
+
+}
diff --git a/src/moduleutils/moduleutils.php b/src/moduleutils/moduleutils.php
--- a/src/moduleutils/moduleutils.php
+++ b/src/moduleutils/moduleutils.php
@@ -29,6 +29,13 @@
return null;
}
+function phutil_get_current_library_name() {
+ $caller = head(debug_backtrace(false));
+
+ $root = phutil_get_library_root_for_path($caller['file']);
+ return phutil_get_library_name_for_root($root);
+}
+
/**
* Warns about use of deprecated behavior.
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 31, 2:28 PM (4 d, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6718343
Default Alt Text
D9828.id23607.diff (2 KB)
Attached To
Mode
D9828: Add a `phutil_get_current_library_name` function
Attached
Detach File
Event Timeline
Log In to Comment