summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-12-28 23:10:05 -0800
committerBharat Mediratta <bharat@menalto.com>2010-12-28 23:10:05 -0800
commitb42fcb9cda4dafdb9db86770f54965b3fb2fc7ab (patch)
treeef645fcb4a409cfd0c0eefcdb60c841b68d84258 /modules/gallery/helpers
parent9f3c6e4bee9f2ccae04b7b241c07845b9f233cfd (diff)
Use db::expr instead of "new Database_Expression". Resolves #1560.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/gallery_installer.php6
-rw-r--r--modules/gallery/helpers/gallery_task.php6
-rw-r--r--modules/gallery/helpers/module.php2
3 files changed, 7 insertions, 7 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index a6b8e6a2..fb7933f7 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -503,7 +503,7 @@ class gallery_installer {
foreach (db::build()
->from("items")
->select("id", "slug")
- ->where(new Database_Expression("`slug` REGEXP '[^_A-Za-z0-9-]'"), "=", 1)
+ ->where(db::expr("`slug` REGEXP '[^_A-Za-z0-9-]'"), "=", 1)
->execute() as $row) {
$new_slug = item::convert_filename_to_slug($row->slug);
if (empty($new_slug)) {
@@ -540,7 +540,7 @@ class gallery_installer {
if ($version == 25) {
db::build()
->update("items")
- ->set("title", new Database_Expression("`name`"))
+ ->set("title", db::expr("`name`"))
->and_open()
->where("title", "IS", null)
->or_where("title", "=", "")
@@ -581,7 +581,7 @@ class gallery_installer {
$db->query("ALTER TABLE {modules} ADD COLUMN `weight` int(9) DEFAULT NULL");
$db->query("ALTER TABLE {modules} ADD KEY (`weight`)");
db::update("modules")
- ->set("weight", new Database_Expression("`id`"))
+ ->set("weight", db::expr("`id`"))
->execute();
module::set_version("gallery", $version = 32);
}
diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php
index e69ff91a..9ccff152 100644
--- a/modules/gallery/helpers/gallery_task.php
+++ b/modules/gallery/helpers/gallery_task.php
@@ -74,7 +74,7 @@ class gallery_task_Core {
// Choose the dirty images in a random order so that if we run this task multiple times
// concurrently each task is rebuilding different images simultaneously.
$result = graphics::find_dirty_images_query()->select("id")
- ->select(new Database_Expression("RAND() as r"))
+ ->select(db::expr("RAND() as r"))
->order_by("r", "ASC")
->execute();
$total_count = $task->get("total_count", $result->count());
@@ -608,7 +608,7 @@ class gallery_task_Core {
static function find_dupe_slugs() {
return db::build()
->select_distinct(
- array("parent_slug" => new Database_Expression("CONCAT(`parent_id`, ':', LOWER(`slug`))")))
+ array("parent_slug" => db::expr("CONCAT(`parent_id`, ':', LOWER(`slug`))")))
->select("id")
->select(array("C" => "COUNT(\"*\")"))
->from("items")
@@ -620,7 +620,7 @@ class gallery_task_Core {
static function find_dupe_names() {
return db::build()
->select_distinct(
- array("parent_name" => new Database_Expression("CONCAT(`parent_id`, ':', LOWER(`name`))")))
+ array("parent_name" => db::expr("CONCAT(`parent_id`, ':', LOWER(`name`))")))
->select("id")
->select(array("C" => "COUNT(\"*\")"))
->from("items")
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index 2b446daa..7c5578af 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -488,7 +488,7 @@ class module_Core {
static function incr_var($module_name, $name, $increment=1) {
db::build()
->update("vars")
- ->set("value", new Database_Expression("`value` + $increment"))
+ ->set("value", db::expr("`value` + $increment"))
->where("module_name", "=", $module_name)
->where("name", "=", $name)
->execute();