summaryrefslogtreecommitdiff
path: root/core/helpers/module.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-23 04:14:07 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-23 04:14:07 +0000
commit2502240ce4ad25e9fb60ee2468764e25346d2917 (patch)
tree3dab839d1a15b7cfa75dbbc208aef18ad5613845 /core/helpers/module.php
parent608d0996698716c488318411e10b880796c58805 (diff)
Add very simple graphics toolkits.
Track a set of rules in Graphics_Rule_Model which specify how we turn original images into thumbnails and resizes. There's one set of rules that applies to every image in the Gallery. Track the state of thumbs and resizes with a "dirty" bit. The new graphics helper manages the rules and can rebuild the thumbs and resizes for any images that are considered "dirty". Introduce the concept of an "album cover" which is an item that an album points to. We'll use that item as the source for the album's thumbnail/resize. Conflated with this change (sorry!) I also changed the Var table to use module_name instead of module_id. This may be marginally less efficient, but it's much easier to follow in the database.
Diffstat (limited to 'core/helpers/module.php')
-rw-r--r--core/helpers/module.php11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/helpers/module.php b/core/helpers/module.php
index 0e1f9d44..5dddfa61 100644
--- a/core/helpers/module.php
+++ b/core/helpers/module.php
@@ -64,7 +64,8 @@ class module_Core {
$module->delete();
$db = Database::instance();
- $db->query("DELETE FROM vars WHERE module_id = '{$module->id}';");
+ $db->query("DELETE FROM `vars` WHERE `module_name` = '{$module->name}';");
+ $db->query("DELETE FROM `graphics_rules` WHERE module_name = '{$module->name}';");
Kohana::log("debug", "$module_name: module deleted");
}
@@ -216,9 +217,8 @@ class module_Core {
* @return the value
*/
public function get_var($module_name, $name, $default_value=null) {
- $module = model_cache::get("module", $module_name, "name");
$var = ORM::factory("var")
- ->where("module_id", $module->id)
+ ->where("module_name", $module_name)
->where("name", $name)
->find();
return $var->loaded ? $var->value : $default_value;
@@ -231,14 +231,13 @@ class module_Core {
* @param string $value
*/
public function set_var($module_name, $name, $value) {
- $module = model_cache::get("module", $module_name, "name");
$var = ORM::factory("var")
- ->where("module_id", $module->id)
+ ->where("module_name", $module_name)
->where("name", $name)
->find();
if (!$var->loaded) {
$var = ORM::factory("var");
- $var->module_id = $module->id;
+ $var->module_name = $module_name;
$var->name = $name;
}
$var->value = $value;