Migration info is an object. Other fixes

This commit is contained in:
Tom Needham 2012-03-16 22:50:35 +00:00
parent c442a06a02
commit 5332c319a2
2 changed files with 9 additions and 9 deletions

View File

@ -34,16 +34,16 @@ class OC_Migrate_Provider_Bookmarks extends OC_Migrate_Provider{
// Import function for bookmarks
function import( $info ){
switch( $info['appversion'] ){
switch( $info->appversion ){
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( $info['olduid'] ) );
$results = $query->execute( array( $info->olduid ) );
$idmap = array();
while( $row = $data->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'], $info['newuid'], $row['public'], $row['added'], $row['lastmodified'] ) );
$query->execute( array( $row['url'], $row['title'], $info->newuid, $row['public'], $row['added'], $row['lastmodified'] ) );
// Map the id
$idmap[$row['id']] = OC_DB::insertid();
}

View File

@ -377,11 +377,11 @@ class OC_Migrate{
/**
* @breif imports a new user
* @param $db string path to migration.db
* @param $migrateinfo array of migration ino
* @param $info array of migration ino
* @param $uid optional uid to use
* @return bool if the import succedded
*/
public static function importAppData( $db, $migrateinfo, $uid=false ){
public static function importAppData( $db, $info, $uid=false ){
if(!self::$uid){
OC_Log::write('migration','Tried to import without passing a uid',OC_Log::FATAL);
@ -399,15 +399,15 @@ class OC_Migrate{
return false;
}
if( !is_array( $migrateinfo ) ){
if( !is_array( $info ) ){
OC_Log::write('migration','$migrateinfo is not an array', OC_Log::FATAL);
return false;
}
// Set the user id
self::$uid = $info['migrateinfo']['uid'];
self::$uid = $info->migrateinfo->uid;
$apps = $info['apps'];
$apps = $info->app;
foreach( self::$providers as $provider){
// Is the app in the export?
@ -415,7 +415,7 @@ class OC_Migrate{
// Did it succeed?
if( $app[$provider->id] ){
// Then do the import
$provider->import();
$provider->import( $info );
}
}
}