This commit is contained in:
Shish 2020-09-19 00:18:51 +01:00
parent 6284f3bcb8
commit 1159ba2fa1
7 changed files with 29 additions and 35 deletions

View File

@ -9,7 +9,8 @@ class CommandBuilder
private $args = [];
public $output;
function __construct(String $executable) {
public function __construct(String $executable)
{
if (empty($executable)) {
throw new InvalidArgumentException("executable cannot be empty");
}
@ -45,7 +46,6 @@ class CommandBuilder
} else {
return implode("\r\n", $this->output);
}
}
public function execute(bool $fail_on_non_zero_return = false): int

View File

@ -21,18 +21,16 @@ class Eokm extends Extension
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $event->image->hash);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$return = curl_exec($ch);
curl_close($ch);
if ($return == "false") {
// all ok
}
elseif($return == "true") {
} elseif ($return == "true") {
log_warning("eokm", "User tried to upload banned image {$event->image->hash}");
throw new UploadException("Image banned");
}
else {
} else {
log_warning("eokm", "Unexpected return from EOKM: $return");
}
}

View File

@ -237,12 +237,10 @@ class TranscodeVideo extends Extension
send_event(new ImageReplaceEvent($image->id, $new_image));
return $new_image;
} finally {
/* Remove temporary file */
@unlink($tmp_filename);
}
}
@ -289,6 +287,4 @@ class TranscodeVideo extends Extension
return $target_file;
}
}