Skip to:
Content
Pages
Categories
Search
Top
Bottom

miniBB – Import only latest


  • gijs5
    Participant

    @gijs5

    Hi all,

    I made a custom import for minibb. I just did my first test import and it took like 12 hours to finish. Now I want to know if it’s possible to import only the latest post, topics etc instead of doing a complete import when I want to go live?

    Thanks in advance.

    Cheers,
    Gijs

Viewing 5 replies - 1 through 5 (of 5 total)
  • I made a custom import for minibb.

    Cool πŸ™‚

    I just did my first test import and it took like 12 hours to finish.

    How big is your forum? (i.e. number of topics and replies)

    Now I want to know if it’s possible to import only the latest post, topics etc instead of doing a complete import when I want to go live?

    No it is not, my suggestion would be to copy your database and then cut it down to only the topics & replies you want to import directly with MySQL

    And here is my ‘work in progress’ bbPress miniBB.php importer πŸ™‚ https://gist.github.com/ntwb/7889409 πŸ™‚

    EDIT: I should add that mine has a few issues and I know it doesn’t quite work πŸ™
    If you have some tips to fix mine up that would be great as we could then include it in bbPress.


    gijs5
    Participant

    @gijs5

    Hi Stephan,

    The minibb database is 124 mb, so thats pretty big πŸ™‚
    The code is pretty ugly now, but maybe I’ll clean it up later. It’s pretty simular to yours.

    I used this in the callback_html function.
    return htmlspecialchars_decode(str_replace(array('$'), array('$'), $this->deCodeBB($field)), ENT_QUOTES);

    And I used the minibb deCodeBB function to form bbcodes:

    public function deCodeBB($msg) {
    
    	$pattern=array(); $replacement=array();
    
    	$pattern[]="/<img src=\"(.+?)\"([^\>]+)>/i";
    	$replacement[]="[img]\\1[/img]";
    
    	$pattern[]="/<a href=\"(.+?)\"([^\>]+)>(.+?)<\/a>/i";
    	$replacement[]="[url=\"\\1\"]\\3[/url]";
    
    	$pattern[]="/<[bB]>(.+?)<\/[bB]>/s";
    	$replacement[]="[b]\\1[/b]";
    
    	$pattern[]="/<[iI]>(.+?)<\/[iI]>/s";
    	$replacement[]="[i]\\1[/i]";
    
    	$pattern[]="/<[uU]>(.+?)<\/[uU]>/s";
    	$replacement[]="[u]\\1[/u]";
    
    	$pattern[]="/<font color=\"(#[A-F0-9]{6})\">(.+?)<\/font>/is";
    	$replacement[]='[font\\1]\\2[/font]';
    
    	$pattern[] = '/<div class=\"quote\"><div class=\"quoting\">Quoting: (.+?)<\/div><br>(.+?)<\/div>/is'; 
    	$replacement[] = "[quote=\\1]\\2[/quote]"; 
    
    	$pattern[] = '/<div class=\"quote\">(.+?)\<\/div>/is'; 
    	$replacement[] = "[quote]\\1[/quote]"; 
    
    	$pattern[] = '/<div class="codex">(.+?)\<\/div>/is';
    	$replacement[] = "[code]\\1[/code]"; 
    
    	/* YouTube code */
    	$pattern[]="/<object width=\"297\" height=\"245\"><param name=\"movie\" value=\"http:\/\/www\.youtube\.com\/v\/([a-zA-Z0-9-_]+)\"><\/param><param name=\"wmode\" value=\"transparent\"><\/param><embed src=\"http:\/\/www\.youtube\.com\/v\/([a-zA-Z0-9-_]+)\" type=\"application\/x-shockwave-flash\" wmode=\"transparent\" width=\"297\" height=\"245\"><\/embed><\/object>/i";
    	$replacement[]="[youtube=http://www.youtube.com/watch?v=\\1]";
    	/* --YouTube code */
    
    	$msg=preg_replace($pattern, $replacement, $msg);
    	$msg=str_replace ('<br>', "\n", $msg);
    	if(substr_count($msg, '[img\\2]')>0) $msg=str_replace('[img\\2]', '[img]', $msg);
    
    	if(function_exists('smileThis')) $msg=smileThis(FALSE,TRUE,$msg);
    
    	return $msg;
    }

    Hope this helps.

    Cheers.

    Thanks, indeed it does help, gets some of those pesky regex strings half sorted out.

    It be extremely keen on seeing what JOIN expressions you used to join the posts & topics table as if I remember correctly this was the only thing holding me back from including this as one of the new featured importers in bbPress 2.5.


    gijs5
    Participant

    @gijs5

    Here is my current converter: https://gist.github.com/gijs5/7943186#file-bbpress-minibb-converter
    I’m gonna use it tomorrow to launch bbpress.

    Cheers.

    Some seriously nice work in your script πŸ™‚

    I have just merged your changes into mine
    https://gist.github.com/ntwb/7889409/revisions

    And I forked your Gist and merged those changes into yours https://gist.github.com/ntwb/7955389/revisions

    Both files are the same and you can download either to use and test, using the /revisions it should show you a little clearer the changes I made.

    In summary the main updates were:
    * Fixes PHP Class name – From Example_Converter to miniBB
    * Includes forum slug
    * Uses the callback_topic_reply_count for topic/reply counts
    * Added topic Author IP
    * Added topic slug
    * Added topic status (Open/Closed) and callback
    * Added reply post id
    * Added reply title and reply title callback
    * Added reply slug
    * Updated password verify class miniBB
    * Stores custom user profile _bbp_minibb_user_instantmessenger, _bbp_minibb_user_occupation, _bbp_minibb_user_location & _bbp_minibb_user_interests in wp_usermeta

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar