Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121710601
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
Sun, Jul 13, 09:00
Size
643 B
Mime Type
text/x-php
Expires
Tue, Jul 15, 09:00 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27372400
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