]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix user app data export
authorTom Needham <needham.thomas@gmail.com>
Sun, 1 Apr 2012 00:07:39 +0000 (00:07 +0000)
committerTom Needham <needham.thomas@gmail.com>
Sun, 1 Apr 2012 00:07:39 +0000 (00:07 +0000)
lib/migration/content.php

index a9fa05596b3b36cf4602e6d38e9bafde2d9b541e..d304051f3e6cf16a1f4ae9c29923f2bc00cb30cd 100644 (file)
@@ -47,7 +47,6 @@ class OC_Migration_Content{
                        // Get db path
                        $db = $this->db->getDatabase();
                        $this->tmpfiles[] = $db;
-                       OC_Log::write('user-migrate',$db, OC_Log::INFO);
                }
                
        }
@@ -110,7 +109,8 @@ class OC_Migration_Content{
                        
                        foreach( $options['matchval'] as $matchval ){
                                // Run the query for this match value (where x = y value)
-                               $query = OC_DB::prepare( "SELECT * FROM *PREFIX*" . $options['table'] . " WHERE " . $options['matchcol'] . " LIKE ?" );
+                               $sql = "SELECT * FROM *PREFIX*" . $options['table'] . " WHERE " . $options['matchcol'] . " LIKE ?";
+                               $query = OC_DB::prepare( $sql );
                                $results = $query->execute( array( $matchval ) );
                                $newreturns = $this->insertData( $results, $options );
                                $return = array_merge( $return, $newreturns );
@@ -118,7 +118,8 @@ class OC_Migration_Content{
 
                } else {
                        // Just get everything
-                       $query = OC_DB::prepare( "SELECT * FROM *PREFIX*" . $options['table'] );
+                       $sql = "SELECT * FROM *PREFIX*" . $options['table'];
+                       $query = OC_DB::prepare( $sql );
                        $results = $query->execute();
                        $return = $this->insertData( $results, $options );
        
@@ -136,6 +137,7 @@ class OC_Migration_Content{
        */
        private function insertData( $data, $options ){
                $return = array();
+               // Foreach row of data to insert
                while( $row = $data->fetchRow() ){
                        // Now save all this to the migration.db
                        foreach($row as $field=>$value){
@@ -166,6 +168,8 @@ class OC_Migration_Content{
                                        $return[] = reset($row);        
                                }
                        }
+                       $fields = '';
+                       $values = '';
                }
                return $return;
        }