admin tweaks

This commit is contained in:
Shish 2012-03-11 14:02:00 +00:00
parent 358f191be2
commit 47bb844acc
2 changed files with 29 additions and 2 deletions

View File

@ -139,7 +139,7 @@ class AdminPage extends Extension {
return true;
}
private function dump_database() {
private function database_dump() {
global $page;
$matches = array();
@ -150,11 +150,17 @@ class AdminPage extends Extension {
$hostname = $matches['host'];
$database = $matches['dbname'];
// TODO: Support more than just MySQL..
switch($software) {
case 'mysql':
$cmd = "mysqldump -h$hostname -u$username -p$password $database";
break;
case 'pgsql':
putenv("PGPASSWORD=$password");
$cmd = "pg_dump -h $hostname -U $username $database";
break;
case 'sqlite':
$cmd = "sqlite3 $database .dump";
break;
}
$page->set_mode("data");

View File

@ -54,6 +54,27 @@ class AdminPageTest extends ShimmieWebTestCase {
$this->get_page('admin');
$this->assert_title("Admin Tools");
$this->click("Download database contents");
$this->assert_response(200);
$this->log_out();
}
function testDBQ() {
$this->log_in_as_user();
$image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test");
$image_id_2 = $this->post_image("ext/simpletest/data/bedroom_workshop.jpg", "test2");
$image_id_3 = $this->post_image("ext/simpletest/data/favicon.png", "test");
$this->get_page("post/list/test/1");
$this->click("Delete All These Images");
$this->get_page("post/view/$image_id_1");
$this->assert_response(404);
$this->get_page("post/view/$image_id_2");
$this->assert_response(200);
$this->get_page("post/view/$image_id_3");
$this->assert_response(404);
$this->delete_image($image_id_2);
$this->log_out();
}
}