Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convert all DB where() calls to take 3 arguments.

Convert all open_paren() calls to and_open() or or_open() as appropriate.
  • Loading branch information...
commit 1fd0e14359a7c7164573e4aa897c07680339e713 1 parent 22823df
@bharat bharat authored
Showing with 208 additions and 203 deletions.
  1. +2 −2 modules/comment/controllers/admin_comments.php
  2. +3 −3 modules/comment/helpers/comment_event.php
  3. +2 −2 modules/comment/helpers/comment_rss.php
  4. +2 −2 modules/comment/helpers/comment_theme.php
  5. +2 −2 modules/comment/tests/Comment_Model_Test.php
  6. +7 −7 modules/exif/helpers/exif.php
  7. +5 −5 modules/exif/helpers/exif_task.php
  8. +1 −1  modules/exif/helpers/exif_theme.php
  9. +1 −1  modules/g2_import/helpers/g2_import.php
  10. +1 −1  modules/g2_import/helpers/g2_import_task.php
  11. +3 −3 modules/gallery/controllers/admin_maintenance.php
  12. +6 −6 modules/gallery/controllers/albums.php
  13. +2 −2 modules/gallery/controllers/file_proxy.php
  14. +3 −3 modules/gallery/controllers/l10n_client.php
  15. +2 −2 modules/gallery/controllers/move.php
  16. +5 −5 modules/gallery/controllers/movies.php
  17. +6 −6 modules/gallery/controllers/photos.php
  18. +3 −3 modules/gallery/helpers/MY_url.php
  19. +23 −23 modules/gallery/helpers/access.php
  20. +5 −5 modules/gallery/helpers/album.php
  21. +4 −4 modules/gallery/helpers/gallery_block.php
  22. +6 −6 modules/gallery/helpers/gallery_event.php
  23. +2 −2 modules/gallery/helpers/gallery_rss.php
  24. +5 −5 modules/gallery/helpers/graphics.php
  25. +4 −2 modules/gallery/helpers/l10n_client.php
  26. +1 −1  modules/gallery/helpers/l10n_scanner.php
  27. +6 −5 modules/gallery/helpers/module.php
  28. +5 −5 modules/gallery/helpers/movie.php
  29. +5 −5 modules/gallery/helpers/photo.php
  30. +2 −2 modules/gallery/helpers/site_status.php
  31. +2 −2 modules/gallery/libraries/Gallery_I18n.php
  32. +5 −4 modules/gallery/libraries/drivers/Cache/Database.php
  33. +10 −10 modules/gallery/models/item.php
  34. +8 −8 modules/gallery/tests/Access_Helper_Test.php
  35. +1 −1  modules/gallery/tests/Cache_Test.php
  36. +25 −24 modules/gallery/tests/Database_Test.php
  37. +1 −1  modules/gallery/tests/Gallery_Installer_Test.php
  38. +2 −2 modules/gallery/tests/I18n_Test.php
  39. +2 −2 modules/gallery/tests/Item_Helper_Test.php
  40. +2 −2 modules/notification/helpers/notification_event.php
  41. +5 −5 modules/search/helpers/search.php
  42. +1 −1  modules/search/helpers/search_event.php
  43. +2 −2 modules/search/helpers/search_task.php
  44. +4 −4 modules/server_add/controllers/server_add.php
  45. +1 −1  modules/tag/controllers/admin_tags.php
  46. +2 −2 modules/tag/helpers/tag.php
  47. +4 −4 modules/tag/models/tag.php
  48. +3 −3 modules/tag/tests/Tag_Test.php
  49. +1 −1  modules/user/helpers/group.php
  50. +1 −1  modules/user/helpers/user.php
  51. +2 −2 modules/user/tests/User_Groups_Test.php
