summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/libraries/ORM_MPTT.php8
-rw-r--r--modules/gallery/models/item.php5
2 files changed, 11 insertions, 2 deletions
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");