Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93565428
PhutilDiffBinaryAnalyzer.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
Fri, Nov 29, 19:07
Size
643 B
Mime Type
text/x-php
Expires
Sun, Dec 1, 19:07 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22666646
Attached To
rPHU libphutil
PhutilDiffBinaryAnalyzer.php
View Options
<?php
final
class
PhutilDiffBinaryAnalyzer
extends
PhutilBinaryAnalyzer
{
const
BINARY
=
'diff'
;
protected
function
newBinaryVersion
()
{
list
(
$err
,
$stdout
)
=
exec_manual
(
'diff --version'
);
if
(
$err
)
{
return
null
;
}
return
self
::
parseDiffBinaryVersion
(
$stdout
);
}
public
static
function
parseDiffBinaryVersion
(
$stdout
)
{
$prefix
=
'diff (GNU diffutils) '
;
if
(
preg_match
(
'(^'
.
preg_quote
(
$prefix
).
')'
,
$stdout
))
{
$lines
=
phutil_split_lines
(
$stdout
,
false
);
$line
=
head
(
$lines
);
$version
=
substr
(
$line
,
strlen
(
$prefix
));
return
$version
;
}
return
null
;
}
}
Event Timeline
Log In to Comment