Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93267809
xhpast_parse.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 27, 11:55
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 29, 11:55 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22606893
Attached To
rPHU libphutil
xhpast_parse.php
View Options
<?php
/**
* @group xhpast
*/
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 0.62"
)
{
$available
=
true
;
}
}
}
}
return
$available
;
}
/**
* @group xhpast
*/
function
xhpast_get_binary_path
()
{
if
(
phutil_is_windows
())
{
return
dirname
(
__FILE__
).
'
\\
xhpast.exe'
;
}
return
dirname
(
__FILE__
).
'/xhpast'
;
}
/**
* @group xhpast
*/
function
xhpast_get_build_instructions
()
{
$root
=
phutil_get_library_root
(
'phutil'
);
$make
=
$root
.
'/../scripts/build_xhpast.sh'
;
$make
=
Filesystem
::
resolvePath
(
$make
);
return
<<<EOHELP
Your version of 'xhpast' is unbuilt or out of date. Run this script to build it:
\$ {$make}
EOHELP;
}
/**
* @group xhpast
*/
function
xhpast_get_parser_future
(
$data
)
{
if
(!
xhpast_is_available
())
{
throw
new
Exception
(
xhpast_get_build_instructions
());
}
$future
=
new
ExecFuture
(
'%s'
,
xhpast_get_binary_path
());
$future
->
write
(
$data
);
return
$future
;
}
Event Timeline
Log In to Comment