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.

This commit is contained in:
Tim Almdal
2010-06-15 14:18:23 -07:00
parent 2492280cc0
commit 9504f71efc
3 changed files with 21 additions and 14 deletions
@@ -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")));
}