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:
Chris Morgan
2007-06-09 22:17:32 +00:00
committed by WineHQ
parent 4cbbb2fbb6
commit ea2de6fe3c
2 changed files with 9 additions and 2 deletions

View File

@@ -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);
}

View File

@@ -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);
}