Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F109570210
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
Tue, Apr 22, 12:10
Size
643 B
Mime Type
text/x-php
Expires
Thu, Apr 24, 12:10 (2 d)
Engine
blob
Format
Raw Data
Handle
25727092
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