From 45cca4aeed71a29a09fba82b1a543fb65e96ef86 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 10 Apr 2007 01:38:18 +0000 Subject: [PATCH] We forgot to add includes/class_libsvn.php which makes all those previous commits pretty useless... --- includes/class_libsvn.php | 115 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 includes/class_libsvn.php diff --git a/includes/class_libsvn.php b/includes/class_libsvn.php new file mode 100644 index 0000000..31cef6f --- /dev/null +++ b/includes/class_libsvn.php @@ -0,0 +1,115 @@ +path = $path; + + $access = $this->run('--version'); + if (!preg_match('#^svn, version (.*?)\)$#i', trim($access[0]))) + { + throw new Exception(_('The SVN binary does not appear to be valid (it failed our tests)')); + } + } + + // ################################################################### + /** + * Wrapper for escapeshellarg() + * + * @param string The argument + * + * @return string Cleaned argument + */ + public function arg($argument) + { + return escapeshellarg($argument); + } + + // ################################################################### + /** + * Wrapper for escapeshellcmd() + * + * @param string Command + * + * @return string Cleaned command + */ + public function cmd($command) + { + return escapeshellcmd($command); + } + + // ################################################################### + /** + * Executes a shell command and returns all the output + * as an array + * + * @param string UNIX command + * @param bool Turn the array of output into a string? + * + * @return array Output + */ + public function run($command, $implode = false) + { + $start = microtime(); + + exec($this->path . ' ' . $command, $output); + + BSRegister::Debug("exec(" . BSFunctions::FetchMicrotimeDiff($start) . "): $command"); + + if ($implode) + { + return implode("\n", $output); + } + + return $output; + } +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file -- 2.43.5