Problem migrating from Community Server 2.1 to vBuilletin 4

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rafa-el
    Member
    • Feb 2010
    • 54
    • 4.0.x

    Problem migrating from Community Server 2.1 to vBuilletin 4

    Hi,

    Well, first of all, there's an Impex Bug within the table prefixes wich doesn't even allows the User Sync module to run....

    Now, The user importer, this one doesn't run because there's an SQL charset problem, below is the code from the Impex Error:

    PHP Code:
    ImpEx Database error

    mssql error
    Invalid SQLSELECT UserName FROM dbo.aspnet_Users WHERE UserID='. ÁŸ+Bšl¬osU‰'

    mssql errorConversion failed when converting from a character string to uniqueidentifier.

    DateMonday 06th 2011f June 2011 02:21:52 AM
    Database
    XXX 
    So, the char string it's different and the Usernames aren't parsed into the Unix right value, do you know how to fix this? This is stopping me to migrate a few Community server (telligent) Big boards to vBulletin

    Thanks,
    Rafael
    Jesus is coming. Are you ready?
  • Rafa-el
    Member
    • Feb 2010
    • 54
    • 4.0.x

    #2
    Any kind of help would be appreciated
    Jesus is coming. Are you ready?

    Comment

    • Steve Machol
      Former Customer Support Manager
      • Jul 2000
      • 154488

      #3
      Since this is the second report I have seen with this exact error, please report this in the Bug Tracker here:

      Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
      Change CKEditor Colors to Match Style (for 4.1.4 and above)

      Steve Machol Photography


      Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


      Comment

      • Jake Bunce
        Senior Member
        • Dec 2000
        • 46598
        • 3.6.x

        #4
        I encountered the same problem recently when I was doing a CS import. I was able to fix it by modifying this file:

        impex\systems\communityserver\000.php

        I added the red pieces:

        Code:
        	function get_communityserver_user_details(&$Db_object, &$databasetype, &$tableprefix, $start_at, $per_page)
        	{
        		$return_array = array();
        
        
        		// Check that there is not a empty value
        		if(empty($per_page)) { return $return_array; }
        
        
        		if ($databasetype == 'mssql' OR $databasetype == 'odbc')
        		{
        							
        			$count = $Db_object->query_first("SELECT count(*) FROM {$tableprefix}Users");
        
        			$internal 	= $start_at + $per_page;
        
        			if($internal > intval($count[0]))
        			{
        				$per_page = abs($start_at - intval($count[0]));
        				$internal = intval($count[0]);
        			}
        
        			if(CS21)
        			{
        [color=red]/*[/color]
        				$sql = "SELECT MembershipID, UserID, LastActivity
        						FROM {$tableprefix}Users WHERE UserID
        							IN(SELECT TOP {$per_page} UserID
        								FROM (SELECT TOP {$internal} UserID FROM {$tableprefix}Users ORDER BY UserID)
        							A ORDER BY UserID DESC)
        						ORDER BY UserID";
        [color=red]*/
        				$sql = "SELECT csu.MembershipID, csu.UserID, csu.LastActivity, aspu.UserName, aspm.Email, aspm.Password
        						FROM {$tableprefix}Users AS csu
        						LEFT JOIN dbo.aspnet_Users AS aspu ON (aspu.UserId = csu.MembershipID)
        						LEFT JOIN dbo.aspnet_Membership AS aspm ON (aspm.UserId = csu.MembershipID)
        						WHERE csu.UserID
        							IN(SELECT TOP {$per_page} UserID
        								FROM (SELECT TOP {$internal} UserID FROM {$tableprefix}Users ORDER BY UserID)
        							A ORDER BY UserID DESC)
        						ORDER BY csu.UserID";[/color]
        			}
        			else
        			{
        				$sql = "SELECT 	UserName, UserID, Email, LastActivity
        					FROM {$tableprefix}Users WHERE UserID
        						IN(SELECT TOP {$per_page} UserID
        							FROM (SELECT TOP {$internal} UserID FROM {$tableprefix}Users ORDER BY UserID)
        						A ORDER BY UserID DESC)
        					ORDER BY UserID";
        			}
        
        
        			$user_list = $Db_object->query($sql);
        			
        			while ($user = $Db_object->fetch_array($user_list))
        			{	 
        				if(CS21)
        				{	
        					$return_array["$user[UserID]"] = $user;
        [color=red]/*[/color]
        					$username 	= $Db_object->query_first("SELECT UserName FROM dbo.aspnet_Users WHERE UserID='{$user['MembershipID']}'");
        					$password 	= $Db_object->query_first("SELECT Password FROM dbo.aspnet_Membership WHERE UserID='{$user['MembershipID']}'");
        					$email 		= $Db_object->query_first("SELECT Email FROM dbo.aspnet_Membership WHERE UserID='{$user['MembershipID']}'");
        					$tp 		= $Db_object->query_first("SELECT TotalPosts FROM dbo.{$tableprefix}UserProfile WHERE MembershipID='{$user['MembershipID']}'");
        					
        					$return_array["$user[UserID]"]['UserName'] = $username[0];										
        					$return_array["$user[UserID]"]['Email'] = $email[0];
        					$return_array["$user[UserID]"]['Password'] = $password[0];
        					$return_array["$user[UserID]"]['TotalPosts'] = $tp[0];
        [color=red]*/[/color]
        				}
        				else 
        				{
        					$return_array["$user[UserID]"] = $user;
        				}
        					
        			}
        
        			return $return_array;
        		}
        		else
        		{
        			return false;
        		}
        		return $return_array;
        	}
        I replaced the individual queries with one big joined query. That avoided the problem of the UserID getting garbled in the interim.

        Hopefully this helps you.

        Comment

        • Rafa-el
          Member
          • Feb 2010
          • 54
          • 4.0.x

          #5
          Thanks Jake,

          I did a similar fix but changing the length of the SQL table readed, specifically the username lenght to 256 instead of 32, that fixed one of the issues with the usernames. Altough I had the problem of not read correctly the associate users, I think that's because the fix would need to be applied in that other file.
          Does this fix that module?

          Rafael
          Jesus is coming. Are you ready?

          Comment

          • Rafa-el
            Member
            • Feb 2010
            • 54
            • 4.0.x

            #6
            Basically one of my fixes was this:
            Code:
                function get_communityserver_members_list(&$Db_object, &$databasetype, &$tableprefix, &$start_at, &$per_page)
                {
                    $return_array = array();
            
            
                    // Check that there is not a empty value
                    if(empty($per_page)) { return $return_array; }
            
            
                    if ($databasetype == 'mssql' OR $databasetype == 'odbc')
                    {
                        $count = $Db_object->query_first("SELECT count(*) FROM aspnet_Users");
            
                        $internal     = $start_at + $per_page;
            
                        if($internal > intval($count[0]))
                        {
                            $per_page = abs($start_at - intval($count[0]));
                            $internal = intval($count[0]);
                        }
            
                        $sql = "SELECT     UserId,
                                        UserName
                                [COLOR=#ff0000]FROM aspnet_Users WHERE CAST(UserId AS nvarchar(256))[/COLOR]
                                    IN(SELECT TOP {$per_page} UserId
                                        FROM (SELECT TOP {$internal} UserId FROM aspnet_Users ORDER BY UserId)
                                    A ORDER BY UserId DESC)
                                ORDER BY UserId";
            
                        $user_list = $Db_object->query($sql);
            
                        while ($user = $Db_object->fetch_array($user_list))
                        {
                                $return_array["$user[UserId]"] = $user['UserName'];
                        }
            
                        return $return_array;
                    }
                    else
                    {
                        return false;
                    }
                }
            Jesus is coming. Are you ready?

            Comment

            • Jake Bunce
              Senior Member
              • Dec 2000
              • 46598
              • 3.6.x

              #7
              I didn't bother trying to fix the "associate users" module because I was importing into an empty vBulletin forum. I just skipped that step.

              Comment

              • Rafa-el
                Member
                • Feb 2010
                • 54
                • 4.0.x

                #8
                I see, ok no problem, thanks for the fix anyways
                Jesus is coming. Are you ready?

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...