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,6 +391,8 @@ class Image {
|
|||||||
*/
|
*/
|
||||||
function delete()
|
function delete()
|
||||||
{
|
{
|
||||||
|
// if the file exists, delete it
|
||||||
|
if(is_file($this->sFile))
|
||||||
unlink($this->sFile);
|
unlink($this->sFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,12 @@ class Screenshot {
|
|||||||
|
|
||||||
$this->oScreenshotImage->delete();
|
$this->oScreenshotImage->delete();
|
||||||
$this->oThumbnailImage->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)
|
if(!$bSilent)
|
||||||
$this->mailMaintainers(true);
|
$this->mailMaintainers(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user