Add time debug for each Xquery
[viewsvn.git] / includes / shellcmd.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * Class that interacts with the command line system
24 *
25 * @pacakge ViewSVN
26 */
27
28 /**
29 * Interacts with the command line via escapes and executions
30 *
31 * @package ViewSVN
32 * @version $Id$
33 */
34 class Shell
35 {
36 /**
37 * Wrapper for escapeshellarg()
38 *
39 * @access public
40 *
41 * @param string The argument
42 *
43 * @return string Cleaned argument
44 */
45 function arg($argument)
46 {
47 return escapeshellarg($argument);
48 }
49
50 /**
51 * Wrapper for escapeshellcmd
52 *
53 * @access public
54 *
55 * @param string Command
56 *
57 * @return string Cleaned command
58 */
59 function cmd($command)
60 {
61 return escapeshellcmd($command);
62 }
63
64 /**
65 * Executes a shell command and returns all the output
66 * as an array
67 *
68 * @access public
69 *
70 * @param string UNIX command
71 *
72 * @return array Output
73 */
74 function exec($command)
75 {
76 global $viewsvn;
77
78 $start = microtime();
79
80 exec($command, $output);
81
82 $viewsvn->debug("exec(" . $viewsvn->funct->fetch_microtime_diff($start) . "): $command");
83
84 return $output;
85 }
86 }
87
88 /*=====================================================================*\
89 || ###################################################################
90 || # $HeadURL$
91 || # $Id$
92 || ###################################################################
93 \*=====================================================================*/
94 ?>