database dump part 1

git-svn-id: file:///home/shish/svn/shimmie2/trunk@646 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-12-08 18:44:52 +00:00
parent 7981e4014d
commit babe924921

View file

@ -23,6 +23,9 @@ class SVNUpdate extends Extension {
if($event->get_arg(0) == "update") {
$this->theme->display_update_log($event->page, $this->run_update());
}
if($event->get_arg(0) == "dump") {
$this->theme->display_update_log($event->page, $this->run_dump());
}
//if($event->get_arg(0) == "switch") {
// $this->theme->display_update_log($event->page, $this->run_update());
//}
@ -41,6 +44,21 @@ class SVNUpdate extends Extension {
private function run_update() {
return shell_exec("svn update");
}
private function run_dump() {
global $database_dsn;
$matches = array();
// FIXME: MySQL specific
if(preg_match("#^mysql://([^:]+):([^@]+)@([^/]+)/([^\?]+)#", $database_dsn, $matches)) {
$date = date("Ymd");
return
shell_exec("mysqldump -uUSER -pPASS -hHOST DATABASE | gzip > db-$date.sql.gz") .
"\n\nDatabase dump should now be sitting in db-$date.sql.gz in the shimmie folder";
}
else {
return "Couldn't parse database connection string";
}
}
private function get_branches() {
$data = shell_exec("svn ls http://svn.shishnet.org/shimmie2/branches/");
$list = array();