[Pkg-owncloud-commits] [owncloud] 68/73: Migration: Allow for no app data cases; handle file copying better

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:09:14 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 3a5298287bc1730ce5bfca2f2b359c9285afd028
Author: Tom Needham <needham.thomas at gmail.com>
Date:   Tue Nov 6 23:49:25 2012 +0000

    Migration: Allow for no app data cases; handle file copying better
---
 lib/migrate.php |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/migrate.php b/lib/migrate.php
index 18a442a..870e16e 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -235,12 +235,19 @@ class OC_Migrate{
 					return json_encode( array( 'success' => false ) );
 				}
 				// Copy data
-				if( !self::copy_r( $extractpath . $json->exporteduser, $datadir . '/' . self::$uid ) ){
-					return json_encode( array( 'success' => false ) );
+				$userfolder = $extractpath . $json->exporteduser;
+				$newuserfolder = $datadir . '/' . self::$uid;
+				foreach(scandir($userfolder) as $file){
+					if($file !== '.' && $file !== '..' && is_dir($file)){
+						// Then copy the folder over
+						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 ) ){

-- 
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