summaryrefslogtreecommitdiff
path: root/core/controllers/welcome.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-10 07:05:49 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-10 07:05:49 +0000
commit18a6614a11cf39a29f5705edabc710688da357e6 (patch)
tree26bcc7c8f81c5f9f948ded7a07b3be41ca370e4c /core/controllers/welcome.php
parent09364348c7ddb5cd46c3f63ea71467e7b49d0c34 (diff)
Change all access API methods to take ORMs instead of ids. This will
minimize reloading objects from the database.
Diffstat (limited to 'core/controllers/welcome.php')
-rw-r--r--core/controllers/welcome.php26
1 files changed, 12 insertions, 14 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index 2839b2f1..dacaa87f 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -22,13 +22,11 @@ class Welcome_Controller extends Template_Controller {
function index() {
Session::instance();
-
$this->template->syscheck = new View("welcome_syscheck.html");
$this->template->syscheck->errors = $this->_get_config_errors();
$this->template->syscheck->modules = array();
$old_handler = set_error_handler(array("Welcome_Controller", "_error_handler"));
-
try {
$this->template->syscheck->modules = $this->_read_modules();
$this->template->album_count = ORM::factory("item")->where("type", "album")->count_all();
@@ -101,20 +99,18 @@ class Welcome_Controller extends Template_Controller {
try {
call_user_func(array("{$module->name}_installer", "uninstall"));
} catch (Exception $e) {
- $clean = false;
}
}
}
} catch (Exception $e) { }
- set_error_handler($old_handler);
- if (!$clean) {
- // Since we're in a state of flux, it's possible that other stuff went wrong with the
- // uninstall, so back off and nuke things from orbit.
- $db = Database::instance();
- foreach ($db->list_tables() as $table) {
- $db->query("DROP TABLE `$table`");
- }
+
+ // Since we're in a state of flux, it's possible that other stuff went wrong with the
+ // uninstall, so back off and nuke it from orbit. It's the only way to be sure.
+ $db = Database::instance();
+ foreach ($db->list_tables() as $table) {
+ $db->query("DROP TABLE `$table`");
}
+ set_error_handler($old_handler);
}
call_user_func(array("{$module_name}_installer", "uninstall"));
url::redirect("welcome");
@@ -488,18 +484,20 @@ class Welcome_Controller extends Template_Controller {
}
public function add_perm($group_id, $perm, $item_id) {
- access::allow($group_id, $perm, $item_id);
+ access::allow(ORM::factory("group", $group_id), $perm, ORM::factory("item", $item_id));
url::redirect("welcome");
}
public function deny_perm($group_id, $perm, $item_id) {
- access::deny($group_id, $perm, $item_id);
+ access::deny(ORM::factory("group", $group_id), $perm, ORM::factory("item", $item_id));
url::redirect("welcome");
}
public function reset_all_perms($group_id, $item_id) {
+ $group = ORM::factory("group", $group_id);
+ $item = ORM::factory("item", $item_id);
foreach (ORM::factory("permission")->find_all() as $perm) {
- access::reset($group_id, $perm->name, $item_id);
+ access::reset($group, $perm->name, $item);
}
url::redirect("welcome");
}