Announcement

Collapse
No announcement yet.

SMF2 > vB 3.8.x Cleaner Questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SMF2 > vB 3.8.x Cleaner Questions

    I've recently converted from SMF2 to vBulletin 3.8.7. Now I'm trying to use the cleaner to replace [img] and [quote] codes with that of vBulletin.

    Does anyone know how to do this with the cleaner.php that comes with Impex? I have no clue and vBulletin staff didn't offer much help.

  • #2
    Are these simple replacements? Can you give an example?

    You need to edit the cleaner.php file and configure these settings:

    Code:
    ########################################
    // BACK UP YOUR DATABASE
    // Set to true to run, and false when done, or remove this script (and all of impex when finished).
    $active				= false;
    
    // Set true or false as to the data you want to clean
    $do_posts			= true;
    $do_sigs			= false;
    $do_thread_titles	= false;
    $do_pm_text			= false;
    $do_pm_text_title	= false;
    ########################################
    
    # Replace 'Find me' and "Replace with me" with the strings  you want replaced i.e
    # "<b>"			=> "[b]"
    # "<blockquote>" 	=> "[quote]"
    # add as many elements to the array as needed
    
    // BACK UP YOUR DATABASE
    $replacer = array(
    			""	=> "",
    			""	=> "",
    			""	=> "",
    			""	=> "",
    			""	=> ""
    );
    By default it does raw string replacements. For more complex replacements you can use regular expressions, but that requires editing the code to uncomment those lines. For example:

    Code:
    # Posts
    if($do_posts)
    {
    	$posts = $Db_target->query("SELECT postid, pagetext, title FROM " . $targettableprefix . "post");
    
    	while ($post = $Db_target->fetch_array($posts))
    	{
    		$text = str_replace(array_keys($replacer), $replacer, $post['pagetext']);
    		$title_text = str_replace(array_keys($replacer), $replacer, $post['title']);
    		#$text = preg_replace('##siU', '', $text);
    		#$title_text = preg_replace('##siU', '', $text);
    		$Db_target->query("UPDATE " . $targettableprefix . "post SET pagetext='" . addslashes($text) . "', title='" . addslashes($title_text) . "' WHERE postid='" . $post['postid'] . "'");
    		echo "<br /><b>Post done -></b><i> " . $post['postid'] . "</i>";
    	}
    }
    It also requires regex ability on your part.

    Comment

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