Fix "Implement a class for automatic temporary file handling"
TemporaryFile::commit throws instead of returning a bool.
This commit is contained in:
parent
d7e7396d17
commit
160b6ccd94
|
@ -517,7 +517,12 @@ class MediaFile
|
||||||
if ($media === 'image') {
|
if ($media === 'image') {
|
||||||
$result = rename($outpath, $filepath);
|
$result = rename($outpath, $filepath);
|
||||||
} else {
|
} else {
|
||||||
$result = $tempfile->commit($filepath);
|
try {
|
||||||
|
$tempfile->commit($filepath);
|
||||||
|
$result = true;
|
||||||
|
} catch (TemporaryFileException $e) {
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
// TRANS: Server exception thrown when a file upload operation fails because the file could
|
// TRANS: Server exception thrown when a file upload operation fails because the file could
|
||||||
|
|
|
@ -115,7 +115,12 @@ class FFmpegPlugin extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$success = $tempfile->commit($outpath);
|
try {
|
||||||
|
$tempfile->commit($outpath);
|
||||||
|
} catch (TemporaryFileException $e) {
|
||||||
|
$this->log(LOG_ERR, 'Unable to save the GIF image');
|
||||||
|
$success = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@unlink($palette);
|
@unlink($palette);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user