mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Prevent race condition on thumbnail generation
This commit is contained in:
parent
94d43c2b76
commit
4e6d768dab
2 changed files with 6 additions and 8 deletions
|
|
@ -829,6 +829,9 @@ class documentItem extends Object
|
|||
else return $thumbnail_url;
|
||||
}
|
||||
|
||||
// Prevent race condition
|
||||
FileHandler::writeFile($thumbnail_file, '', 'w');
|
||||
|
||||
// Target File
|
||||
$source_file = null;
|
||||
$is_tmp_file = false;
|
||||
|
|
@ -906,8 +909,6 @@ class documentItem extends Object
|
|||
if($is_tmp_file) FileHandler::removeFile($source_file);
|
||||
// Return its path if a thumbnail is successfully genetated
|
||||
if($output) return $thumbnail_url;
|
||||
// Create an empty file not to re-generate the thumbnail
|
||||
else FileHandler::writeFile($thumbnail_file, '','w');
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue