Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F565725
DrydockCommandInterface.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DrydockCommandInterface.php
View Options
<?php
abstract
class
DrydockCommandInterface
extends
DrydockInterface
{
const
INTERFACE_TYPE
=
'command'
;
private
$workingDirectoryStack
=
array
();
public
function
pushWorkingDirectory
(
$working_directory
)
{
$this
->
workingDirectoryStack
[]
=
$working_directory
;
return
$this
;
}
public
function
popWorkingDirectory
()
{
if
(!
$this
->
workingDirectoryStack
)
{
throw
new
Exception
(
pht
(
'Unable to pop working directory, directory stack is empty.'
));
}
return
array_pop
(
$this
->
workingDirectoryStack
);
}
public
function
peekWorkingDirectory
()
{
if
(
$this
->
workingDirectoryStack
)
{
return
last
(
$this
->
workingDirectoryStack
);
}
return
null
;
}
final
public
function
getInterfaceType
()
{
return
self
::
INTERFACE_TYPE
;
}
final
public
function
exec
(
$command
)
{
$argv
=
func_get_args
();
$exec
=
call_user_func_array
(
array
(
$this
,
'getExecFuture'
),
$argv
);
return
$exec
->
resolve
();
}
final
public
function
execx
(
$command
)
{
$argv
=
func_get_args
();
$exec
=
call_user_func_array
(
array
(
$this
,
'getExecFuture'
),
$argv
);
return
$exec
->
resolvex
();
}
abstract
public
function
getExecFuture
(
$command
);
protected
function
applyWorkingDirectoryToArgv
(
array
$argv
)
{
$directory
=
$this
->
peekWorkingDirectory
();
if
(
$directory
!==
null
)
{
$cmd
=
$argv
[
0
];
$cmd
=
"(cd %s && {$cmd})"
;
$argv
=
array_merge
(
array
(
$cmd
),
array
(
$directory
),
array_slice
(
$argv
,
1
));
}
return
$argv
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 5:36 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
123998
Default Alt Text
DrydockCommandInterface.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment