diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-06-15 17:17:25 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-06-15 17:17:25 -0700 |
commit | 48dc07dbc8189eb16f97b7013b0481982286ab2c (patch) | |
tree | dfe6b59e175ed11e6e352260e81950fc71550547 /modules/gallery/helpers/item.php | |
parent | 8fb56abf034dd1f5c561e7af12bf6e097a3de6f6 (diff) |
Revert "Fix for ticket #1118. Create a item::save_with_retries helper
method, which encapsulates saving an item and handling name and slug
conflicts. Call this instead of doing a save directly."
Rolled this back because it fails KISS. We already have an API for
saving models with Item_Model::save() that's consistent with all of
our other model code. Adding a new way to save items is confusing and
inconsistent.
This reverts commit 9504f71efcadc7ed27f6f09e5d663e8025bf3b86.
Diffstat (limited to 'modules/gallery/helpers/item.php')
-rw-r--r-- | modules/gallery/helpers/item.php | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 0710d8b2..6a740de4 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -43,17 +43,6 @@ class item_Core { // Moving may result in name or slug conflicts. If that happens, try up to 5 times to pick a // random name (or slug) to avoid the conflict. - $message = item::save_with_retries($source); - - // If the target has no cover item, make this it. - if ($target->album_cover_item_id == null) { - item::make_album_cover($source); - } - - return $message; - } - - static function save_with_retries($source, $retries=5) { $orig_name = $source->name; $orig_name_filename = pathinfo($source->name, PATHINFO_FILENAME); $orig_name_extension = pathinfo($source->name, PATHINFO_EXTENSION); @@ -102,6 +91,12 @@ class item_Core { } } } + + // If the target has no cover item, make this it. + if ($target->album_cover_item_id == null) { + item::make_album_cover($source); + } + return $message; } |