diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/admin_export/settings.php | 10 | ||||
-rw-r--r-- | apps/bookmarks/lib/migrate.php | 10 | ||||
-rw-r--r-- | apps/user_migrate/admin.php | 18 |
3 files changed, 13 insertions, 25 deletions
diff --git a/apps/admin_export/settings.php b/apps/admin_export/settings.php index af8dd0dbf54..cd85bedcd7d 100644 --- a/apps/admin_export/settings.php +++ b/apps/admin_export/settings.php @@ -25,8 +25,6 @@ OC_Util::checkAdminUser(); OC_Util::checkAppEnabled('admin_export'); -define('DS', '/'); - // Export? if (isset($_POST['admin_export'])) { // Create the export zip @@ -44,9 +42,11 @@ if (isset($_POST['admin_export'])) { } // Import? } else if( isset($_POST['admin_import']) ){ - - // TODO - // OC_Migrate::import( $pathtozipfile ); + $from = $_FILES['owncloud_import']['tmp_name']; + + if( !OC_Migrate::import( $from ) ){ + die('failed'); + } } else { // fill template diff --git a/apps/bookmarks/lib/migrate.php b/apps/bookmarks/lib/migrate.php index 36a08c0cf40..02c96e59632 100644 --- a/apps/bookmarks/lib/migrate.php +++ b/apps/bookmarks/lib/migrate.php @@ -36,19 +36,19 @@ class OC_Migration_Provider_Bookmarks extends OC_Migration_Provider{ switch( $this->appinfo->version ){ default: // All versions of the app have had the same db structure, so all can use the same import function - $query = OC_Migrate::prepare( "SELECT * FROM bookmarks WHERE user_id LIKE ?" ); - $results = $query->execute( array( $this->info['olduid'] ) ); + $query = $this->content->prepare( "SELECT * FROM bookmarks WHERE user_id LIKE ?" ); + $results = $query->execute( array( $this->olduid ) ); $idmap = array(); - while( $row = $data->fetchRow() ){ + while( $row = $results->fetchRow() ){ // Import each bookmark, saving its id into the map $query = OC_DB::prepare( "INSERT INTO *PREFIX*bookmarks(url, title, user_id, public, added, lastmodified) VALUES (?, ?, ?, ?, ?, ?)" ); - $query->execute( array( $row['url'], $row['title'], $this->info['newuid'], $row['public'], $row['added'], $row['lastmodified'] ) ); + $query->execute( array( $row['url'], $row['title'], $this->uid, $row['public'], $row['added'], $row['lastmodified'] ) ); // Map the id $idmap[$row['id']] = OC_DB::insertid(); } // Now tags foreach($idmap as $oldid => $newid){ - $query = OC_Migrate::prepare( "SELECT * FROM bookmarks_tags WHERE user_id LIKE ?" ); + $query = $this->content->prepare( "SELECT * FROM bookmarks_tags WHERE user_id LIKE ?" ); $results = $query->execute( array( $oldid ) ); while( $row = $data->fetchRow() ){ // Import the tags for this bookmark, using the new bookmark id diff --git a/apps/user_migrate/admin.php b/apps/user_migrate/admin.php index 6f3565788eb..d54bd6965b5 100644 --- a/apps/user_migrate/admin.php +++ b/apps/user_migrate/admin.php @@ -36,24 +36,12 @@ if (isset($_POST['user_import'])) { $from = $_FILES['owncloud_import']['tmp_name']; $to = get_temp_dir().'/'.$importname.'.zip'; if( !move_uploaded_file( $from, $to ) ){ - OC_Log::write('migration',"Failed to copy the uploaded file",OC_Log::INFO); + OC_Log::write( 'user_migrate', "Failed to copy the uploaded file", OC_Log::ERROR ); exit(); } - // Extract zip - $zip = new ZipArchive(); - if ($zip->open(get_temp_dir().'/'.$importname.'.zip') != TRUE) { - OC_Log::write('migration',"Failed to open zip file",OC_Log::INFO); - exit(); - } - $zip->extractTo(get_temp_dir().'/'.$importname.'/'); - $zip->close(); - - $importdir = get_temp_dir() . '/' . $importname; - - // Delete uploaded file - unlink( $importdir . '.zip' ); - + OC_Migrate::import( $to, 'user', 'newuser' ); + die(); // Find folder $files = scandir( $importdir ); unset($files[0]); |