Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Repair photo ratings during import
  • Loading branch information
jeroenrnl committed Jan 12, 2014
1 parent 62fcc76 commit cfde82d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions php/import.inc.php
Expand Up @@ -85,6 +85,14 @@ public static function photos(Array $files, Array $vars) {
$photo->setFields($exif);
}
}
if(isset($vars["rating"])) {
$rating=$vars["rating"];
if(!(is_numeric($rating) && (1 <= $rating) && ($rating <= 10))) {
unset($rating);
}
unset($vars["rating"]);
}

if ($vars) {
$photo->setFields($vars);
}
Expand All @@ -108,6 +116,7 @@ public static function photos(Array $files, Array $vars) {
} else {
$photo->set("path", $path);
}

try {
$photo->import($file);
} catch (FileException $e) {
Expand All @@ -129,6 +138,7 @@ public static function photos(Array $files, Array $vars) {
}
$photo->update();
$photo->updateRelations($vars, "_id");
$photo->rate($rating);
if(conf::get("import.cli.hash")===true) {
try {
$photo->getHash();
Expand Down

0 comments on commit cfde82d

Please sign in to comment.