Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 02-17-2016, 04:15 PM
ndoktoruser ndoktoruser is offline
 
Join Date: Aug 2015
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're welcome!


About my table, it is done and it is functional (in, fact, I created 2 tables: one for forums and other for threads), but as I put much more data than I need, I will improve the first solution.

The first solution was based in the thought: "Once I want to be sure that all my redirection work, I will save them in the DB, then I visit every single link and flag it as successful mapping. At the end, I add the redirection to htaccess".
However, I realized I don't need the htaccess at all.

Just a reminder: I migrated from Phorum 5.2 to vBulletin. This helped me a lot, because the structure of the link was pretty different.


First solution

Here it is the structure of the tables, later I will explain how I use them:

*note: I removed search indexes for some fields to keep the SQL shorter.
[SQL]CREATE TABLE IF NOT EXISTS legacy_forum (
nodeid smallint(5) NOT NULL,
nodeparentid smallint(5) NOT NULL,
forumid smallint(5) NOT NULL,
forumparentid smallint(5) NOT NULL,
importforumid smallint(5) NOT NULL,
importforumparentid smallint(5) NOT NULL,
title varchar(70),
phorumSlug varchar(70),
`vb5Slug` varchar(70),
phorumUrl varchar(150),
`vb5Url` varchar(150),
UNIQUE KEY uky_objectId (nodeid)
) CHARSET=ucs2 COLLATE=ucs2_general_ci ENGINE=innodb;

CREATE TABLE IF NOT EXISTS legacy_thread (
nodeid mediumint(9) NOT NULL,
nodeforumid smallint(5) NOT NULL,
threadid mediumint(9) NOT NULL,
importthreadid mediumint(9) NOT NULL,
importforumid smallint(5) NOT NULL,
title varchar(70),
phorumSlug varchar(150),
`vb5Slug` varchar(220),
phorumUrl varchar(220),
`vb5Url` varchar(330),
phorumChecked tinyint(1) DEFAULT NULL,
vbChecked tinyint(1) DEFAULT NULL,
UNIQUE KEY uky_objectId (nodeid)
) CHARSET=ucs2 COLLATE=ucs2_general_ci ENGINE=innodb;[/SQL]

The tables are mainly mappings between ids, slugs and paths of Phorum and vBulletin.
  • everything with "import*" or "phorum*" is related to Phorum;
  • everything with "forum*" or "thread*" is related to vBulletin 4 (I only kept it in the table for safety reasons);
  • everything with "node*" and "vb*" is related to vBulletin 5.

The table legacy_forum was created from forum (forums in vB4) and node (table for all nodes - forums, threads, posts in vB5).
The table legacy_thread was created from thread (threads in vB4) and node (table for all nodes - forums, threads, posts in vB5).

All fields related to slugs and URLs were derived from the title.

As I learned more related to the redirection, I realized I simply need to treat the paths vBulletin can't treat, instead of creating rules or mapping to htaccess. So I do not need all that URL mapping.
The paths vBulletin can't treat (Phorum paths) already have the legacy id. So, I get the legacy id with preg_match, then I can fetch vBulletin nodeid from the legacy table and, at the end, get the correspondent route using vBulletin API.



Future improvement

Once I do not need the mapping, I removed it from the tables. I also removed the references to vB4.
At the end, those will be my redirection tables:

*note: I removed search indexes for some fields to keep the SQL shorter.
[SQL]CREATE TABLE IF NOT EXISTS legacy_forum (
nodeid smallint(5) NOT NULL,
nodeparentid smallint(5) NOT NULL,
importforumid smallint(5) NOT NULL,
importforumparentid smallint(5) NOT NULL,
UNIQUE KEY uky_objectId (nodeid)
) CHARSET=ucs2 COLLATE=ucs2_general_ci ENGINE=innodb;

CREATE TABLE IF NOT EXISTS legacy_thread (
nodeid mediumint(9) NOT NULL,
nodeforumid smallint(5) NOT NULL,
importthreadid mediumint(9) NOT NULL,
importforumid smallint(5) NOT NULL,
UNIQUE KEY uky_objectId (nodeid)
) CHARSET=ucs2 COLLATE=ucs2_general_ci ENGINE=innodb;[/SQL]

In those tables, I still have information I do not use. However, I will keep some ids just for the sake of do not throw away some data that might useful.


_______________
Edit (1 day after I wrote the post): I tested the solution I wrote as "future improvement". Everything works fine.
Reply With Quote
Благодарность от:
MarkFL
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:58 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04984 seconds
  • Memory Usage 2,435KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (2)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete