Screenshot::delete() and Image::delete() should check if the file exists before attempting to
call unlink() on it. Fixes three php errors that occur during the unit tests.
This commit is contained in:
@@ -391,7 +391,9 @@ class Image {
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
unlink($this->sFile);
|
||||
// if the file exists, delete it
|
||||
if(is_file($this->sFile))
|
||||
unlink($this->sFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -139,7 +139,12 @@ class Screenshot {
|
||||
|
||||
$this->oScreenshotImage->delete();
|
||||
$this->oThumbnailImage->delete();
|
||||
unlink(appdb_fullpath("/data/screenshots/originals/".$this->iScreenshotId));
|
||||
|
||||
// if the original file exists, delete it
|
||||
$sOriginalFilename = appdb_fullpath("/data/screenshots/originals/".$this->iScreenshotId);
|
||||
if(is_file($sOriginalFilename))
|
||||
unlink($sOriginalFilename);
|
||||
|
||||
if(!$bSilent)
|
||||
$this->mailMaintainers(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user