diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-08-08 20:56:06 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-08-08 20:56:06 -0700 |
commit | 7aac471b828d4405b3fb0d736a06a5b92875883e (patch) | |
tree | 165286e8e6a015e406aae76d2a7e14d508b3a634 /modules/comment/helpers | |
parent | 3a8f1f426294737aac145d15462caa808aef14b1 (diff) | |
parent | c9f5000e65f66b3342f2cc6e2e9623eac72ff223 (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_branch
Conflicts:
modules/gallery/js/quick.js
Diffstat (limited to 'modules/comment/helpers')
-rw-r--r-- | modules/comment/helpers/comment_installer.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php index f54913c3..edf2427c 100644 --- a/modules/comment/helpers/comment_installer.php +++ b/modules/comment/helpers/comment_installer.php @@ -52,8 +52,8 @@ class comment_installer { } static function upgrade($version) { + $db = Database::instance(); if ($version == 1) { - $db = Database::instance(); $db->query("ALTER TABLE {comments} CHANGE `state` `state` varchar(15) default 'unpublished'"); module::set_version("comment", 2); } @@ -61,9 +61,16 @@ class comment_installer { static function uninstall() { $db = Database::instance(); - $sql = "SELECT `item_id` FROM {comments}"; - module::event("item_related_update_batch", $sql); + // Notify listeners that we're deleting some data. This is probably going to be very + // inefficient for large uninstalls, and we could make it better by doing things like passing + // a SQL fragment through so that the listeners could use subselects. But by using a single, + // simple event API we lighten the load on module developers. + foreach (ORM::factory("item") + ->join("comments", "items.id", "comments.item_id") + ->find_all() as $item) { + module::event("item_related_update", $item); + } $db->query("DROP TABLE IF EXISTS {comments};"); } } |