miniBB – Import only latest
-
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
-
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.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 theposts
&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.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/revisionsAnd 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 – FromExample_Converter
tominiBB
* Includes forum slug
* Uses thecallback_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 classminiBB
* Stores custom user profile_bbp_minibb_user_instantmessenger
,_bbp_minibb_user_occupation
,_bbp_minibb_user_location
&_bbp_minibb_user_interests
inwp_usermeta
- You must be logged in to reply to this topic.