class svn private fullpath private filename private line private answe

 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
40
41
42
43
44
class svn
{
private $fullpath;
private $filename;
private $line;
private $answer;
public function set_filename($name)
{
$name = intval($name);
$this->filename = $name;
return true;
}
public function set_path()
{
if ($this->filename==null) return false;
$this->fullpath = STORAGE_PATH.$this->filename;
return true;
}
public function add()
{
$this->line = "svn add ".$this->fullpath;
exec($this->line, $output);
return $output;
}
public function commit($text)
{
$this->line = "svn commit -m \"$text\" ".$this->fullpath;
exec($this->line, $output);
$this->answer = $output;
return true;
}
public function get_last_revision()
{
$stroke = $answer[2];
$pattern = "/^[0-9]+$/";
preg_match($pattern, $stroke, $arr);
return $arr[0];
}
}