From df378fcca84bb09a90d640c6a500b02b9b3b9f89 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 3 Oct 2010 22:10:05 -0700 Subject: Don't wrap the action in url::site() -- form::open() will do that for us. Fixes #1417. --- modules/gallery/libraries/InPlaceEdit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/InPlaceEdit.php b/modules/gallery/libraries/InPlaceEdit.php index 7e631ab9..42eb2ffe 100644 --- a/modules/gallery/libraries/InPlaceEdit.php +++ b/modules/gallery/libraries/InPlaceEdit.php @@ -70,7 +70,7 @@ class InPlaceEdit_Core { public function render() { $v = new View("in_place_edit.html"); - $v->action = url::site($this->action); + $v->action = $this->action; $v->form = $this->form; $v->errors = $this->errors; foreach ($v->errors as $key => $error) { -- cgit v1.2.3 From 8d030cea64c0e5934e4dbf5fc56fab87c7e253bb Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 18 Nov 2010 09:52:40 -0800 Subject: Fix a bug where simultaneous deletes of the same item can result in it deleting the first item row in the database. The root issue is a bug in Kohana that's addressed in dca9b5f3fc8e80ee0667cac88d688e2287b1e7f4 but in this change we deal with the fact that reloading an item can result in an instance of the item that's unloaded. In those cases, we should just ignore it and move on. Fixes #1489. --- modules/gallery/libraries/ORM_MPTT.php | 8 ++++++-- modules/gallery/models/item.php | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php index d8d88e4e..f20fafa0 100644 --- a/modules/gallery/libraries/ORM_MPTT.php +++ b/modules/gallery/libraries/ORM_MPTT.php @@ -96,12 +96,16 @@ class ORM_MPTT_Core extends ORM { $item->reload()->delete(); } - // Deleting children has affected this item - $this->reload(); + // Deleting children has affected this item, but we'll reload it below. } $this->lock(); $this->reload(); // Assume that the prior lock holder may have changed this entry + if (!$this->loaded()) { + // Concurrent deletes may result in this item already being gone. Ignore it. + return; + } + try { db::build() ->update($this->table_name) diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 891153d1..9016a04a 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -71,6 +71,11 @@ class Item_Model_Core extends ORM_MPTT { } public function delete($ignored_id=null) { + if (!$this->loaded()) { + // Concurrent deletes may result in this item already being gone. Ignore it. + return; + } + if ($this->id == 1) { $v = new Validation(array("id")); $v->add_error("id", "cant_delete_root_album"); -- cgit v1.2.3