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

2»

Answers

  • Options
    candymancandyman ✭✭
    edited November 2011
    Todd is very gentle to reply me but speaks in a too technical language for my computing knowledge... :(

    @x00: that's the point. I would like to open the phpbb_posts in a text editor and replace all the internal URLs written with the phpBB2 scheme with the ones written according the Vanilla2 scheme. Unfortunately the IDs of the posts are different and I should replace all of them manually (they are hundreds)...

    So I though I could tell phpMySql to search& replace for me. But if the editor is a better option I'm ready to use it!

    Unfortunately thay are weeks that this thing is stopping me from moving :(

  • Options
    scite you can replace with regular expressions
    like so
    Find What -> viewtopic\.php\?f=\d+\&topic=\(\d+\)
    Replace With -> discussion/\1/x/p1

    with regular expression, wrap around and backslashes checked.


    routes are not that slow. they are done when the person visits that link.

    grep is your friend.

  • Options
    candymancandyman ✭✭
    edited November 2011
    Check for SciTE but is for Windows/Linux and guess what I use...
    Hope skEdit can replace with regular expressions too...
    The only think is that, after the search&replace method probably the file will be huge and phpMySql would complain...
    For this reason I would preferred a function to run into the database directly...

    Anyway MANY THANKS for all the help: I'll post again if I manage...
  • Options
    x00x00 MVP
    edited November 2011
    @candyman

    most good editors do. Just need to know the nuances. scite uses posix mode

    why would the file be huge? you are reducing the content.

    How about using vim?

    grep is your friend.

  • Options
    No problem when I download the DB.
    When I try to upload, it's says that is too huge to manage.
    So I need to use a script to join many parts of it uploaded one after another.
  • 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.
  • Options
    Many thanks, Todd.
    I'll try it into phpMySql and, hopefully, will move my community to Vanilla.
    I'm not a technical person but I can install and migrate the forum by myself. The URLs problem was the only one left. Anyway, I understand your advice.
    Thanks again! :)
  • Options
    Ehm... can I add Todd's public function directly in the vanilla2export.php?
    Or must I apply it after the migration?
    Many thanks...
  • Options
    candymancandyman ✭✭
    edited November 2011
    Forget my previous post, I found what I needed.

    BTW: why there is the ability to delete messages posted within a certain period of time?
    Useful to delete my previous post, for example.

    There are 30 minutes to Edit the message: it would be nice to add the possibility to delete a post enter 5 minutes, for example.
  • Options
    This should work?

    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); return str_replace(':'.$UID, '', $Value); return $Result; }

  • Options
    candymancandyman ✭✭
    edited November 2011
    Or this is better?

    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); return $Result; }

    @Todd: I've searched in the vanilla2export.php the right place to add the function you provided but I've found that part of the code is a little different:

    original file: return str_replace(':'.$UID, '', $Value);

    modded one: $Result = str_replace(':'.$UID, '', $Value);

    Hope you'll find the time for me: this wall stop me from junping to the other side... :P
  • Options
    candymancandyman ✭✭
    edited November 2011
    @Todd, @x00 at the end I used this...

    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); return str_replace(':'.$UID, '', $Value); return $Result; } }

    ...but it didn't work :(
    The URLs in the posts are still the same pointing to old phpbb internal structure.
  • Options
    @Todd Obviously I've changed the phpBB related part of the Vanilla Porter code.
    Have you any other solution to suggest?
    Very strange that the function above didn't provide any change.
  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    I'm going to put a stop to this thread from my point of view. You are trying to do a real nit-picky amount of customization that others have suggested you don't do and yet you still want to do it, even though you don't seem to have the basic programming skills required do this.

    I'm trying not to come off as harsh, but you can't expect to just blindly copy and paste code into an application and expect it to work without some basic debugging. You have to do things like isolate your functions with test data. Put echos in the code. Read the php documentation on functions, etc.

    Open source is all about giving you the freedom to modify code. It's not about us modifying your code for you.
Sign In or Register to comment.