diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php index f9e5557f..e2886f99 100644 --- a/ext/cron_uploader/main.php +++ b/ext/cron_uploader/main.php @@ -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(); diff --git a/ext/handle_video/main.php b/ext/handle_video/main.php index 5e383d92..855e4662 100644 --- a/ext/handle_video/main.php +++ b/ext/handle_video/main.php @@ -82,6 +82,7 @@ class VideoFileHandler extends DataHandlerExtension } } } catch (MediaException $e) { + // a post with no metadata is better than no post } } } diff --git a/ext/image_view_counter/main.php b/ext/image_view_counter/main.php index 43250002..d5ebe8a5 100644 --- a/ext/image_view_counter/main.php +++ b/ext/image_view_counter/main.php @@ -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; } diff --git a/ext/log_logstash/main.php b/ext/log_logstash/main.php index c09d7e24..c50d1fbb 100644 --- a/ext/log_logstash/main.php +++ b/ext/log_logstash/main.php @@ -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 } } } diff --git a/ext/media/main.php b/ext/media/main.php index e11a6009..5c8c9957 100644 --- a/ext/media/main.php +++ b/ext/media/main.php @@ -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; } diff --git a/ext/rotate/main.php b/ext/rotate/main.php index bb03e4a6..1e0ece42 100644 --- a/ext/rotate/main.php +++ b/ext/rotate/main.php @@ -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."); } diff --git a/ext/transcode/main.php b/ext/transcode/main.php index 67fadd83..efc6d848 100644 --- a/ext/transcode/main.php +++ b/ext/transcode/main.php @@ -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; }