forked from Cavemanon/cavepaintings
branch switcher UI (no functionality yet...)
git-svn-id: file:///home/shish/svn/shimmie2/trunk@620 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
@ -15,12 +15,17 @@ class SVNUpdate extends Extension {
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "update")) {
|
||||
if($event->user->is_admin()) {
|
||||
if($event->get_arg(0) == "log") {
|
||||
$this->theme->display_update_todo($event->page, $this->get_update_log());
|
||||
if($event->get_arg(0) == "view_changes") {
|
||||
$this->theme->display_update_todo($event->page,
|
||||
$this->get_update_log(),
|
||||
$this->get_branches());
|
||||
}
|
||||
if($event->get_arg(0) == "run") {
|
||||
if($event->get_arg(0) == "update") {
|
||||
$this->theme->display_update_log($event->page, $this->run_update());
|
||||
}
|
||||
//if($event->get_arg(0) == "switch") {
|
||||
// $this->theme->display_update_log($event->page, $this->run_update());
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,11 +36,26 @@ class SVNUpdate extends Extension {
|
||||
}
|
||||
|
||||
private function get_update_log() {
|
||||
return shell_exec("svn log -r BASE:HEAD .");
|
||||
return shell_exec("svn log -r HEAD:BASE .");
|
||||
}
|
||||
private function run_update() {
|
||||
return shell_exec("svn update");
|
||||
}
|
||||
private function get_branches() {
|
||||
$data = shell_exec("svn ls http://svn.shishnet.org/shimmie2/branches/");
|
||||
$list = array();
|
||||
foreach(split("\n", $data) as $line) {
|
||||
$matches = array();
|
||||
if(preg_match("/branch_(\d.\d+)/", $line, $matches)) {
|
||||
$ver = $matches[1];
|
||||
$list["branch_$ver"] = "Stable ($ver.X)";
|
||||
}
|
||||
}
|
||||
ksort($list);
|
||||
$list = array_reverse($list, true);
|
||||
$list["trunk"] = "Unstable (Trunk)";
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
add_event_listener(new SVNUpdate());
|
||||
?>
|
||||
|
Reference in New Issue
Block a user