summaryrefslogtreecommitdiffstats
path: root/lib/migrate.php
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2012-09-18 16:24:39 +0000
committerTom Needham <needham.thomas@gmail.com>2012-09-18 16:24:39 +0000
commitbe76a55ef035112d699442335ae214cb65f34791 (patch)
treea0c1897896ad72323d383920d4cabe1cfa8dfccb /lib/migrate.php
parent9df403f051354b24da61b12f6446d10d899f05f7 (diff)
downloadnextcloud-server-be76a55ef035112d699442335ae214cb65f34791.tar.gz
nextcloud-server-be76a55ef035112d699442335ae214cb65f34791.zip
Allow exporting of users from any user backend, fixed oc-1645
Diffstat (limited to 'lib/migrate.php')
-rw-r--r--lib/migrate.php14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/migrate.php b/lib/migrate.php
index 823b3574f16..611a935ee5d 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -84,21 +84,15 @@ class OC_Migrate{
$types = array( 'user', 'instance', 'system', 'userfiles' );
if( !in_array( $type, $types ) ) {
OC_Log::write( 'migration', 'Invalid export type', OC_Log::ERROR );
- return json_encode( array( array( 'success' => false ) ) );
+ return json_encode( array( 'success' => false ) );
}
self::$exporttype = $type;
// Userid?
if( self::$exporttype == 'user' ) {
// Check user exists
- if( !is_null($uid) ) {
- $db = new OC_User_Database;
- if( !$db->userExists( $uid ) ) {
- OC_Log::write('migration', 'User: '.$uid.' is not in the database and so cannot be exported.', OC_Log::ERROR);
- return json_encode( array( 'success' => false ) );
- }
- self::$uid = $uid;
- } else {
- self::$uid = OC_User::getUser();
+ self::$uid = is_null($uid) ? OC_User::getUser() : $uid;
+ if(!OC_User::userExists(self::$uid)){
+ return json_encode( array( 'success' => false) );
}
}
// Calculate zipname