diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-09-18 20:25:34 +0400 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-09-18 20:31:27 +0400 |
commit | a5c42edbe5ce7c9c47af8ac89d6c28806b80cd08 (patch) | |
tree | ba47642beeab68a2d049ff82b090ca8facc325a9 /lib | |
parent | 3b465f419acb9cd85c9dc25ab9166fe3fa529afe (diff) |
Only try to delete migration.db if it was created.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/migration/content.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/migration/content.php b/lib/migration/content.php index 7ef88f36e43..60dade3dd9b 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 ); |