make more things use move_upload_to_archive(), and make that function quieter
git-svn-id: file:///home/shish/svn/shimmie2/trunk@914 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
3061cb3f23
commit
051389606e
@ -14,10 +14,7 @@ class FlashFileHandler extends Extension {
|
|||||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||||
$hash = $event->hash;
|
$hash = $event->hash;
|
||||||
$ha = substr($hash, 0, 2);
|
$ha = substr($hash, 0, 2);
|
||||||
if(!copy($event->tmpname, "images/$ha/$hash")) {
|
if(!move_upload_to_archive($event)) return;
|
||||||
$event->veto("Flash Handler failed to move file from uploads to archive");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
||||||
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
||||||
if(is_null($image)) {
|
if(is_null($image)) {
|
||||||
|
@ -14,10 +14,7 @@ class MP3FileHandler extends Extension {
|
|||||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||||
$hash = $event->hash;
|
$hash = $event->hash;
|
||||||
$ha = substr($hash, 0, 2);
|
$ha = substr($hash, 0, 2);
|
||||||
if(!copy($event->tmpname, "images/$ha/$hash")) {
|
if(!move_upload_to_archive($event)) return;
|
||||||
$event->veto("MP3 Handler failed to move file from uploads to archive");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
||||||
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
||||||
if(is_null($image)) {
|
if(is_null($image)) {
|
||||||
|
@ -255,7 +255,7 @@ function get_base_href() {
|
|||||||
function move_upload_to_archive($event) {
|
function move_upload_to_archive($event) {
|
||||||
$hash = $event->hash;
|
$hash = $event->hash;
|
||||||
$ha = substr($hash, 0, 2);
|
$ha = substr($hash, 0, 2);
|
||||||
if(!copy($event->tmpname, "images/$ha/$hash")) {
|
if(!@copy($event->tmpname, "images/$ha/$hash")) {
|
||||||
$event->veto("Failed to copy file from uploads ({$event->tmpname}) to archive (images/$ha/$hash)");
|
$event->veto("Failed to copy file from uploads ({$event->tmpname}) to archive (images/$ha/$hash)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,7 @@ class PixelFileHandler extends Extension {
|
|||||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||||
$hash = $event->hash;
|
$hash = $event->hash;
|
||||||
$ha = substr($hash, 0, 2);
|
$ha = substr($hash, 0, 2);
|
||||||
if(!copy($event->tmpname, "images/$ha/$hash")) {
|
if(!move_upload_to_archive($event)) return;
|
||||||
$event->veto("Pixel Handler failed to copy file from uploads ({$event->tmpname}) to archive (images/$ha/$hash)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
||||||
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
|
||||||
if(is_null($image)) {
|
if(is_null($image)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user