View
4 modules/comment/controllers/admin_comments.php
@@ -49,7 +49,7 @@ public function queue($state) {
$view->content->state = $state;
$view->content->comments = ORM::factory("comment")
->order_by("created", "DESC")
- ->where("state", $state)
+ ->where("state", "=", $state)
->limit(self::$items_per_page, ($page - 1) * self::$items_per_page)
->find_all();
$view->content->pager = new Pagination();
@@ -120,7 +120,7 @@ public function delete_all_spam() {
access::verify_csrf();
ORM::factory("comment")
- ->where("state", "spam")
+ ->where("state", "=", "spam")
->delete_all();
url::redirect("admin/comments/queue/spam");
}
View
6 modules/comment/helpers/comment_event.php
@@ -29,7 +29,7 @@ static function user_deleted($user) {
"guest_email" => null,
"guest_name" => "guest",
"guest_url" => null))
- ->where(array("author_id" => $user->id))
+ ->where("author_id", "=", $user->id)
->update();
}
@@ -40,7 +40,7 @@ static function identity_provider_changed($old_provider, $new_provider) {
"guest_email" => null,
"guest_name" => "guest",
"guest_url" => null))
- ->where("1 = 1")
+ ->where("1", "=", "1") // @todo: why do we do this?
->update();
}
@@ -65,7 +65,7 @@ static function item_index_data($item, $data) {
foreach (Database::instance()
->select("text")
->from("comments")
- ->where("item_id", $item->id)
+ ->where("item_id", "=", $item->id)
->get()
->as_array() as $row) {
$data[] = $row->text;
View
4 modules/comment/helpers/comment_rss.php
@@ -35,11 +35,11 @@ static function feed($feed_id, $offset, $limit, $id) {
$comments = ORM::factory("comment")
->viewable()
- ->where("state", "published")
+ ->where("state", "=", "published")
->order_by("created", "DESC");
if ($feed_id == "item") {
- $comments->where("item_id", $id);
+ $comments->where("item_id", "=", $id);
}
$feed->view = "comment.mrss";
View
4 modules/comment/helpers/comment_theme.php
@@ -37,8 +37,8 @@ static function photo_bottom($theme) {
$view = new View("comments.html");
$view->comments = ORM::factory("comment")
- ->where("item_id", $theme->item()->id)
- ->where("state", "published")
+ ->where("item_id", "=", $theme->item()->id)
+ ->where("state", "=", "published")
->order_by("created", "ASC")
->find_all();
View
4 modules/comment/tests/Comment_Model_Test.php
@@ -29,12 +29,12 @@ public function cant_view_comments_for_unviewable_items_test() {
access::allow(identity::everybody(), "view", $album);
$this->assert_equal(
1,
- ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
+ ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
// We can't see the comment when permissions are denied on the album
access::deny(identity::everybody(), "view", $album);
$this->assert_equal(
0,
- ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
+ ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
}
}
View
14 modules/exif/helpers/exif.php
@@ -73,7 +73,7 @@ static function extract($item) {
}
$item->save();
- $record = ORM::factory("exif_record")->where("item_id", $item->id)->find();
+ $record = ORM::factory("exif_record")->where("item_id", "=", $item->id)->find();
if (!$record->loaded()) {
$record->item_id = $item->id;
}
@@ -86,7 +86,7 @@ static function extract($item) {
static function get($item) {
$exif = array();
$record = ORM::factory("exif_record")
- ->where("item_id", $item->id)
+ ->where("item_id", "=", $item->id)
->find();
if (!$record->loaded()) {
return array();
@@ -143,11 +143,11 @@ static function stats() {
->select("items.id")
->from("items")
->join("exif_records", "items.id", "exif_records.item_id", "left")
- ->where("type", "photo")
- ->open_paren()
- ->where("exif_records.item_id", null)
- ->orwhere("exif_records.dirty", 1)
- ->close_paren()
+ ->where("type", "=", "photo")
+ ->and_open()
+ ->where("exif_records.item_id", "=", null)
+ ->orwhere("exif_records.dirty", "=", 1)
+ ->close()
->get()
->count();
View
10 modules/exif/helpers/exif_task.php
@@ -44,11 +44,11 @@ static function update_index($task) {
$start = microtime(true);
foreach (ORM::factory("item")
->join("exif_records", "items.id", "exif_records.item_id", "left")
- ->where("type", "photo")
- ->open_paren()
- ->where("exif_records.item_id", null)
- ->orwhere("exif_records.dirty", 1)
- ->close_paren()
+ ->where("type", "=", "photo")
+ ->and_open()
+ ->where("exif_records.item_id", "=", null)
+ ->orwhere("exif_records.dirty", "=", 1)
+ ->close()
->find_all() as $item) {
// The query above can take a long time, so start the timer after its done
// to give ourselves a little time to actually process rows.
View
2  modules/exif/helpers/exif_theme.php
@@ -24,7 +24,7 @@ static function sidebar_bottom($theme) {
$record = Database::instance()
->select("key_count")
->from("exif_records")
- ->where("item_id", $item->id)
+ ->where("item_id", "=", $item->id)
->get()
->current();
if ($record && $record->key_count) {
View
2  modules/g2_import/helpers/g2_import.php
@@ -867,7 +867,7 @@ static function get_tag_item_ids($min_id) {
*/
static function map($g2_id) {
if (!array_key_exists($g2_id, self::$map)) {
- $g2_map = ORM::factory("g2_map")->where("g2_id", $g2_id)->find();
+ $g2_map = ORM::factory("g2_map")->where("g2_id", "=", $g2_id)->find();
self::$map[$g2_id] = $g2_map->loaded() ? $g2_map->g3_id : null;
}
View
2  modules/g2_import/helpers/g2_import_task.php
@@ -65,7 +65,7 @@ static function import($task) {
$task->set("done", $done);
$root_g2_id = g2(GalleryCoreApi::getDefaultAlbumId());
- $root = ORM::factory("g2_map")->where("g2_id", $root_g2_id)->find();
+ $root = ORM::factory("g2_map")->where("g2_id", "=", $root_g2_id)->find();
if (!$root->loaded()) {
$root->g2_id = $root_g2_id;
$root->g3_id = 1;
View
6 modules/gallery/controllers/admin_maintenance.php
@@ -41,9 +41,9 @@ public function index() {
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")
- ->where("done", 0)->order_by("updated", "DESC")->find_all();
+ ->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")
- ->where("done", 1)->order_by("updated", "DESC")->find_all();
+ ->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
print $view;
}
@@ -164,7 +164,7 @@ public function remove_finished_tasks() {
// Do it the long way so we can call delete and remove the cache.
$finished = ORM::factory("task")
- ->where(array("done" => 1))
+ ->where("done", "=", 1)
->find_all();
foreach ($finished as $task) {
task::remove($task->id);
View
12 modules/gallery/controllers/albums.php
@@ -126,12 +126,12 @@ public function update($album_id) {
if ($row = Database::instance()
->select(array("name", "slug"))
->from("items")
- ->where("parent_id", $album->parent_id)
- ->where("id <>", $album->id)
- ->open_paren()
- ->where("name", $form->edit_item->dirname->value)
- ->orwhere("slug", $form->edit_item->slug->value)
- ->close_paren()
+ ->where("parent_id", "=", $album->parent_id)
+ ->where("id", "<>", $album->id)
+ ->and_open()
+ ->where("name", "=", $form->edit_item->dirname->value)
+ ->orwhere("slug", "=", $form->edit_item->slug->value)
+ ->close()
->get()
->current()) {
if ($row->name == $form->edit_item->dirname->value) {
View
4 modules/gallery/controllers/file_proxy.php
@@ -57,7 +57,7 @@ public function __call($function, $args) {
$path = preg_replace("|/.album.jpg$|", "", $path);
// We now have the relative path to the item. Search for it in the path cache
- $item = ORM::factory("item")->where("relative_path_cache", $path)->find();
+ $item = ORM::factory("item")->where("relative_path_cache", "=", $path)->find();
if (!$item->loaded()) {
// We didn't turn it up. It's possible that the relative_path_cache is out of date here.
// There was fallback code, but bharat deleted it in 8f1bca74. If it turns out to be
@@ -69,7 +69,7 @@ public function __call($function, $args) {
if (preg_match('/.jpg$/', $path)) {
foreach (array("flv", "mp4") as $ext) {
$movie_path = preg_replace('/.jpg$/', ".$ext", $path);
- $item = ORM::factory("item")->where("relative_path_cache", $movie_path)->find();
+ $item = ORM::factory("item")->where("relative_path_cache", "=", $movie_path)->find();
if ($item->loaded()) {
break;
}
View
6 modules/gallery/controllers/l10n_client.php
@@ -116,7 +116,7 @@ public static function l10n_form() {
foreach (Database::instance()
->select("key", "message")
->from("incoming_translations")
- ->where(array("locale" => 'root'))
+ ->where("locale", "=", "root"))
->get()
->as_array() as $row) {
$calls[$row->key] = array(unserialize($row->message), array());
@@ -131,7 +131,7 @@ public static function l10n_form() {
foreach (Database::instance()
->select("key", "translation")
->from("incoming_translations")
- ->where(array("locale" => $locale))
+ ->where("locale", "=", $locale)
->get()
->as_array() as $row) {
$translations[$row->key] = unserialize($row->translation);
@@ -140,7 +140,7 @@ public static function l10n_form() {
foreach (Database::instance()
->select("key", "translation")
->from("outgoing_translations")
- ->where(array("locale" => $locale))
+ ->where("locale", "=", $locale)
->get()
->as_array() as $row) {
$translations[$row->key] = unserialize($row->translation);
View
4 modules/gallery/controllers/move.php
@@ -64,8 +64,8 @@ private function _get_tree_html($source, $target) {
$view->parent = $target;
$view->children = ORM::factory("item")
->viewable()
- ->where("type", "album")
- ->where("parent_id", $target->id)
+ ->where("type", "=", "album")
+ ->where("parent_id", "=", $target->id)
->find_all();
return $view;
}
View
10 modules/gallery/controllers/movies.php
@@ -74,12 +74,12 @@ public function update($movie_id) {
if ($row = Database::instance()
->select(array("name", "slug"))
->from("items")
- ->where("parent_id", $movie->parent_id)
+ ->where("parent_id", "=", $movie->parent_id)
->where("id <>", $movie->id)
- ->open_paren()
- ->where("name", $form->edit_item->filename->value)
- ->orwhere("slug", $form->edit_item->slug->value)
- ->close_paren()
+ ->and_open()
+ ->where("name", "=", $form->edit_item->filename->value)
+ ->orwhere("slug", "=", $form->edit_item->slug->value)
+ ->close()
->get()
->current()) {
if ($row->name == $form->edit_item->filename->value) {
View
12 modules/gallery/controllers/photos.php
@@ -74,12 +74,12 @@ public function update($photo_id) {
if ($row = Database::instance()
->select(array("name", "slug"))
->from("items")
- ->where("parent_id", $photo->parent_id)
- ->where("id <>", $photo->id)
- ->open_paren()
- ->where("name", $form->edit_item->filename->value)
- ->orwhere("slug", $form->edit_item->slug->value)
- ->close_paren()
+ ->where("parent_id", "=", $photo->parent_id)
+ ->where("id", "<>", $photo->id)
+ ->and_open()
+ ->where("name", "=", $form->edit_item->filename->value)
+ ->orwhere("slug", "=", $form->edit_item->slug->value)
+ ->close()
->get()
->current()) {
if ($row->name == $form->edit_item->filename->value) {
View
6 modules/gallery/helpers/MY_url.php
@@ -50,12 +50,12 @@ static function get_item_from_uri($uri) {
// In most cases, we'll have an exact match in the relative_url_cache item field.
// but failing that, walk down the tree until we find it. The fallback code will fix caches
// as it goes, so it'll never be run frequently.
- $item = ORM::factory("item")->where("relative_url_cache", $current_uri)->find();
+ $item = ORM::factory("item")->where("relative_url_cache", "=", $current_uri)->find();
if (!$item->loaded()) {
$count = count(Router::$segments);
foreach (ORM::factory("item")
- ->where("slug", html_entity_decode(Router::$segments[$count - 1], ENT_QUOTES))
- ->where("level", $count + 1)
+ ->where("slug", "=", html_entity_decode(Router::$segments[$count - 1], ENT_QUOTES))
+ ->where("level", "=", $count + 1)
->find_all() as $match) {
if ($match->relative_url() == $current_uri) {
$item = $match;
View
46 modules/gallery/helpers/access.php
@@ -166,11 +166,11 @@ static function locked_by($group, $perm_name, $item) {
// For view permissions, if any parent is self::DENY, then those parents lock this one.
// Return
$lock = ORM::factory("item")
- ->where("`left_ptr` <= $item->left_ptr")
- ->where("`right_ptr` >= $item->right_ptr")
- ->where("items.id <> $item->id")
+ ->where("left_ptr", "<=", $item->left_ptr)
+ ->where("right_ptr", ">=", $item->right_ptr)
+ ->where("items.id", "<>", $item->id)
->join("access_intents", "items.id", "access_intents.item_id")
- ->where("access_intents.view_$group->id", self::DENY)
+ ->where("access_intents.view_$group->id", "=", self::DENY)
->order_by("level", "DESC")
->limit(1)
->find();
@@ -304,7 +304,7 @@ static function delete_permission($name) {
foreach (self::_get_all_groups() as $group) {
self::_drop_columns($name, $group);
}
- $permission = ORM::factory("permission")->where("name", $name)->find();
+ $permission = ORM::factory("permission")->where("name", "=", $name)->find();
if ($permission->loaded()) {
$permission->delete();
}
@@ -354,7 +354,7 @@ static function add_item($item) {
$access_cache->item_id = $item->id;
if ($item->id != 1) {
$parent_access_cache =
- ORM::factory("access_cache")->where("item_id", $item->parent()->id)->find();
+ ORM::factory("access_cache")->where("item_id", "=", $item->parent()->id)->find();
foreach (self::_get_all_groups() as $group) {
foreach (ORM::factory("permission")->find_all() as $perm) {
$field = "{$perm->name}_{$group->id}";
@@ -377,8 +377,8 @@ static function add_item($item) {
* @return void
*/
static function delete_item($item) {
- ORM::factory("access_intent")->where("item_id", $item->id)->find()->delete();
- ORM::factory("access_cache")->where("item_id", $item->id)->find()->delete();
+ ORM::factory("access_intent")->where("item_id", "=", $item->id)->find()->delete();
+ ORM::factory("access_cache")->where("item_id", "=", $item->id)->find()->delete();
}
/**
@@ -475,7 +475,7 @@ private static function _add_columns($perm_name, $group) {
* @return void
*/
private static function _update_access_view_cache($group, $item) {
- $access = ORM::factory("access_intent")->where("item_id", $item->id)->find();
+ $access = ORM::factory("access_intent")->where("item_id", "=", $item->id)->find();
$db = Database::instance();
$field = "view_{$group->id}";
@@ -490,10 +490,10 @@ private static function _update_access_view_cache($group, $item) {
// item, then its safe to propagate from here.
if ($access->$field !== self::DENY) {
$tmp_item = ORM::factory("item")
- ->where("left_ptr <", $item->left_ptr)
- ->where("right_ptr >", $item->right_ptr)
+ ->where("left_ptr", "<", $item->left_ptr)
+ ->where("right_ptr", ">", $item->right_ptr)
->join("access_intents", "access_intents.item_id", "items.id")
- ->where("access_intents.$field", self::DENY)
+ ->where("access_intents.$field", "=", self::DENY)
->order_by("left_ptr", "DESC")
->limit(1)
->find();
@@ -512,10 +512,10 @@ private static function _update_access_view_cache($group, $item) {
$query = ORM::factory("access_intent")
->select(array("access_intents.$field", "items.left_ptr", "items.right_ptr", "items.id"))
->join("items", "items.id", "access_intents.item_id")
- ->where("left_ptr >=", $item->left_ptr)
- ->where("right_ptr <=", $item->right_ptr)
- ->where("type", "album")
- ->where("access_intents.$field IS NOT", self::INHERIT)
+ ->where("left_ptr", ">=", $item->left_ptr)
+ ->where("right_ptr", "<=", $item->right_ptr)
+ ->where("type", "=", "album")
+ ->where("access_intents.$field", "IS NOT", self::INHERIT)
->order_by("level", "DESC")
->find_all();
foreach ($query as $row) {
@@ -549,7 +549,7 @@ private static function _update_access_view_cache($group, $item) {
* @return void
*/
private static function _update_access_non_view_cache($group, $perm_name, $item) {
- $access = ORM::factory("access_intent")->where("item_id", $item->id)->find();
+ $access = ORM::factory("access_intent")->where("item_id", "=", $item->id)->find();
$db = Database::instance();
$field = "{$perm_name}_{$group->id}";
@@ -562,9 +562,9 @@ private static function _update_access_non_view_cache($group, $perm_name, $item)
if ($access->$field === self::INHERIT) {
$tmp_item = ORM::factory("item")
->join("access_intents", "items.id", "access_intents.item_id")
- ->where("left_ptr <", $item->left_ptr)
- ->where("right_ptr >", $item->right_ptr)
- ->where("$field IS NOT", self::UNKNOWN)
+ ->where("left_ptr", "<", $item->left_ptr)
+ ->where("right_ptr", ">", $item->right_ptr)
+ ->where($field, "IS NOT", self::UNKNOWN)
->order_by("left_ptr", "DESC")
->limit(1)
->find();
@@ -578,9 +578,9 @@ private static function _update_access_non_view_cache($group, $perm_name, $item)
$query = ORM::factory("access_intent")
->select(array("access_intents.$field", "items.left_ptr", "items.right_ptr"))
->join("items", "items.id", "access_intents.item_id")
- ->where("left_ptr >=", $item->left_ptr)
- ->where("right_ptr <=", $item->right_ptr)
- ->where("$field IS NOT", self::INHERIT)
+ ->where("left_ptr", ">=", $item->left_ptr)
+ ->where("right_ptr", "<=", $item->right_ptr)
+ ->where($field, "IS NOT", self::INHERIT)
->order_by("level", "ASC")
->find_all();
foreach ($query as $row) {
View
10 modules/gallery/helpers/album.php
@@ -68,11 +68,11 @@ static function create($parent, $name, $title, $description=null, $owner_id=null
// Randomize the name or slug if there's a conflict
// @todo Improve this. Random numbers are not user friendly
while (ORM::factory("item")
- ->where("parent_id", $parent->id)
- ->open_paren()
- ->where("name", $album->name)
- ->orwhere("slug", $album->slug)
- ->close_paren()
+ ->where("parent_id", "=", $parent->id)
+ ->and_open()
+ ->where("name", "=", $album->name)
+ ->orwhere("slug", "=", $album->slug)
+ ->close()
->find()->id) {
$rand = rand();
$album->name = "{$name}-$rand";
View
8 modules/gallery/helpers/gallery_block.php
@@ -45,8 +45,8 @@ static function get($block_id) {
$block->css_id = "g-photo-stream";
$block->title = t("Photo stream");
$block->content = new View("admin_block_photo_stream.html");
- $block->content->photos =
- ORM::factory("item")->where("type", "photo")->order_by("created", "DESC")->find_all(10);
+ $block->content->photos = ORM::factory("item")
+ ->where("type", "=", "photo")->order_by("created", "DESC")->find_all(10);
break;
case "log_entries":
@@ -62,8 +62,8 @@ static function get($block_id) {
$block->title = t("Gallery stats");
$block->content = new View("admin_block_stats.html");
$block->content->album_count =
- ORM::factory("item")->where("type", "album")->where("id <>", 1)->count_all();
- $block->content->photo_count = ORM::factory("item")->where("type", "photo")->count_all();
+ ORM::factory("item")->where("type", "=", "album")->where("id", "<>", 1)->count_all();
+ $block->content->photo_count = ORM::factory("item")->where("type", "=", "photo")->count_all();
break;
case "platform_info":
View
12 modules/gallery/helpers/gallery_event.php
@@ -33,15 +33,15 @@ static function user_deleted($user) {
$db = Database::instance();
$db->from("tasks")
->set(array("owner_id" => $admin->id))
- ->where(array("owner_id" => $user->id))
+ ->where("owner_id", "=", $user->id)
->update();
$db->from("items")
->set(array("owner_id" => $admin->id))
- ->where(array("owner_id" => $user->id))
+ ->where("owner_id", "=", $user->id)
->update();
$db->from("logs")
->set(array("user_id" => $admin->id))
- ->where(array("user_id" => $user->id))
+ ->where("user_id", "=", $user->id)
->update();
}
@@ -50,15 +50,15 @@ static function identity_provider_changed($old_provider, $new_provider) {
$db = Database::instance();
$db->from("tasks")
->set(array("owner_id" => $admin->id))
- ->where("1 = 1")
+ ->where("1", "=", "1") // @todo why do we need this?
->update();
$db->from("items")
->set(array("owner_id" => $admin->id))
- ->where("1 = 1")
+ ->where("1", "=", "1") // @todo why do we need this?
->update();
$db->from("logs")
->set(array("user_id" => $admin->id))
- ->where("1 = 1")
+ ->where("1", "=", "1") // @todo why do we need this?
->update();
}
View
4 modules/gallery/helpers/gallery_rss.php
@@ -29,13 +29,13 @@ static function feed($feed_id, $offset, $limit, $id) {
case "latest":
$feed->children = ORM::factory("item")
->viewable()
- ->where("type !=", "album")
+ ->where("type", "<>", "album")
->order_by("created", "DESC")
->find_all($limit, $offset);
$all_children = ORM::factory("item")
->viewable()
- ->where("type !=", "album")
+ ->where("type", "<>", "album")
->order_by("created", "DESC");
$feed->max_pages = ceil($all_children->find_all()->count() / $limit);
View
10 modules/gallery/helpers/graphics.php
@@ -61,9 +61,9 @@ static function add_rule($module_name, $target, $operation, $args, $priority) {
*/
static function remove_rule($module_name, $target, $operation) {
ORM::factory("graphics_rule")
- ->where("module_name", $module_name)
- ->where("target", $target)
- ->where("operation", $operation)
+ ->where("module_name", "=", $module_name)
+ ->where("target", "=", $target)
+ ->where("operation", "=", $operation)
->delete_all();
self::mark_dirty($target == "thumb", $target == "resize");
@@ -181,8 +181,8 @@ private static function _get_rules($target) {
if (empty(self::$_rules_cache[$target])) {
$rules = array();
foreach (ORM::factory("graphics_rule")
- ->where("target", $target)
- ->where("active", true)
+ ->where("target", "=", $target)
+ ->where("active", "=", true)
->order_by("priority", "asc")
->find_all() as $rule) {
$rules[] = (object)$rule->as_array();
View
6 modules/gallery/helpers/l10n_client.php
@@ -134,12 +134,14 @@ static function fetch_updates() {
// incoming_translations.message to be NULL?
$locale = $message_data->locale;
$entry = ORM::factory("incoming_translation")
- ->where(array("key" => $key, "locale" => $locale))
+ ->where("key", "=", $key)
+ ->where("locale", "=", $locale)
->find();
if (!$entry->loaded()) {
// @todo Load a message key -> message (text) dict into memory outside of this loop
$root_entry = ORM::factory("incoming_translation")
- ->where(array("key" => $key, "locale" => "root"))
+ ->where("key", "=", $key)
+ ->where("locale", "=", "root")
->find();
$entry->key = $key;
$entry->message = $root_entry->message;
View
2  modules/gallery/helpers/l10n_scanner.php
@@ -31,7 +31,7 @@ static function process_message($message, &$cache) {
foreach (Database::instance()
->select("key")
->from("incoming_translations")
- ->where("locale", "root")
+ ->where("locale", "=", "root")
->get() as $row) {
$cache[$row->key] = true;
}
View
11 modules/gallery/helpers/module.php
@@ -354,7 +354,8 @@ static function get_var($module_name, $name, $default_value=null) {
$row = db::build()
->select("value")
->from("vars")
- ->where(array("module_name" => "gallery", "name" => "_cache"))
+ ->where("module_name", "=", "gallery")
+ ->where("name", "=", "_cache")
->execute()
->current();
if ($row) {
@@ -395,8 +396,8 @@ static function get_var($module_name, $name, $default_value=null) {
*/
static function set_var($module_name, $name, $value) {
$var = ORM::factory("var")
- ->where("module_name", $module_name)
- ->where("name", $name)
+ ->where("module_name", "=", $module_name)
+ ->where("name", "=", $name)
->find();
if (!$var->loaded()) {
$var->module_name = $module_name;
@@ -432,8 +433,8 @@ static function incr_var($module_name, $name, $increment=1) {
*/
static function clear_var($module_name, $name) {
$var = ORM::factory("var")
- ->where("module_name", $module_name)
- ->where("name", $name)
+ ->where("module_name", "=", $module_name)
+ ->where("name", "=", $name)
->find();
if ($var->loaded()) {
$var->delete();
View
10 modules/gallery/helpers/movie.php
@@ -90,11 +90,11 @@ static function create($parent, $filename, $name, $title,
// Randomize the name if there's a conflict
// @todo Improve this. Random numbers are not user friendly
while (ORM::factory("item")
- ->where("parent_id", $parent->id)
- ->open_paren()
- ->where("name", $movie->name)
- ->orwhere("slug", $movie->slug)
- ->close_paren()
+ ->where("parent_id", "=", $parent->id)
+ ->and_open()
+ ->where("name", "=", $movie->name)
+ ->orwhere("slug", "=", $movie->slug)
+ ->close()
->find()->id) {
$rand = rand();
$movie->name = "{$name}.$rand.{$pi['extension']}";
View
10 modules/gallery/helpers/photo.php
@@ -89,11 +89,11 @@ static function create($parent, $filename, $name, $title,
// Randomize the name or slug if there's a conflict
// @todo Improve this. Random numbers are not user friendly
while (ORM::factory("item")
- ->where("parent_id", $parent->id)
- ->open_paren()
- ->where("name", $photo->name)
- ->orwhere("slug", $photo->slug)
- ->close_paren()
+ ->where("parent_id", "=", $parent->id)
+ ->and_open()
+ ->where("name", "=", $photo->name)
+ ->orwhere("slug", "=", $photo->slug)
+ ->close()
->find()->id) {
$rand = rand();
$photo->name = "{$name}.$rand.{$pi['extension']}";
View
4 modules/gallery/helpers/site_status.php
@@ -67,7 +67,7 @@ static function error($msg, $permanent_key) {
*/
private static function _add($msg, $severity, $permanent_key) {
$message = ORM::factory("message")
- ->where("key", $permanent_key)
+ ->where("key", "=", $permanent_key)
->find();
if (!$message->loaded()) {
$message->key = $permanent_key;
@@ -82,7 +82,7 @@ private static function _add($msg, $severity, $permanent_key) {
* @param string $permanent_key
*/
static function clear($permanent_key) {
- $message = ORM::factory("message")->where("key", $permanent_key)->find();
+ $message = ORM::factory("message")->where("key", "=", $permanent_key)->find();
if ($message->loaded()) {
$message->delete();
}
View
4 modules/gallery/libraries/Gallery_I18n.php
@@ -131,7 +131,7 @@ private function lookup($locale, $message) {
foreach (db::build()
->select("key", "translation")
->from("incoming_translations")
- ->where(array("locale" => $locale))
+ ->where("locale", "=", $locale)
->execute()
->as_array() as $row) {
$this->_cache[$locale][$row->key] = unserialize($row->translation);
@@ -141,7 +141,7 @@ private function lookup($locale, $message) {
foreach (db::build()
->select("key", "translation")
->from("outgoing_translations")
- ->where(array("locale" => $locale))
+ ->where("locale", "=", $locale)
->execute()
->as_array() as $row) {
$this->_cache[$locale][$row->key] = unserialize($row->translation);
View
9 modules/gallery/libraries/drivers/Cache/Database.php
@@ -86,7 +86,7 @@ public function set($items, $tags=null, $lifetime=null) {
public function get_tag($tags) {
$db = db::build()->from("caches");
foreach ($tags as $tag) {
- $db->where("tags", "like", "<$tag>");
+ $db->where("tags", "LIKE", "<$tag>");
}
$db_result = $db->execute()->as_array();
@@ -152,12 +152,12 @@ public function get($keys, $single=false) {
public function delete($id, $tag = false) {
$this->db->from("caches");
if ($id === true) {
- $this->db->where(1);
// Delete all caches
+ $this->db->where("1", "=", "1");
} else if ($tag === true) {
$this->db->like("tags", "<$id>");
} else {
- $this->db->where("key", $id);
+ $this->db->where("key", "=", $id);
}
$status = $this->db->delete();
@@ -178,7 +178,8 @@ public function delete_tag($tags) {
public function delete_expired() {
// Delete all expired caches
$status = $this->db->from("caches")
- ->where(array("expiration !=" => 0, "expiration <=" => time()))
+ ->where("expiration", "<>", 0)
+ ->where("expiration", "<=", time())
->delete();
return count($status) > 0;
View
20 modules/gallery/models/item.php
@@ -288,9 +288,9 @@ private function _build_relative_caches() {
foreach (Database::instance()
->select(array("name", "slug"))
->from("items")
- ->where("left_ptr <=", $this->left_ptr)
- ->where("right_ptr >=", $this->right_ptr)
- ->where("id <>", 1)
+ ->where("left_ptr", "<=", $this->left_ptr)
+ ->where("right_ptr", ">=", $this->right_ptr)
+ ->where("id", "<>", 1)
->order_by("left_ptr", "ASC")
->get() as $row) {
// Don't encode the names segment
@@ -433,8 +433,8 @@ public function get_position($child, $where=array()) {
// If the comparison column has NULLs in it, we can't use comparators on it and will have to
// deal with it the hard way.
$count = $db->from("items")
- ->where("parent_id", $this->id)
- ->where($this->sort_column, NULL)
+ ->where("parent_id", "=", $this->id)
+ ->where($this->sort_column, "=", NULL)
->where($where)
->count_records();
@@ -443,8 +443,8 @@ public function get_position($child, $where=array()) {
$sort_column = $this->sort_column;
$position = $db->from("items")
- ->where("parent_id", $this->id)
- ->where("$sort_column $comp ", $child->$sort_column)
+ ->where("parent_id", "=", $this->id)
+ ->where($sort_column, $comp, $child->$sort_column)
->where($where)
->count_records();
@@ -457,8 +457,8 @@ public function get_position($child, $where=array()) {
// Fix this by doing a 2nd query where we iterate over the equivalent columns and add them to
// our base value.
foreach ($db->from("items")
- ->where("parent_id", $this->id)
- ->where($sort_column, $child->$sort_column)
+ ->where("parent_id", "=", $this->id)
+ ->where($sort_column, "=", $child->$sort_column)
->where($where)
->order_by(array("id" => "ASC"))
->get() as $row) {
@@ -484,7 +484,7 @@ public function get_position($child, $where=array()) {
$position = 0;
foreach ($db->select("id")
->from("items")
- ->where("parent_id", $this->id)
+ ->where("parent_id", "=", $this->id)
->where($where)
->order_by($order_by)
->get() as $row) {
View
16 modules/gallery/tests/Access_Helper_Test.php
@@ -106,15 +106,15 @@ public function adding_and_removing_items_adds_ands_removes_rows_test() {
$item = album::create($root, rand(), "test album");
// New rows exist
- $this->assert_true(ORM::factory("access_cache")->where("item_id", $item->id)->find()->loaded());
- $this->assert_true(ORM::factory("access_intent")->where("item_id", $item->id)->find()->loaded());
+ $this->assert_true(ORM::factory("access_cache")->where("item_id", "=", $item->id)->find()->loaded());
+ $this->assert_true(ORM::factory("access_intent")->where("item_id", "=", $item->id)->find()->loaded());
// Delete the item
$item->delete();
// Rows are gone
- $this->assert_false(ORM::factory("access_cache")->where("item_id", $item->id)->find()->loaded());
- $this->assert_false(ORM::factory("access_intent")->where("item_id", $item->id)->find()->loaded());
+ $this->assert_false(ORM::factory("access_cache")->where("item_id", "=", $item->id)->find()->loaded());
+ $this->assert_false(ORM::factory("access_intent")->where("item_id", "=", $item->id)->find()->loaded());
}
public function new_photos_inherit_parent_permissions_test() {
@@ -131,7 +131,7 @@ public function new_photos_inherit_parent_permissions_test() {
public function can_allow_deny_and_reset_intent_test() {
$root = ORM::factory("item", 1);
$album = album::create($root, rand(), "test album");
- $intent = ORM::factory("access_intent")->where("item_id", $album)->find();
+ $intent = ORM::factory("access_intent")->where("item_id", "=", $album)->find();
// Allow
access::allow(identity::everybody(), "view", $album);
@@ -141,19 +141,19 @@ public function can_allow_deny_and_reset_intent_test() {
access::deny(identity::everybody(), "view", $album);
$this->assert_same(
access::DENY,
- ORM::factory("access_intent")->where("item_id", $album)->find()->view_1);
+ ORM::factory("access_intent")->where("item_id", "=", $album)->find()->view_1);
// Allow again. If the initial value was allow, then the first Allow clause above may not
// have actually changed any values.
access::allow(identity::everybody(), "view", $album);
$this->assert_same(
access::ALLOW,
- ORM::factory("access_intent")->where("item_id", $album)->find()->view_1);
+ ORM::factory("access_intent")->where("item_id", "=", $album)->find()->view_1);
access::reset(identity::everybody(), "view", $album);
$this->assert_same(
null,
- ORM::factory("access_intent")->where("item_id", $album)->find()->view_1);
+ ORM::factory("access_intent")->where("item_id", "=", $album)->find()->view_1);
}
public function cant_reset_root_item_test() {
View
2  modules/gallery/tests/Cache_Test.php
@@ -20,7 +20,7 @@
class Cache_Test extends Unit_Test_Case {
private $_driver;
public function setup() {
- Database::instance()->from("caches")->where(1)->delete();
+ Database::instance()->from("caches")->where("1", "=", "1")->delete();
$this->_driver = new Cache_Database_Driver();
}
View
49 modules/gallery/tests/Database_Test.php
@@ -20,8 +20,8 @@
class Database_Test extends Unit_Test_Case {
function simple_where_test() {
$sql = Database::instance()
- ->where("a", 1)
- ->where("b", 2)
+ ->where("a", "=", 1)
+ ->where("b", "=", 2)
->compile();
$sql = str_replace("\n", " ", $sql);
$this->assert_same("SELECT * WHERE `a` = 1 AND `b` = 2", $sql);
@@ -29,12 +29,12 @@ function simple_where_test() {
function compound_where_test() {
$sql = Database::instance()
- ->where("outer1", 1)
- ->open_paren()
- ->where("inner1", 1)
- ->orwhere("inner2", 2)
- ->close_paren()
- ->where("outer2", 2)
+ ->where("outer1", "=", 1)
+ ->and_open()
+ ->where("inner1", "=", 1)
+ ->orwhere("inner2", "=", 2)
+ ->close()
+ ->where("outer2", "=", 2)
->compile();
$sql = str_replace("\n", " ", $sql);
$this->assert_same(
@@ -44,12 +44,12 @@ function compound_where_test() {
function group_first_test() {
$sql = Database::instance()
- ->open_paren()
- ->where("inner1", 1)
- ->orwhere("inner2", 2)
- ->close_paren()
- ->where("outer1", 1)
- ->where("outer2", 2)
+ ->and_open()
+ ->where("inner1", "=", 1)
+ ->orwhere("inner2", "=", 2)
+ ->close()
+ ->where("outer1", "=", 1)
+ ->where("outer2", "=", 2)
->compile();
$sql = str_replace("\n", " ", $sql);
$this->assert_same(
@@ -59,11 +59,12 @@ function group_first_test() {
function where_array_test() {
$sql = Database::instance()
- ->where("outer1", 1)
- ->open_paren()
- ->where("inner1", 1)
- ->orwhere(array("inner2" => 2, "inner3" => 3))
- ->close_paren()
+ ->where("outer1", "=", 1)
+ ->and_open()
+ ->where("inner1", "=", 1)
+ ->orwhere("inner2", "=", 2)
+ ->orwhere("inner3", "=", 3))
+ ->close()
->compile();
$sql = str_replace("\n", " ", $sql);
$this->assert_same(
@@ -73,10 +74,10 @@ function where_array_test() {
function notlike_test() {
$sql = Database::instance()
- ->where("outer1", 1)
- ->open_paren()
- ->ornotlike("inner1", 1)
- ->close_paren()
+ ->where("outer1", "=", 1)
+ ->or_open()
+ ->where("inner1", "NOT LIKE", 1)
+ ->close()
->compile();
$sql = str_replace("\n", " ", $sql);
$this->assert_same(
@@ -118,7 +119,7 @@ function prefix_replacement_test() {
function prefix_no_replacement_test() {
$update = Database_For_Test::instance()->from("test_tables")
- ->where("1 = 1")
+ ->where("1", "=", "1")
->set(array("name" => "Test Name"))
->update();
View
2  modules/gallery/tests/Gallery_Installer_Test.php
@@ -29,7 +29,7 @@ public function install_creates_dirs_test() {
}
public function install_registers_gallery_module_test() {
- $gallery = ORM::factory("module")->where("name", "gallery")->find();
+ $gallery = ORM::factory("module")->where("name", "=", "gallery")->find();
$this->assert_equal("gallery", $gallery->name);
}
View
4 modules/gallery/tests/I18n_Test.php
@@ -29,7 +29,7 @@ public function setup() {
$this->i18n = Gallery_I18n::instance($config);
ORM::factory("incoming_translation")
- ->where("locale", "te_ST")
+ ->where("locale", "=", "te_ST")
->delete_all();
$messages_te_ST = array(
@@ -62,7 +62,7 @@ public function set_locale_test() {
$locale = $this->i18n->locale();
$this->assert_equal("de_DE", $locale);
}
-
+
public function translate_simple_test() {
$result = $this->i18n->translate('Hello world');
$this->assert_equal('Hallo Welt', $result);
View
4 modules/gallery/tests/Item_Helper_Test.php
@@ -29,13 +29,13 @@ public function viewable_test() {
access::allow(identity::everybody(), "view", $album);
$this->assert_equal(
1,
- ORM::factory("item")->viewable()->where("id", $item->id)->count_all());
+ ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
// We can't see the item when permissions are denied
access::deny(identity::everybody(), "view", $album);
$this->assert_equal(
0,
- ORM::factory("item")->viewable()->where("id", $item->id)->count_all());
+ ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
}
public function validate_url_safe_test() {
View
4 modules/notification/helpers/notification_event.php
@@ -54,7 +54,7 @@ static function item_deleted($item) {
static function user_deleted($user) {
ORM::factory("subscriptions")
- ->where(array("user_id", $user->id))
+ ->where("user_id", "=", $user->id)
->delete_all();
}
@@ -88,7 +88,7 @@ static function comment_updated($original, $new) {
static function user_before_delete($user) {
try {
ORM::factory("subscription")
- ->where("user_id", $user->id)
+ ->where("user_id", "=", $user->id)
->delete_all();
} catch (Exception $e) {
Kohana_Log::add("error", "@todo notification_event::user_before_delete() failed");
View
10 modules/search/helpers/search.php
@@ -60,7 +60,7 @@ static function check_index() {
static function update($item) {
$data = new ArrayObject();
- $record = ORM::factory("search_record")->where("item_id", $item->id)->find();
+ $record = ORM::factory("search_record")->where("item_id", "=", $item->id)->find();
if (!$record->loaded()) {
$record->item_id = $item->id;
}
@@ -76,10 +76,10 @@ static function stats() {
->select("items.id")
->from("items")
->join("search_records", "items.id", "search_records.item_id", "left")
- ->open_paren()
- ->where("search_records.item_id", null)
- ->orwhere("search_records.dirty", 1)
- ->close_paren()
+ ->and_open()
+ ->where("search_records.item_id", "=", null)
+ ->orwhere("search_records.dirty", "=", 1)
+ ->close()
->get()
->count();
View
2  modules/search/helpers/search_event.php
@@ -28,7 +28,7 @@ static function item_updated($original, $new) {
static function item_deleted($item) {
ORM::factory("search_record")
- ->where("item_id", $item->id)
+ ->where("item_id", "=", $item->id)
->delete_all();
}
View
4 modules/search/helpers/search_task.php
@@ -45,8 +45,8 @@ static function update_index($task) {
$start = microtime(true);
foreach (ORM::factory("item")
->join("search_records", "items.id", "search_records.item_id", "left")
- ->where("search_records.item_id", null)
- ->orwhere("search_records.dirty", 1)
+ ->where("search_records.item_id", "=", null)
+ ->orwhere("search_records.dirty", "=", 1)
->find_all() as $item) {
// The query above can take a long time, so start the timer after its done
// to give ourselves a little time to actually process rows.
View
8 modules/server_add/controllers/server_add.php
@@ -177,7 +177,7 @@ static function add($task) {
$task->percent_complete = min($task->percent_complete + 0.1, 10);
$task->status = t2("Found one file", "Found %count files",
Database::instance()
- ->where("task_id", $task->id)
+ ->where("task_id", "=", $task->id)
->count_records("server_add_files"));
if (!$queue) {
@@ -197,8 +197,8 @@ static function add($task) {
// will create albums first. Ignore entries which already have an Item_Model attached,
// they're done.
$entries = ORM::factory("server_add_file")
- ->where("task_id", $task->id)
- ->where("item_id", null)
+ ->where("task_id", "=", $task->id)
+ ->where("item_id", "=", null)
->order_by("id", "ASC")
->limit(10)
->find_all();
@@ -265,7 +265,7 @@ static function add($task) {
$task->done = true;
$task->state = "success";
$task->percent_complete = 100;
- ORM::factory("server_add_file")->where("task_id", $task->id)->delete_all();
+ ORM::factory("server_add_file")->where("task_id", "=", $task->id)->delete_all();
message::info(t2("Successfully added one photo / album",
"Successfully added %count photos / albums",
$task->get("completed_files")));
View
2  modules/tag/controllers/admin_tags.php
@@ -106,7 +106,7 @@ public function rename($id) {
}
public function check_for_duplicate(Validation $post_data, $field) {
- $tag_exists = ORM::factory("tag")->where("name", $post_data[$field])->count_all();
+ $tag_exists = ORM::factory("tag")->where("name", "=", $post_data[$field])->count_all();
if ($tag_exists) {
$post_data->add_error($field, "in_use");
}
View
4 modules/tag/helpers/tag.php
@@ -33,7 +33,7 @@ static function add($item, $tag_name) {
throw new exception("@todo MISSING_TAG_NAME");
}
- $tag = ORM::factory("tag")->where("name", $tag_name)->find();
+ $tag = ORM::factory("tag")->where("name", "=", $tag_name)->find();
if (!$tag->loaded()) {
$tag->name = $tag_name;
$tag->count = 0;
@@ -93,7 +93,7 @@ static function item_tags($item) {
->select("name")
->from("tags")
->join("items_tags", "tags.id", "items_tags.tag_id", "left")
- ->where("items_tags.item_id", $item->id)
+ ->where("items_tags.item_id", "=", $item->id)
->get() as $row) {
$tags[] = $row->name;
}
View
8 modules/tag/models/tag.php
@@ -31,9 +31,9 @@ public function items($limit=null, $offset=0, $type=null) {
$model = ORM::factory("item")
->viewable()
->join("items_tags", "items.id", "items_tags.item_id")
- ->where("items_tags.tag_id", $this->id);
+ ->where("items_tags.tag_id", "=", $this->id);
if ($type) {
- $model->where("items.type", $type);
+ $model->where("items.type", "=", $type);
}
return $model->find_all($limit, $offset);
}
@@ -47,10 +47,10 @@ public function items_count($type=null) {
$model = ORM::factory("item")
->viewable()
->join("items_tags", "items.id", "items_tags.item_id")
- ->where("items_tags.tag_id", $this->id);
+ ->where("items_tags.tag_id", "=", $this->id);
if ($type) {
- $model->where("items.type", $type);
+ $model->where("items.type", "=", $type);
}
return $model->count_all();
}
View
6 modules/tag/tests/Tag_Test.php
@@ -25,18 +25,18 @@ public function create_tag_test() {
$tag1 = "tag1";
tag::add($album, $tag1);
- $tag = ORM::factory("tag")->where("name", $tag1)->find();
+ $tag = ORM::factory("tag")->where("name", "=", $tag1)->find();
$this->assert_true(1, $tag->count);
// Make sure adding the tag again doesn't increase the count
tag::add($album, $tag1);
- $tag = ORM::factory("tag")->where("name", $tag1)->find();
+ $tag = ORM::factory("tag")->where("name", "=", $tag1)->find();
$this->assert_true(1, $tag->count);
$rand = rand();
$album = album::create($root, $rand, $rand, $rand);
tag::add($album, $tag1);
- $tag = ORM::factory("tag")->where("name", $tag1)->find();
+ $tag = ORM::factory("tag")->where("name", "=", $tag1)->find();
$this->assert_true(2, $tag->count);
}
}
View
2  modules/user/helpers/group.php
@@ -31,7 +31,7 @@ class group_Core {
* @return Group_Definition the group object
*/
static function create($name) {
- $group = ORM::factory("group")->where("name", $name)->find();
+ $group = ORM::factory("group")->where("name", "=", $name)->find();
if ($group->loaded()) {
throw new Exception("@todo GROUP_ALREADY_EXISTS $name");
}
View
2  modules/user/helpers/user.php
@@ -44,7 +44,7 @@ static function guest() {
* @return User_Model
*/
static function create($name, $full_name, $password) {
- $user = ORM::factory("user")->where("name", $name)->find();
+ $user = ORM::factory("user")->where("name", "=", $name)->find();
if ($user->loaded()) {
throw new Exception("@todo USER_ALREADY_EXISTS $name");
}
View
4 modules/user/tests/User_Groups_Test.php
@@ -21,14 +21,14 @@
class User_Groups_Test extends Unit_Test_Case {
public function teardown() {
try {
- $group = ORM::factory("group")->where("name", "user_groups_test")->find();
+ $group = ORM::factory("group")->where("name", "=", "user_groups_test")->find();
if ($group->loaded()) {
$group->delete();
}
} catch (Exception $e) { }
try {
- $user = ORM::factory("user")->where("name", "user_groups_test")->find();
+ $user = ORM::factory("user")->where("name", "=", "user_groups_test")->find();
if ($user->loaded()) {
$user->delete();
}
Please sign in to comment.
Something went wrong with that request. Please try again.