Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18405253
D11326.id27200.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D11326.id27200.diff
View Options
diff --git a/scripts/update_compat_info.php b/scripts/update_compat_info.php
--- a/scripts/update_compat_info.php
+++ b/scripts/update_compat_info.php
@@ -113,7 +113,7 @@
);
Filesystem::writeFile(
- phutil_get_library_root('phutil').'/../'.$target,
+ phutil_get_library_root().'/../'.$target,
id(new PhutilJSON())->encodeFormatted($output));
echo "Done.\n";
diff --git a/src/daemon/PhutilDaemonOverseer.php b/src/daemon/PhutilDaemonOverseer.php
--- a/src/daemon/PhutilDaemonOverseer.php
+++ b/src/daemon/PhutilDaemonOverseer.php
@@ -200,7 +200,7 @@
"'--verbose' to produce debugging output.\n";
}
- $root = phutil_get_library_root('phutil');
+ $root = phutil_get_library_root();
$root = dirname($root);
$exec_dir = $root.'/scripts/daemon/exec/';
diff --git a/src/daemon/torture/PhutilProcessGroupDaemon.php b/src/daemon/torture/PhutilProcessGroupDaemon.php
--- a/src/daemon/torture/PhutilProcessGroupDaemon.php
+++ b/src/daemon/torture/PhutilProcessGroupDaemon.php
@@ -6,7 +6,7 @@
final class PhutilProcessGroupDaemon extends PhutilTortureTestDaemon {
public function run() {
- $root = phutil_get_library_root('phutil');
+ $root = phutil_get_library_root();
$root = dirname($root);
execx('%s', $root.'/scripts/daemon/torture/resist-death.php');
diff --git a/src/filesystem/__tests__/PhutilDeferredLogTestCase.php b/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
--- a/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
+++ b/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
@@ -95,7 +95,7 @@
}
public function testManyWriters() {
- $root = phutil_get_library_root('phutil').'/../';
+ $root = phutil_get_library_root().'/../';
$bin = $root.'scripts/test/deferred_log.php';
$n_writers = 3;
diff --git a/src/filesystem/__tests__/PhutilFileLockTestCase.php b/src/filesystem/__tests__/PhutilFileLockTestCase.php
--- a/src/filesystem/__tests__/PhutilFileLockTestCase.php
+++ b/src/filesystem/__tests__/PhutilFileLockTestCase.php
@@ -171,7 +171,7 @@
}
private function buildLockFuture($flags, $file) {
- $root = dirname(phutil_get_library_root('phutil'));
+ $root = dirname(phutil_get_library_root());
$bin = $root.'/scripts/utils/lock.php';
// NOTE: Use `exec` so this passes on Ubuntu, where the default `dash` shell
diff --git a/src/future/http/HTTPSFuture.php b/src/future/http/HTTPSFuture.php
--- a/src/future/http/HTTPSFuture.php
+++ b/src/future/http/HTTPSFuture.php
@@ -301,7 +301,7 @@
// work, give up and yell at the user.
if (!$this->getCABundle()) {
- $caroot = dirname(phutil_get_library_root('phutil')).'/resources/ssl/';
+ $caroot = dirname(phutil_get_library_root()).'/resources/ssl/';
$ini_val = ini_get('curl.cainfo');
if (self::getGlobalCABundle()) {
$this->setCABundleFromPath(self::getGlobalCABundle());
diff --git a/src/moduleutils/__tests__/PhutilExtensionsTestCase.php b/src/moduleutils/__tests__/PhutilExtensionsTestCase.php
--- a/src/moduleutils/__tests__/PhutilExtensionsTestCase.php
+++ b/src/moduleutils/__tests__/PhutilExtensionsTestCase.php
@@ -3,7 +3,7 @@
final class PhutilExtensionsTestCase extends PhutilTestCase {
public function testPhutilExtensions() {
- $root = dirname(phutil_get_library_root('phutil'));
+ $root = dirname(phutil_get_library_root());
$path = array(
$root,
'support',
diff --git a/src/moduleutils/moduleutils.php b/src/moduleutils/moduleutils.php
--- a/src/moduleutils/moduleutils.php
+++ b/src/moduleutils/moduleutils.php
@@ -1,6 +1,9 @@
<?php
-function phutil_get_library_root($library) {
+function phutil_get_library_root($library = null) {
+ if (!$library) {
+ $library = phutil_get_current_library_name();
+ }
$bootloader = PhutilBootloader::getInstance();
return $bootloader->getLibraryRoot($library);
}
diff --git a/src/parser/PhutilJSONParser.php b/src/parser/PhutilJSONParser.php
--- a/src/parser/PhutilJSONParser.php
+++ b/src/parser/PhutilJSONParser.php
@@ -16,7 +16,7 @@
}
public function parse($json) {
- $jsonlint_root = phutil_get_library_root('phutil').'/../externals/jsonlint';
+ $jsonlint_root = phutil_get_library_root().'/../externals/jsonlint';
require_once $jsonlint_root.'/src/Seld/JsonLint/JsonParser.php';
require_once $jsonlint_root.'/src/Seld/JsonLint/Lexer.php';
require_once $jsonlint_root.'/src/Seld/JsonLint/ParsingException.php';
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 30 2025, 11:16 PM (8 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
10214247
Default Alt Text
D11326.id27200.diff (4 KB)
Attached To
Mode
D11326: Simplify the use of `phutil_get_library_root`
Attached
Detach File
Event Timeline
Log In to Comment