- Making it so the last component in ConstructNavbar() doesn't work as a link
[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 * This class is the Xquery interface. It is responsible for doing the
30 * actual interaction with the command line.
31 *
32 * @package ViewSVN
33 * @version $Id$
34 */
35 class Shell
36 {
37 /**
38 * Controller
39 * @var object
40 * @access private
41 */
42 var $controller = null;
43
44 // ###################################################################
45 /**
46 * Constructor
47 *
48 * @access public
49 *
50 * @param object Controller
51 */
52 function Shell(&$controller)
53 {
54 $this->controller =& $controller;
55 }
56
57 // ###################################################################
58 /**
59 * Wrapper for escapeshellarg()
60 *
61 * @access public
62 *
63 * @param string The argument
64 *
65 * @return string Cleaned argument
66 */
67 function arg($argument)
68 {
69 return escapeshellarg($argument);
70 }
71
72 // ###################################################################
73 /**
74 * Wrapper for escapeshellcmd
75 *
76 * @access public
77 *
78 * @param string Command
79 *
80 * @return string Cleaned command
81 */
82 function cmd($command)
83 {
84 return escapeshellcmd($command);
85 }
86
87 // ###################################################################
88 /**
89 * Executes a shell command and returns all the output
90 * as an array
91 *
92 * @access public
93 *
94 * @param string UNIX command
95 *
96 * @return array Output
97 */
98 function exec($command)
99 {
100 $start = microtime();
101
102 exec($command, $output);
103
104 $this->controller->registry->debug("exec(" . $this->controller->registry->funct->fetch_microtime_diff($start) . "): $command");
105
106 return $output;
107 }
108 }
109
110 /*=====================================================================*\
111 || ###################################################################
112 || # $HeadURL$
113 || # $Id$
114 || ###################################################################
115 \*=====================================================================*/
116 ?>