[Fusionforge-commits] r10273 - branches/Branch_5_0/gforge/plugins/scmsvn/common

Olivier Meunier musicoliv at libremir.placard.fr.eu.org
Tue Jul 20 15:30:28 CEST 2010


Author: musicoliv
Date: 2010-07-20 15:30:28 +0200 (Tue, 20 Jul 2010)
New Revision: 10273

Modified:
   branches/Branch_5_0/gforge/plugins/scmsvn/common/SVNPlugin.class.php
Log:
Check that the files exist before removing old snapshots and tarballs for SVN plugin

Modified: branches/Branch_5_0/gforge/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- branches/Branch_5_0/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2010-07-19 18:08:02 UTC (rev 10272)
+++ branches/Branch_5_0/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2010-07-20 13:30:28 UTC (rev 10273)
@@ -432,8 +432,12 @@
 		}
 
 		if (! $project->enableAnonSCM()) {
-			unlink ($snapshot) ;
-			unlink ($tarball) ;
+			if (is_file($snapshot)) {
+				unlink ($snapshot) ;
+			}
+			if (is_file($tarball)) {
+				unlink ($tarball) ;
+			}
 			return false;
 		}
 
@@ -441,8 +445,12 @@
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		if (!is_dir ($repo) || !is_file ("$repo/format")) {
-			unlink ($snapshot) ;
-			unlink ($tarball) ;
+			if (is_file($snapshot)) {
+				unlink ($snapshot) ;
+			}
+			if (is_file($tarball)) {
+				unlink ($tarball) ;
+			}
 			return false ;
 		}
 
@@ -454,7 +462,7 @@
 		$dir = $project->getUnixName ()."-$today" ;
 		system ("mkdir -p $tmp") ;
 		$code = 0 ;
-		system ("svn ls file://$repo/trunk", $code) ;
+		system ("svn ls file://$repo/trunk > /dev/null", $code) ;
 		if ($code == 0) {
 			system ("cd $tmp ; svn checkout file://$repo/trunk $dir > /dev/null 2>&1") ;
 			system ("tar czCf $tmp $tmp/snapshot.tar.gz $dir") ;
@@ -463,7 +471,9 @@
 			unlink ("$tmp/snapshot.tar.gz") ;
 			system ("rm -rf $tmp/$dir") ;
 		} else {
-			unlink ($snapshot) ;
+			if (is_file($snapshot)) {
+				unlink ($snapshot) ;
+			}
 		}
 
 		system ("tar czCf $toprepo $tmp/tarball.tar.gz " . $project->getUnixName()) ;




More information about the Fusionforge-commits mailing list