This commit is contained in:
Shish 2019-10-02 10:10:47 +01:00
parent 486c048950
commit 8f688fd2c6
7 changed files with 12 additions and 12 deletions

View file

@ -291,8 +291,8 @@ class CronUploader extends Extension
for ($i = 0; $i < $upload_count && sizeof($this->image_queue) > 0; $i++) {
$img = array_pop($this->image_queue);
$database->beginTransaction();
try {
$database->beginTransaction();
$this->add_upload_info("Adding file: {$img[1]} - tags: {$img[2]}");
$result = $this->add_image($img[0], $img[1], $img[2]);
$database->commit();
@ -303,24 +303,18 @@ class CronUploader extends Extension
$added++;
}
} catch (Exception $e) {
$database->rollback();
$failed++;
$this->move_uploaded($img[0], $img[1], $output_subdir, true);
$msgNumber = $this->add_upload_info("(" . gettype($e) . ") " . $e->getMessage());
$msgNumber = $this->add_upload_info($e->getTraceAsString());
try {
$database->rollback();
} catch (Exception $e) {
}
}
}
$msgNumber = $this->add_upload_info("Items added: $added");
$msgNumber = $this->add_upload_info("Items merged: $merged");
$msgNumber = $this->add_upload_info("Items failed: $failed");
// Display & save upload log
$this->handle_log();

View file

@ -82,6 +82,7 @@ class VideoFileHandler extends DataHandlerExtension
}
}
} catch (MediaException $e) {
// a post with no metadata is better than no post
}
}
}

View file

@ -61,7 +61,7 @@ class ImageViewCounter extends Extension
global $database, $user;
// don't add view if person already viewed recently
if ($this->can_add_view($imgid) == false) {
if ($this->can_add_view($imgid) === false) {
return;
}

View file

@ -26,6 +26,7 @@ class LogLogstash extends Extension
$this->send_data($data);
} catch (Exception $e) {
// we can't log that logging is broken
}
}
@ -49,6 +50,7 @@ class LogLogstash extends Extension
fwrite($fp, json_encode($data));
fclose($fp);
} catch (Exception $e) {
// we can't log that logging is broken
}
}
}

View file

@ -334,14 +334,16 @@ class Media extends Extension
case "bulk_media_rescan":
if ($user->can(Permissions::RESCAN_MEDIA)) {
$total = 0;
$failed = 0;
foreach ($event->items as $image) {
try {
$this->update_image_media_properties($image->hash, $image->ext);
$total++;
} catch (MediaException $e) {
$failed++;
}
}
flash_message("Scanned media properties for $total items");
flash_message("Scanned media properties for $total items, failed for $failed");
}
break;
}

View file

@ -112,7 +112,7 @@ class RotateImage extends Extension
}
$image_filename = warehouse_path(Image::IMAGE_DIR, $hash);
if (file_exists($image_filename)==false) {
if (file_exists($image_filename)===false) {
throw new ImageRotateException("$image_filename does not exist.");
}

View file

@ -200,10 +200,11 @@ class TranscodeImage extends Extension
try {
$database->rollback();
} catch (Exception $e) {
// is this safe? o.o
}
}
}
flash_message("Transcoded $total items");
flash_message("Transcoded $total items");
}
break;
}