]>
src.bluestatic.org Git - viewsvn.git/blob - includes/class_libsvn.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
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.
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
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 \*=====================================================================*/
25 * This is the command-line library system for Subversion. It handles all
26 * the actual lifting and executing.
29 * @copyright Copyright (c)2002 - [#]year[#], Blue Static
37 * The path to the SVN binary
45 public function __construct($path)
49 $access = $this->run('--version');
50 if (!preg_match('#^svn, version (.*?)\)$#i', trim($access[0])))
52 throw new Exception(_('The SVN binary does not appear to be valid (it failed our tests)'));
56 // ###################################################################
58 * Wrapper for escapeshellarg()
60 * @param string The argument
62 * @return string Cleaned argument
64 public function arg($argument)
66 return escapeshellarg($argument);
69 // ###################################################################
71 * Wrapper for escapeshellcmd()
73 * @param string Command
75 * @return string Cleaned command
77 public function cmd($command)
79 return escapeshellcmd($command);
82 // ###################################################################
84 * Executes a shell command and returns all the output
87 * @param string UNIX command
88 * @param bool Turn the array of output into a string?
90 * @return array Output
92 public function run($command, $implode = false)
96 exec($this->path
. ' ' . $command, $output);
98 BSRegister
::Debug("exec(" . BSFunctions
::FetchMicrotimeDiff($start) . "): $command");
102 return implode("\n
", $output);
109 /*=====================================================================*\
110 || ###################################################################
113 || ###################################################################
114 \*=====================================================================*/