class_mcBash.inc.php
958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* @copyright (c) 2014, netz.coop eG
*/
class mcBash {
public static function exec($command, array &$output = null, &$return_var = null) {
$StartTime = time();
$shell_exec = exec($command, $output, $return_var);
$zeit = getdate(time() - $StartTime);
D::ulli($zeit["minutes"].'m'.$zeit["seconds"].'s: mcBash# '.$command);
return $shell_exec;
}
/**
* (PHP 4, PHP 5)<br/>
* Execute command via shell and return the complete output as a string
* @link http://php.net/manual/en/function.shell-exec.php
* @param string $cmd <p>
* The command that will be executed.
* </p>
* @return string The output from the executed command or <b>NULL</b> if an error occurred.
*/
public static function shell_exec ($cmd) {
$StartTime = time();
$shell_exec = shell_exec($cmd);
$zeit = getdate(time() - $StartTime);
D::ulli($zeit["minutes"].'m'.$zeit["seconds"].'s: mcBash# '.$cmd);
return $shell_exec;
}
}
?>