From f0b158be1698c88cd1e36628f344b9bcb2b6af02 Mon Sep 17 00:00:00 2001 From: colings Date: Sun, 9 Jan 2011 15:52:08 -0600 Subject: [PATCH] - 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 --- .../picasa_faces/helpers/picasa_faces_event.php | 3 +-- .../picasa_faces/helpers/picasa_faces_task.php | 16 ++++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/3.0/modules/picasa_faces/helpers/picasa_faces_event.php b/3.0/modules/picasa_faces/helpers/picasa_faces_event.php index 605e286b..9345fcb1 100644 --- a/3.0/modules/picasa_faces/helpers/picasa_faces_event.php +++ b/3.0/modules/picasa_faces/helpers/picasa_faces_event.php @@ -27,8 +27,7 @@ class picasa_faces_event_Core { "Activate the Photo Annotation module now", array("url" => url::site("admin/modules"))), "picasa_faces_needs_photoannotation"); - } - else { + } else { site_status::clear("picasa_faces_needs_photoannotation"); } } diff --git a/3.0/modules/picasa_faces/helpers/picasa_faces_task.php b/3.0/modules/picasa_faces/helpers/picasa_faces_task.php index 77d435b1..91419173 100644 --- a/3.0/modules/picasa_faces/helpers/picasa_faces_task.php +++ b/3.0/modules/picasa_faces/helpers/picasa_faces_task.php @@ -63,6 +63,7 @@ class picasa_faces_task_Core { foreach (ORM::factory("item") ->where("id", ">", $last_id) ->where("type", "=", "album") + ->order_by("id") ->find_all(100) as $albumItem) { $picasaFile = $albumItem->file_path()."/.picasa.ini"; if (file_exists($picasaFile)) { @@ -107,8 +108,7 @@ class picasa_faces_task_Core { ->where("tag_id", "=", $faceMapping->tag_id) ->where("item_id", "=", $photoItem->id) ->count_all(); - } - else { + } else { $numTagsOnPhoto = ORM::factory("items_user") ->where("user_id", "=", $faceMapping->user_id) ->where("item_id", "=", $photoItem->id) @@ -120,8 +120,7 @@ class picasa_faces_task_Core { if ($numTagsOnPhoto == 0) { self::addNewFace($faceMapping, $faceCoords, $photoItem); $new_faces++; - } - else { + } else { $old_faces++; } } @@ -146,8 +145,7 @@ class picasa_faces_task_Core { $task->done = true; $task->state = "success"; $task->percent_complete = 100; - } - else { + } else { $task->percent_complete = round(100 * $completed / $total); } @@ -221,8 +219,7 @@ class picasa_faces_task_Core { $newFace->y2 = $bottom; $newFace->description = ""; $newFace->save(); - } - else { + } else { // Add the face $newFace = ORM::factory("items_user"); $newFace->user_id = $faceMapping->user_id; @@ -251,8 +248,7 @@ class picasa_faces_task_Core { if ($ini_line[0] == '[') { // If this line starts with [ it's a filename, strip off the brackets $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 $photoData = explode("=", $ini_line);