]> source.dussan.org Git - nextcloud-server.git/commitdiff
Migration: Allow for no app data cases; handle file copying better
authorTom Needham <needham.thomas@gmail.com>
Tue, 6 Nov 2012 23:49:25 +0000 (23:49 +0000)
committerTom Needham <needham.thomas@gmail.com>
Thu, 8 Nov 2012 11:37:27 +0000 (11:37 +0000)
lib/migrate.php

index 58b9182a45f13c919bdf256cfa91bfcc7d972dc6..ca74edcdc57b24051a78ff3168b5545e4f88b874 100644 (file)
@@ -238,18 +238,16 @@ class OC_Migrate{
                                $userfolder = $extractpath . $json->exporteduser;
                                $newuserfolder = $datadir . '/' . self::$uid;
                                foreach(scandir($userfolder) as $file){
-                                       $success = true;
                                        if($file !== '.' && $file !== '..' && is_dir($file)){
                                                // Then copy the folder over
-                                               $success = OC_Helper::copyr($userfolder.'/'.$file, $newuserfolder.'/'.$file);
-                                       }
-                                       if(!$success){
-                                               return json_encode( array( 'success' => false ) );
+                                               OC_Helper::copyr($userfolder.'/'.$file, $newuserfolder.'/'.$file);
                                        }
                                }
                                // Import user app data
-                               if( !$appsimported = self::importAppData( $extractpath . $json->exporteduser . '/migration.db', $json, self::$uid ) ) {
-                                       return json_encode( array( 'success' => false ) );
+                               if(file_exists($extractpath . $json->exporteduser . '/migration.db')){
+                                       if( !$appsimported = self::importAppData( $extractpath . $json->exporteduser . '/migration.db', $json, self::$uid ) ) {
+                                               return json_encode( array( 'success' => false ) );
+                                       }
                                }
                                // All done!
                                if( !self::unlink_r( $extractpath ) ) {