1
0

- Fixed a bug where you could skip albums since we were resuming at the last id, but they weren't sorted.

- Fixed a couple 'else' statements to match the Gallery coding standards
This commit is contained in:
colings 2011-01-09 15:52:08 -06:00
parent 5571068444
commit f0b158be16
2 changed files with 7 additions and 12 deletions

View File

@ -27,8 +27,7 @@ class picasa_faces_event_Core {
"<a href=\"%url\">Activate the Photo Annotation module now</a>", "<a href=\"%url\">Activate the Photo Annotation module now</a>",
array("url" => url::site("admin/modules"))), array("url" => url::site("admin/modules"))),
"picasa_faces_needs_photoannotation"); "picasa_faces_needs_photoannotation");
} } else {
else {
site_status::clear("picasa_faces_needs_photoannotation"); site_status::clear("picasa_faces_needs_photoannotation");
} }
} }

View File

@ -63,6 +63,7 @@ class picasa_faces_task_Core {
foreach (ORM::factory("item") foreach (ORM::factory("item")
->where("id", ">", $last_id) ->where("id", ">", $last_id)
->where("type", "=", "album") ->where("type", "=", "album")
->order_by("id")
->find_all(100) as $albumItem) { ->find_all(100) as $albumItem) {
$picasaFile = $albumItem->file_path()."/.picasa.ini"; $picasaFile = $albumItem->file_path()."/.picasa.ini";
if (file_exists($picasaFile)) { if (file_exists($picasaFile)) {
@ -107,8 +108,7 @@ class picasa_faces_task_Core {
->where("tag_id", "=", $faceMapping->tag_id) ->where("tag_id", "=", $faceMapping->tag_id)
->where("item_id", "=", $photoItem->id) ->where("item_id", "=", $photoItem->id)
->count_all(); ->count_all();
} } else {
else {
$numTagsOnPhoto = ORM::factory("items_user") $numTagsOnPhoto = ORM::factory("items_user")
->where("user_id", "=", $faceMapping->user_id) ->where("user_id", "=", $faceMapping->user_id)
->where("item_id", "=", $photoItem->id) ->where("item_id", "=", $photoItem->id)
@ -120,8 +120,7 @@ class picasa_faces_task_Core {
if ($numTagsOnPhoto == 0) { if ($numTagsOnPhoto == 0) {
self::addNewFace($faceMapping, $faceCoords, $photoItem); self::addNewFace($faceMapping, $faceCoords, $photoItem);
$new_faces++; $new_faces++;
} } else {
else {
$old_faces++; $old_faces++;
} }
} }
@ -146,8 +145,7 @@ class picasa_faces_task_Core {
$task->done = true; $task->done = true;
$task->state = "success"; $task->state = "success";
$task->percent_complete = 100; $task->percent_complete = 100;
} } else {
else {
$task->percent_complete = round(100 * $completed / $total); $task->percent_complete = round(100 * $completed / $total);
} }
@ -221,8 +219,7 @@ class picasa_faces_task_Core {
$newFace->y2 = $bottom; $newFace->y2 = $bottom;
$newFace->description = ""; $newFace->description = "";
$newFace->save(); $newFace->save();
} } else {
else {
// Add the face // Add the face
$newFace = ORM::factory("items_user"); $newFace = ORM::factory("items_user");
$newFace->user_id = $faceMapping->user_id; $newFace->user_id = $faceMapping->user_id;
@ -251,8 +248,7 @@ class picasa_faces_task_Core {
if ($ini_line[0] == '[') { if ($ini_line[0] == '[') {
// If this line starts with [ it's a filename, strip off the brackets // If this line starts with [ it's a filename, strip off the brackets
$curFilename = substr($ini_line, 1, -1); $curFilename = substr($ini_line, 1, -1);
} } else {
else {
// If this isn't a filename, it must be data for a file, get the key/value pair // If this isn't a filename, it must be data for a file, get the key/value pair
$photoData = explode("=", $ini_line); $photoData = explode("=", $ini_line);