Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[v0.2] phpBB Migrator

1235720

Comments

  • well.. i was told to remind him later to do the whisper migration, and i believe thats one of the last things he has to do with the phpbb - vanilla migration.
    ive seen one of the migration tests hes done on some database, and it looks pretty sweet, all seems to work really well.
    gwan mini..
  • Right. I've done a bit more testing with outbreak and we both seem quite convinced its pulling as much information through as possible - i've even added the option of keeping or resetting existing passwords now marks changed from password to md5.

    I just need to think through bbcode translations which I'll probably have to ignore unless anyone can think of a method to convert them easily?

    I imagine many people who would be using the phpBB converter may also desire to use a bbcode extension...whoevers willing to create one!
  • MarkMark Vanilla Staff

    Yeah - I looked into getting something that is already written and plopping it into vanilla (like I did with Markdown), but the bbcode code is really frickin convoluted and all over the place. There's no central "BBCodify" function anywhere that I could see.

    If someone would write one, I'd be super happy. It would make a snazzy extension.

  • is convoluted word of the day or something?
    How many 'bbcode's are there? And what do they actually do? I've never really played with it. Doesnt it just require for pseudo html to be converted to hardcore stuff when people add the comment?
  • outbreakoutbreak New
    edited June 2005
    bbcode is pretty much custom coding to avoid html snippets from messing with the forum layout. read more here: http://www.phpbb.com/phpBB/faq.php?mode=bbcode
  • Um. Well if its just whats on that page then it looks to me like the migration will simply be a matter of a few replacements of eg [b] to when translating the post data..i just need to work out doing that in php, regexp i assume? The main issue is the overhead it will add...but we'll see.

    As for an extension, i also dont see why it should be particularly difficult to implement?
  • MarkMark Vanilla Staff

    You can implement a string formatter and it will be one of the options at the bottom of the comment input.

  • Um. I'm sure i havent seen that post and this thread was showing as read...meh i'm probably being a fool.
    If i write the stuff to convert bbcode in existing threads i'll pass it your way mark so you can add it to the formatter ok?
  • MarkMark Vanilla Staff

    That sounds swell. Just do it all in a single function and my job will be easy peezy :)

  • ok. /me toddles off to learn regex replacements.

    Outbreak - as far as you know, are all the optional bbcode's on that page you linked me to?
  • yeah, that page seems to pretty much cover all of it.
  • edited June 2005
    So...is it cheating for me to just take this:

    <?php
    function replaceMessage($message) {
    $message = strip_tags($message, '<b>image');

    $message = str_replace ("\n", "
    ", "$message");
    // When you store the $message in a database you might get errors cause of the quotes
    $message = str_replace("[singleQuote]", "'", $message);
    $message = str_replace("[doubleQuote]", "\"", $message);

    $message = str_replace ("[U]", "", "$message");
    $message = str_replace ("[/U]", "
    ", "$message");
    $message = str_replace ("[I]", "", "$message");
    $message = str_replace ("[/I]", "
    ", "$message");
    $message = str_replace ("[B]", "", "$message");
    $message = str_replace ("[/B]", "
    ", "$message");

    $message = replaceUrl($message);
    $message = replaceImg($message);

    return $message;
    }

    function replaceImg($message) {
    // Make image from [img]htp://.... [/img]
    while(strpos($message, "[img]")!==false){
    $begImg = strpos($message, "[img]");
    $endImg = strpos($message, "[/img]");
    $img = substr($message, $begImg, $endImg-$begImg+6);

    $link = substr($img, 5, $endImg - $begImg -5);
    $htmlImg = "image";

    $message = str_replace($img, $htmlImg, $message);
    // searches for other [img]-nodes
    }
    return $message;
    }

    function replaceUrl($message) {
    // Make link from [url]htp://.... [/url] or [url=http://.... ]text[/url]
    while(strpos($message, "[url")!==false){
    $begUrl = strpos($message, "[url");
    $endUrl = strpos($message, "[/url]");
    $url = substr($message, $begUrl, $endUrl-$begUrl+6);
    $posBracket = strpos($url, "]");

    if ($posBracket != null){
    if ($posBracket == 4){
    // [url]http://.... [/url]
    $link = substr($url, 5, $endUrl - $begUrl -5);
    $htmlUrl = "$link";
    } else {
    // [url=http://....]text[/url]
    $link = substr($url, 5, $posBracket-5);
    $text = substr($url, $posBracket+1, strpos($url, "[/url]") - $posBracket-1);
    $htmlUrl = "$text"; } } $message = str_replace($url, $htmlUrl, $message); // searches for other [url]-nodes } return $message; } ?>

    off php.net and edit it ever so slightly?

    It seems silly to rewrite an identical function...
  • MarkMark Vanilla Staff

    Cheat!
    Cheat until your testicles fall off.

  • YES! CHEATING BABY!!!
  • haha. So i guess i'm writing a new function then...
  • Hmm. Either somethings fucked up or just the process of checking each comment is pushing execution times over the edge... I'll have another look but i'm thinking the bbcode translation will have to be an addon if anything.

    Quite fortunate though; i'd kinda forgotten about execution time limits. How can i get round them since in cases of over 25000 posts it will take more than the (presumably default) 30 seconds?
  • why don't you try something like mark did with the file browsers thumbnailer. run through x number of records, then display a status screen, and meta-refresh the page and move on to the next set of records.

    make sure that it says not to close the browser until the entire process is done, or something to that effect.

    i don't think you're going to be able to set the max_execution_time without having access to the php.ini and that's not feasible on shared hosting servers.
  • Hmm. Yeah good thinking, i did have it setup to output a % done but for some reason it didnt occur to me to meta refresh it to keep it up to date.

    Maybe i'll leave that bit to mark as i imagine he's best making the gui anyway..my design abilities are even worse than my coding ones :)
  • MarkMark Vanilla Staff

    You could also use ajax to do it table by table and just add comments to the page as things finish.

    If I were to start the thumbnailer all over again, that's how I'd do it.

  • Well as i say, i'll probably leave that bit to you, i've never used javascript and as you've done so nicely with the vanilla installer i think it'd be cool if they went hand in hand.
Sign In or Register to comment.