mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-12 06:52:12 +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
|
|
@ -584,6 +584,9 @@ class commentItem extends Object
|
|||
}
|
||||
}
|
||||
|
||||
// Prevent race condition
|
||||
FileHandler::writeFile($thumbnail_file, '', 'w');
|
||||
|
||||
// Target file
|
||||
$source_file = NULL;
|
||||
$is_tmp_file = FALSE;
|
||||
|
|
@ -685,12 +688,6 @@ class commentItem extends Object
|
|||
return $thumbnail_url;
|
||||
}
|
||||
|
||||
// create an empty file not to attempt to generate the thumbnail afterwards
|
||||
else
|
||||
{
|
||||
FileHandler::writeFile($thumbnail_file, '', 'w');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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