[Pkg-owncloud-commits] [owncloud] 39/73: Only try to delete migration.db if it was created.

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:09:05 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.0.10
in repository owncloud.

commit a5c42edbe5ce7c9c47af8ac89d6c28806b80cd08
Author: Tom Needham <needham.thomas at gmail.com>
Date:   Tue Sep 18 16:25:34 2012 +0000

    Only try to delete migration.db if it was created.
---
 lib/migration/content.php |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/lib/migration/content.php b/lib/migration/content.php
index 7ef88f3..60dade3 100644
--- a/lib/migration/content.php
+++ b/lib/migration/content.php
@@ -30,8 +30,9 @@ class OC_Migration_Content{
 	// Holds the MDB2 object
 	private $db=null;
 	// Holds an array of tmpfiles to delete after zip creation
-	private $tmpfiles=false;
-	
+
+	private $tmpfiles=array();
+
 	/**
 	* @brief sets up the
 	* @param $zip ZipArchive object
@@ -42,18 +43,21 @@ class OC_Migration_Content{
 
 		$this->zip = $zip;
 		$this->db = $db;
-		
-		if( !is_null( $db ) ){
-			// Get db path
-			$db = $this->db->getDatabase();
-			$this->tmpfiles[] = $db;
-		}
-		
+
 	}
 	
 	// @brief prepares the db
 	// @param $query the sql query to prepare
-	public function prepare( $query ){
+	public function prepare( $query ) {
+		
+		// Only add database to tmpfiles if actually used
+		if( !is_null( $this->db ) ) {
+			// Get db path
+			$db = $this->db->getDatabase();
+			if(!in_array($db, $this->tmpfiles)){
+				$this->tmpfiles[] = $db;
+			}
+		}
 		
 		// Optimize the query
 		$query = $this->processQuery( $query );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list