format
This commit is contained in:
parent
6284f3bcb8
commit
1159ba2fa1
7 changed files with 29 additions and 35 deletions
|
@ -9,7 +9,8 @@ class CommandBuilder
|
||||||
private $args = [];
|
private $args = [];
|
||||||
public $output;
|
public $output;
|
||||||
|
|
||||||
function __construct(String $executable) {
|
public function __construct(String $executable)
|
||||||
|
{
|
||||||
if (empty($executable)) {
|
if (empty($executable)) {
|
||||||
throw new InvalidArgumentException("executable cannot be empty");
|
throw new InvalidArgumentException("executable cannot be empty");
|
||||||
}
|
}
|
||||||
|
@ -45,7 +46,6 @@ class CommandBuilder
|
||||||
} else {
|
} else {
|
||||||
return implode("\r\n", $this->output);
|
return implode("\r\n", $this->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(bool $fail_on_non_zero_return = false): int
|
public function execute(bool $fail_on_non_zero_return = false): int
|
||||||
|
|
|
@ -21,18 +21,16 @@ class Eokm extends Extension
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $event->image->hash);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $event->image->hash);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$return = curl_exec($ch);
|
$return = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
if ($return == "false") {
|
if ($return == "false") {
|
||||||
// all ok
|
// all ok
|
||||||
}
|
} elseif ($return == "true") {
|
||||||
elseif($return == "true") {
|
|
||||||
log_warning("eokm", "User tried to upload banned image {$event->image->hash}");
|
log_warning("eokm", "User tried to upload banned image {$event->image->hash}");
|
||||||
throw new UploadException("Image banned");
|
throw new UploadException("Image banned");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
log_warning("eokm", "Unexpected return from EOKM: $return");
|
log_warning("eokm", "Unexpected return from EOKM: $return");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,12 +237,10 @@ class TranscodeVideo extends Extension
|
||||||
send_event(new ImageReplaceEvent($image->id, $new_image));
|
send_event(new ImageReplaceEvent($image->id, $new_image));
|
||||||
|
|
||||||
return $new_image;
|
return $new_image;
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
/* Remove temporary file */
|
/* Remove temporary file */
|
||||||
@unlink($tmp_filename);
|
@unlink($tmp_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -289,6 +287,4 @@ class TranscodeVideo extends Extension
|
||||||
|
|
||||||
return $target_file;
|
return $target_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue