- Compatible XF 2.x versions
- 2.0
- License
- CC BY 4.0
This command attempts to import the vBulletin 3/4 moderator log into XenForo 2. It originated from a bug report: vB4 Import: Support for importing the moderator log.
It is by no means a finished product and I cannot provide any guarantees or support! The command has served me well during my vB4 → XF2 migration and I hope that it can help someone else. But to be totally honest, I personally don't need this command any longer and therefore have a very limited interest in developing it any further. Given how messy the vb_moderatorlog table is and considering that the script has only been tested on a single forum, I think it's very likely that it'll break for you somewhere. I provide this script as a starting point for your own development and you are expected to be able to help yourself if something breaks. As always, run some test imports on an non-production system first.
There are at least the following caveats to be aware of:
If someone wants to take over maintainership of this command just let me know!
It is by no means a finished product and I cannot provide any guarantees or support! The command has served me well during my vB4 → XF2 migration and I hope that it can help someone else. But to be totally honest, I personally don't need this command any longer and therefore have a very limited interest in developing it any further. Given how messy the vb_moderatorlog table is and considering that the script has only been tested on a single forum, I think it's very likely that it'll break for you somewhere. I provide this script as a starting point for your own development and you are expected to be able to help yourself if something breaks. As always, run some test imports on an non-production system first.
There are at least the following caveats to be aware of:
- Depending on the size of your moderator log, the script can have huge memory requirements. You may have to adjust the
\XF::setMemoryLimit
call. - Only supports imports executed with "Retain IDs" enabled because ID lookups aren't implemented.
- Only supports moderator actions for forum threads (i.e. no albums, groups, profile posts, ...)
- Only supports vB3+ moderator logs. vB2 moderator log entries (type=0) are skipped because they are text logs with no structure that would require locale-aware parsing.
- Type 6 entries ("thread_edited_visible_x_open_y_sticky_z") are a mess because they don't log which values have changed but only what their new values are (even if they haven't changed). Sometimes they even directly contradict other log entries for the same thread with exactly the same timestamp. I've done my best to make sense of these entries but maybe something will get lost. Type 6 entries are the (only) reason we need the state arrays $visibleState, $openState, and $stickyState.
- The code is unforgiving if for example an "unserialize" call fails. That hasn't been a problem for me but may bite you.
- I'm doing nasty things by storing strings (thread titles) in the "ids" field of the "action_params" JSON object. That doesn't seem to be causing any problems in XenForo 2.0 but definetely has the potential to cause problems in future XenForo versions. You need to be able to help yourself if/when that happens! (The reason for doing this in the first place is that the vB moderator log sometimes only contains thread titles where the XenForo moderator log expects thread IDs.)
- There are some english phrases in the code that you may want to translate
- Probably more
ImportVbulletinModeratorLog.php
file into your src/XF/Cli/Command
folder and run php cmd.php xf:import-vbulletin-moderator-log
. (Don't forget to delete the file once you're done.)If someone wants to take over maintainership of this command just let me know!