Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15408460
D11325.id.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
D11325.id.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
@@ -461,6 +461,7 @@
'xhpast_get_parser_future' => 'parser/xhpast/bin/xhpast_parse.php',
'xhpast_is_available' => 'parser/xhpast/bin/xhpast_parse.php',
'xhpast_parser_token_constants' => 'parser/xhpast/parser_tokens.php',
+ 'xhpast_version' => 'parser/xhpast/bin/xhpast_parse.php',
'xsprintf' => 'xsprintf/xsprintf.php',
'xsprintf_callback_example' => 'xsprintf/xsprintf.php',
'xsprintf_command' => 'xsprintf/csprintf.php',
diff --git a/src/parser/xhpast/bin/xhpast_parse.php b/src/parser/xhpast/bin/xhpast_parse.php
--- a/src/parser/xhpast/bin/xhpast_parse.php
+++ b/src/parser/xhpast/bin/xhpast_parse.php
@@ -2,19 +2,11 @@
function xhpast_is_available() {
static $available;
+
if ($available === null) {
- $available = false;
- $bin = xhpast_get_binary_path();
- if (Filesystem::pathExists($bin)) {
- list($err, $stdout) = exec_manual('%s --version', $bin);
- if (!$err) {
- $version = trim($stdout);
- if ($version === 'xhpast version 5.5.8/1g') {
- $available = true;
- }
- }
- }
+ $available = xhpast_version() == 'xhpast version 5.5.8/1g';
}
+
return $available;
}
@@ -57,3 +49,19 @@
$root = phutil_get_library_root('phutil');
execx('%s', $root.'/../scripts/build_xhpast.sh');
}
+
+function xhpast_version() {
+ static $version;
+
+ if ($version === null) {
+ $bin = xhpast_get_binary_path();
+ if (Filesystem::pathExists($bin)) {
+ list($err, $stdout) = exec_manual('%s --version', $bin);
+ if (!$err) {
+ $version = trim($stdout);
+ }
+ }
+ }
+
+ return $version;
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 11:13 PM (3 d, 23 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7710195
Default Alt Text
D11325.id.diff (1 KB)
Attached To
Mode
D11325: Add an `xhpast_version` function
Attached
Detach File
Event Timeline
Log In to Comment