diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-11-08 11:45:14 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-11-08 11:45:14 -0800 |
commit | 853a3acc9b5b017b479fa93e29e1d80c0acc1a50 (patch) | |
tree | 0efd3c64891551ce8870ea1d7a83db523f668f44 /modules/gallery/helpers | |
parent | 97a5656296e617e7dd2f55cc1eb3f1d34e7163f5 (diff) |
Implement module::clear_all_vars($module_name)
Also switch from using ORM to Database_Builder for the SQL because it's
cleaner, and clean up the test. Fixes #1479.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/module.php | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 64d0d1d6..16c7bb72 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -503,13 +503,25 @@ class module_Core { * @param string $name */ static function clear_var($module_name, $name) { - $var = ORM::factory("var") + db::build() + ->delete("vars") ->where("module_name", "=", $module_name) ->where("name", "=", $name) - ->find(); - if ($var->loaded()) { - $var->delete(); - } + ->execute(); + + Cache::instance()->delete("var_cache"); + self::$var_cache = null; + } + + /** + * Remove all variables for this module. + * @param string $module_name + */ + static function clear_all_vars($module_name) { + db::build() + ->delete("vars") + ->where("module_name", "=", $module_name) + ->execute(); Cache::instance()->delete("var_cache"); self::$var_cache = null; |