appdb/include image.php screenshot.php

WineHQ wineowner at wine.codeweavers.com
Sat Jun 9 17:17:32 CDT 2007


ChangeSet ID:	31167
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/06/09 17:17:32

Modified files:
	include        : image.php screenshot.php 

Log message:
	Chris Morgan <cmorgan at alum.wpi.edu>
	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.

Patch: http://cvs.winehq.org/patch.py?id=31167

Old revision  New revision  Changes     Path
 1.9           1.10          +3 -1       appdb/include/image.php
 1.67          1.68          +6 -1       appdb/include/screenshot.php

Index: appdb/include/image.php
diff -u -p appdb/include/image.php:1.9 appdb/include/image.php:1.10
--- appdb/include/image.php:1.9	9 Jun 2007 22:17:32 -0000
+++ appdb/include/image.php	9 Jun 2007 22:17:32 -0000
@@ -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);
     }
 
     
Index: appdb/include/screenshot.php
diff -u -p appdb/include/screenshot.php:1.67 appdb/include/screenshot.php:1.68
--- appdb/include/screenshot.php:1.67	9 Jun 2007 22:17:32 -0000
+++ appdb/include/screenshot.php	9 Jun 2007 22:17:32 -0000
@@ -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);
         }



More information about the wine-cvs mailing list