#row2 is from the shared/target DB # if(mysql_num_rows($res2) >= 1){ #user already exists in target DB if ($row2 = $db_main->fetchObject($res2)) { $collisions[] = "{$row->user_name} exists in both DBs. Email in {$shared_db}: {$row2->user_email}, in {$wgDBname}: {$row->user_email}"; if (strtolower($row->user_email) == strtolower($row2->user_email) && $row2->user_email != "") { $newid = $row2->user_id; } else { if ($options["collision-action"] == "different") { continue; } else { if ($options["collision-action"] == "import") { $new_shared_username = $row2->user_name; $new_local_username = "******"; #local DB user name is changed alterTable($dbr->tableName('user'), "user_name", "\"{$row->user_name}\"", "\"{$new_local_username}\""); moveUserPages("\"{$row->user_name}\"", "\"{$new_local_username}\""); $res3 = $db_main->insert("`{$shared_db}`.`{$shared_table}`", array('user_name' => $new_local_username, 'user_real_name' => $row->user_real_name, 'user_password' => $row->user_password, 'user_newpassword' => $row->user_newpassword, 'user_email' => $row->user_email, 'user_options' => $row->user_options, 'user_touched' => $row->user_touched, 'user_token' => $row->user_token, 'user_email_authenticated' => $row->user_email_authenticated, 'user_email_token' => $row->user_email_token, 'user_email_token_expires' => $row->user_email_token_expires, 'user_registration' => $row->user_registration)); $newid = $db_main->insertID(); } else { #prompt for new user names print "handling entry {$i}. test {$row->user_name} exists in both DBs. Email in {$shared_db}: {$row2->user_email}, in {$wgDBname}: {$row->user_email}\n"; readline_add_history("{$row2->user_name}\n"); $new_shared_username = rtrim(readline("change user name in {$shared_db} to[{$row2->user_name}]:")); if ($new_shared_username == "") { $new_shared_username = $row2->user_name; } readline_add_history("{$new_shared_username}\n"); readline_add_history("{$row->user_name}\n"); # $new_local_username = rtrim(readline("change user name in $wgDBname to[$row->user_name $wgDBname]:")); $new_local_username = rtrim(readline("change user name in {$wgDBname} to[{$prefix}{$row->user_name}{$postfix}]:")); #just a hack for the yellowikis2 DB name
if($row2 = $db_main->fetchObject( $res2 )) { $collisions[] = "$row->user_name exists in both DBs. Email in $shared_db: $row2->user_email, in $wgDBname: $row->user_email"; if( strtolower($row->user_email) == strtolower($row2->user_email) && $row2->user_email != ""){ $newid = $row2->user_id; } else if($options["collision-action"] == "different"){ continue; } else if($options["collision-action"] == "import"){ $new_shared_username = $row2->user_name; $new_local_username = "******"; #local DB user name is changed alterTable($dbr->tableName( 'user' ),"user_name","\"$row->user_name\"","\"$new_local_username\""); moveUserPages("\"$row->user_name\"","\"$new_local_username\""); $res3 = $db_main->insert("`$shared_db`.`$shared_table`", array('user_name' => $new_local_username, 'user_real_name' => $row->user_real_name, 'user_password' => $row->user_password, 'user_newpassword' => $row->user_newpassword, 'user_email' => $row->user_email, 'user_options' => $row->user_options, 'user_touched' => $row->user_touched, 'user_token' => $row->user_token, 'user_email_authenticated' => $row->user_email_authenticated, 'user_email_token' => $row->user_email_token, 'user_email_token_expires' => $row->user_email_token_expires, 'user_registration' => $row->user_registration)); $newid = $db_main->insertID();