Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

The URL conversion from phpBB (or others) to Vanilla

candymancandyman ✭✭
edited November 2011 in Vanilla 2.0 - 2.8
I'm tryin' to move from phpBB2 to Vanilla2 but I'm actually blocked by the different URLs scheme.

The solution is to search&replace, obviously, but Vanilla scheme uses the-name-of-the-thread as part of the url of the discussion...

So, how can I convert tons of...

http://myforum.ext/community/viewtopic.php?f=46&t=579376

into...

http://myforum.ext/discussion/16558/looking-for-successful-URLs-migration-from-phpbb2-to-vanilla2#

in a simple&fast way? Is it possible without searching&replace all the thread and change them by hand?

Thanks in advance.

Best Answers

  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    The text is indeed optional as ddumont says.

    However, the way we always do imports like this is to use routes instead of changing text. So in your example I'd add a route.

    Route Expression: viewtopic\.php\?f=\d+&topic=(\d+)
    Target: discussion/$1/x/p1

    I highly recommend setting the route's type to Internal until you've got the route expression right. When you do switch the route type to Permanent (301). The reason for this is that if you start with 301s then your browser will cache the result while you are making changes. It will make you tear your hair out if you don't know this.

    The route expressions are regular expressions which can be a little tricky themselves. In the above example note the \ character before the . and ?. Basically, you must remember to escape all special regular expression characters.
  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    The preg_replace command for the above string is.
    public function RemoveBBCodeUIDs($Value, $Field, $Row) {
    $UID = $Row['bbcode_uid'];
    $Result = str_replace(':'.$UID, '', $Value);
    $Result = preg_replace('`viewtopic\.php\?f=\d+\&topic=\(\d+\)`', 'discussion/\1/x/p1', $Result);
    // Other replaces here.

    return $Result;
    }
    That's all the help I'm going to give you on this. If your not a technical person you're going to get yourself into a lot of trouble copy and pasting code snippets without any understanding of the underlying concepts.
«1

Answers

  • Options
    There is a program (addon) out there that does import all the PHPBB posts into Vanilla. I don't know if it's fully released, but that addon should do the trick for you.

    There was an error rendering this rich post.

  • Options
    candymancandyman ✭✭
    edited August 2011
    The problem is not to import the posts (just tried: all OK) but to re-assign the internal URLs. Try to follow me:

    - In the thread number 1 there is UserA post that say "Hello".
    - UserB quote the userA message and says "Hi" and, with the BBcode, make a clickable link named "an old topic" that points to the old discussion, in this way:

    [quote="UserA, in [url=http://www.mysite.ext/forum/viewtopic.php?f=1&t=1]an old topic[/url]"]Hello[/quote]

    Now, it's easy for me moving from phpBB to Vanilla but how can I preserve all these little things that are hidden inside BBcode tags?

    Hope someone had already done this...
  • Options
    I thought that while converting from phpbb to vanilla that addon would take care of it, guess not.
    So you need to change /forum/viewtopic.php?f=1&t=1 to the vanilla url structure, correct?

    There was an error rendering this rich post.

  • Options
    Yes, but for links included in the posts too...
  • Options
    candymancandyman ✭✭
    edited October 2011
    I need to know how to convert the phpBB viewtopic structure into a Vanilla equivalent.
    Where can I find some info about Vanilla internal structure?
    I need a script to convert the old phpBB links to Vanilla and keep them working...

    Hope someone can help.
  • Options
    I'm pretty sure the text after the discussion id is optional...

    There was an error rendering this rich post.

  • Options
    Hey, that's a big step forward!
    I need a script that replace, for example, any

    viewtopic.php?f=forum_number&t=topic_number

    into Vanilla

    comment/comment_number#Comment_comment_number

    The only difference is that any thread will be lost 'cause Vanilla seems to manage comments only.
  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    The text is indeed optional as ddumont says.

    However, the way we always do imports like this is to use routes instead of changing text. So in your example I'd add a route.

    Route Expression: viewtopic\.php\?f=\d+&topic=(\d+)
    Target: discussion/$1/x/p1

    I highly recommend setting the route's type to Internal until you've got the route expression right. When you do switch the route type to Permanent (301). The reason for this is that if you start with 301s then your browser will cache the result while you are making changes. It will make you tear your hair out if you don't know this.

    The route expressions are regular expressions which can be a little tricky themselves. In the above example note the \ character before the . and ?. Basically, you must remember to escape all special regular expression characters.
  • Options
    x00x00 MVP
    edited October 2011
    @Todd could you guarantee a linear relationship between ids? It might break down under certain situations.

    grep is your friend.

  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    The importer inserts the IDs explicitly so they are the same.
  • Options
    Ok

    grep is your friend.

  • Options
    candymancandyman ✭✭
    edited November 2011
    Thanks Todd. I've understood the meaning but unfortunately I don't know how and where I can put the route.
    In my previous forum migration I use a barely simple search&replace in the forum_posts file. Can you provide a formula for this, please?
    I need moving phpBB referred post to Vanilla2.
  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    There is a routes link in your dashboard.
  • Options
    Thanks.

    According to you the search&replace method is wrong?
    I'd prefer to have all the posts with the same style of linking: the route would force the redirect but the posts content would remain the same and I'll get two different styles (for "old" and "after the migration" posts) and this will cause some problems in case of another (I hope not) migration...

    For this reason, I'm tryin' to change the old urls inside the posts into the Vanilla2 specific style (the migrator, at now, changes the thread url only). I need a rule to fix this (that is the same that is in the migrator, I suppose).
  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    If you want to do a search and replace then the database columns you want are GDN_Discussion.Body and GDN_Comment.Body. That's all the help I'm going to give you though.
  • Options
    candymancandyman ✭✭
    edited November 2011
    I'm trying to move from phpBB2 to Vanilla2. The only problem that stops me is to change the links inside the posts in the Vanilla specific way (in order to have all the links correctly translated and not only the ones made by the useful Vanilla Porter). I know that the table to work on is: phpbb_posts. I need the rules to apply in the phpMySql screen to convert the phpBB's scheme

    viewtopic\.php\?f=\d+&topic=(\d+)

    into Vanilla's one

    discussion/$1/x/p1

    Can someone help me, please? The problem is to change all the links despite their different IDs (I wouldn't like to change them manually...).
    Anyone out there have completed a similar conversion?
    The particularity of my forum is that users uses reminders to other discussions very often inside their posts...
  • Options
    x00x00 MVP
    edited November 2011
    what is wrong with using routes? Perhaps some JavaScript it is really bothering you.

    otherwise

    http://www.mysqludf.org/lib_mysqludf_preg/
    https://launchpad.net/mysql-udf-regexp

    grep is your friend.

  • Options
    candymancandyman ✭✭
    edited November 2011
    It would be nice to know the code of Vanilla Porter and using it to translate non only the thread URLs but the internal ones too.

    I know that adding that as an option wouldn't be useful for all the masses.

    Thanks x00 for showing me the starting point.
    what is wrong with using routes?
    Todd told me about the routes. The problem is that I would obtain a forum with tons of posts with an URLs scheme and the followings with a different one... Just in case of another migration (I hope not) it would create some problem...

    ... and it's slower, isn't it?
  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    If you wan to try something in the porter you can add filters to export columns which are functions used to process the data on export.

    In the phpbb exporters there is a function called RemoveBBCodeUIDs. You can add your preg_replace code there.
  • Options
    x00x00 MVP
    edited November 2011
    why not use a good text editor like scite to simply replace before you import?

    grep is your friend.

Sign In or Register to comment.