diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-06-15 14:18:23 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-06-15 14:18:23 -0700 |
commit | 9504f71efcadc7ed27f6f09e5d663e8025bf3b86 (patch) | |
tree | da928864da7bd58cdbae3f9231828248a9abeacb /modules/gallery/controllers/simple_uploader.php | |
parent | 2492280cc0ec9eb64a8daeccc7b5698ece7fea66 (diff) |
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.
Diffstat (limited to 'modules/gallery/controllers/simple_uploader.php')
-rw-r--r-- | modules/gallery/controllers/simple_uploader.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index c7e5031b..8ac1fc8b 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -65,12 +65,16 @@ class Simple_Uploader_Controller extends Controller { if (array_key_exists("extension", $path_info) && in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) { $item->type = "movie"; - $item->save(); + } else { + $item->type = "photo"; + } + + item::save_with_retries($item); + + if ($item->type == "movie") { log::success("content", t("Added a movie"), html::anchor("movies/$item->id", t("view movie"))); } else { - $item->type = "photo"; - $item->save(); log::success("content", t("Added a photo"), html::anchor("photos/$item->id", t("view photo"))); } |