Skip to content

Commit 4619c66

Browse files
committed
Migration: Allow for no app data cases; handle file copying better
1 parent e8a0cea commit 4619c66

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Diff for: lib/migrate.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -238,18 +238,16 @@ public static function import( $path, $type='user', $uid=null ) {
238238
$userfolder = $extractpath . $json->exporteduser;
239239
$newuserfolder = $datadir . '/' . self::$uid;
240240
foreach(scandir($userfolder) as $file){
241-
$success = true;
242241
if($file !== '.' && $file !== '..' && is_dir($file)){
243242
// Then copy the folder over
244-
$success = OC_Helper::copyr($userfolder.'/'.$file, $newuserfolder.'/'.$file);
245-
}
246-
if(!$success){
247-
return json_encode( array( 'success' => false ) );
243+
OC_Helper::copyr($userfolder.'/'.$file, $newuserfolder.'/'.$file);
248244
}
249245
}
250246
// Import user app data
251-
if( !$appsimported = self::importAppData( $extractpath . $json->exporteduser . '/migration.db', $json, self::$uid ) ) {
252-
return json_encode( array( 'success' => false ) );
247+
if(file_exists($extractpath . $json->exporteduser . '/migration.db')){
248+
if( !$appsimported = self::importAppData( $extractpath . $json->exporteduser . '/migration.db', $json, self::$uid ) ) {
249+
return json_encode( array( 'success' => false ) );
250+
}
253251
}
254252
// All done!
255253
if( !self::unlink_r( $extractpath ) ) {

0 commit comments

Comments
 (0)