[Pkg-owncloud-commits] [owncloud] 69/73: Migration: On import of user accounts only import folders in home dir, use OC_Helper::copyr

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 7d246ab638f2e81ff4833938626468e96ea210b5
Author: Tom Needham <needham.thomas at gmail.com>
Date:   Tue Nov 6 20:59:59 2012 +0000

    Migration: On import of user accounts only import folders in home dir, use OC_Helper::copyr
    
    Check files when copying recursivley
    
    Remove obsolete method
    
    Dont count '.' and '..' as directories when importing.
---
 lib/helper.php  |    3 ++-
 lib/migrate.php |   35 ++---------------------------------
 2 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/lib/helper.php b/lib/helper.php
index 080df86..f2698ff 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -309,7 +309,8 @@ class OC_Helper {
 					self::copyr("$src/$file", "$dest/$file");
 				}
 			}
-		}elseif(file_exists($src)){
+
+		}elseif(file_exists($src) && !OC_Filesystem::isFileBlacklisted($src)) {
 			copy($src, $dest);
 		}
 	}
diff --git a/lib/migrate.php b/lib/migrate.php
index 870e16e..41ea200 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -199,8 +199,8 @@ class OC_Migrate{
 		// Get export_info.json
 		$scan = scandir( $extractpath );
 		// Check for export_info.json
-		if( !in_array( 'export_info.json', $scan ) ){
-			OC_Log::write( 'migration', 'Invalid import file, export_info.json note found', OC_Log::ERROR );
+		if( !in_array( 'export_info.json', $scan ) ) {
+			OC_Log::write( 'migration', 'Invalid import file, export_info.json not found', OC_Log::ERROR );
 			return json_encode( array( 'success' => false ) );
 		}
 		$json = json_decode( file_get_contents( $extractpath . 'export_info.json' ) );
@@ -312,37 +312,6 @@ class OC_Migrate{
 	}
 
 	/**
-	* @brief copies recursively
-	* @param $path string path to source folder
-	* @param $dest string path to destination
-	* @return bool
-	*/
-	private static function copy_r( $path, $dest ){
-		if( is_dir($path) ){
-			@mkdir( $dest );
-			$objects = scandir( $path );
-			if( sizeof( $objects ) > 0 ){
-				foreach( $objects as $file ){
-					if( $file == "." || $file == ".." || $file == ".htaccess")
-					continue;
-					// go on
-					if( is_dir( $path . '/' . $file ) ){
-						self::copy_r( $path  .'/' . $file, $dest . '/' . $file );
-					} else {
-						copy( $path . '/' . $file, $dest . '/' . $file );
-					}
-				}
-			}
-			return true;
-		}
-		elseif( is_file( $path ) ){
-			return copy( $path, $dest );
-		} else {
-			return false;
-		}
-	}
-
-	/**
 	* @brief tries to extract the import zip
 	* @param $path string path to the zip
 	* @return string path to extract location (with a trailing slash) or false on failure

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