Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2012-03-21 00:32:01 +0400
committerTom Needham <needham.thomas@gmail.com>2012-03-21 00:32:01 +0400
commit0fa5e196ef8d0b220e4af17b008fb4908b080445 (patch)
tree956a534595f047dc603ca15afcc4914c0e4ac8c5 /lib/migrate.php
parent514c9ad8e7df1d7882adc33c42eb32a209537273 (diff)
Try to use old uid when importing
Diffstat (limited to 'lib/migrate.php')
-rw-r--r--lib/migrate.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/migrate.php b/lib/migrate.php
index 0058de73919..8b0a2aa3f74 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -190,9 +190,10 @@ class OC_Migrate{
/**
* @breif imports a user, or owncloud instance
* @param $path string path to zip
+ * @param optional $type type of import (user or instance)
* @param optional $uid userid of new user
*/
- public static function import( $path, $uid=null ){
+ public static function import( $path, $type='user', $uid=null ){
OC_Util::checkAdminUser();
$datadir = OC_Config::getValue( 'datadirectory' );
// Extract the zip
@@ -207,8 +208,12 @@ class OC_Migrate{
return false;
}
$json = json_decode( file_get_contents( $extractpath . 'export_info.json' ) );
- self::$exporttype = $json->exporttype;
-
+ if( !$json->exporttype != $type ){
+ OC_Log::write( 'migration', 'Invalid import file', OC_Log::ERROR );
+ return false;
+ }
+ self::$exporttype = $type;
+
// Have we got a user if type is user
if( self::$exporttype == 'user' ){
if( !$uid ){