summaryrefslogtreecommitdiff
path: root/modules/user
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user')
-rw-r--r--modules/user/helpers/group.php8
-rw-r--r--modules/user/helpers/user_installer.php13
2 files changed, 9 insertions, 12 deletions
diff --git a/modules/user/helpers/group.php b/modules/user/helpers/group.php
index 2e6a3962..12118432 100644
--- a/modules/user/helpers/group.php
+++ b/modules/user/helpers/group.php
@@ -24,6 +24,7 @@
* Note: by design, this class does not do any permission checking.
*/
class group_Core {
+ const EVERYBODY = 0;
const REGISTERED_USERS = 1;
/**
@@ -41,9 +42,7 @@ class group_Core {
$group->name = $name;
$group->save();
- // Create the view column for this group in the items table.
- Database::instance()->query("ALTER TABLE `items` ADD `view_{$group->id}` BOOLEAN DEFAULT 0");
-
+ module::event("group_created", $group);
return $group;
}
@@ -56,8 +55,7 @@ class group_Core {
$group = ORM::factory("group", $id);
if ($group->loaded) {
- // Drop the view column for this group in the items table.
- Database::instance()->query("ALTER TABLE `items` DROP `view_{$group->id}`");
+ module::event("group_before_delete", $group);
$group->delete();
}
}
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php
index 0f030d0e..58066acd 100644
--- a/modules/user/helpers/user_installer.php
+++ b/modules/user/helpers/user_installer.php
@@ -66,14 +66,13 @@ class user_installer {
}
public static function uninstall() {
- // Remove all our groups so that we clean up the items table
+ // Delete all users and groups so that we give other modules an opportunity to clean up
+ foreach (ORM::factory("user")->find_all() as $user) {
+ user::delete($user->id);
+ }
+
foreach (ORM::factory("group")->find_all() as $group) {
- try {
- group::delete($group->id);
- } catch (Kohana_Database_Exception $e) {
- // We may get errors when we try to remove the view columns from the items table.
- // Ignore those for now.
- }
+ group::delete($group->id);
}
try {