vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Miscellaneous Hacks - 404 / 301 after import redirect on import ids (https://vborg.vbsupport.ru/showthread.php?t=176964)

jbeam 07-28-2008 01:18 PM

Anyone have any ideas?

tommythejoat 07-29-2008 02:07 PM

Jerry,

I am planning to install this for my bbV2 migration. I presume there is no reason to keep all the code for the other message board combinations with the conditionals, switches and so forth. I can just hard code it for the bbV2 url forms.

bbV2 does not support displaying posts independently of threads, and does not support displaying user profiles externally. I was planning to just provide the translation of thread and forum references.

Since bbV2 is a Perl script, the form of the urls are /bbBoard.cgi?a=viewthread;fid=3;gtid=305734 for a thread and bbBoard.cgi?a=viewforum;fid=3 for a forum. I could use your logic for the forum, but I will need to use a regular expression to skip the fid piece for threads.

When Jelsoft installed of vBulletin, they installed it in the root of the web (/var/www/html/) so there is no folder for the message board. I will need to modify the code to recognize this also.

When I have it working, I will post it here.

If you have any advice to offer, it would be appreciated.

Deepdog009 07-29-2008 06:11 PM

Nice!!!

tommythejoat 07-30-2008 01:02 PM

As mentioned in my previous response, I was modifying this tool to work with a bbBoardV2 migration.

A question comes up with respect to migrating between two different servers. The old server is still alive and clearly this script needs to run on the new server where vBulletin is located. If I put a redirect on the old board in place of the bbBoard.cgi script, I think that will handle it, but I am not sure.

Can anyone who has done this answer the question? My old board is currently live and I don't want to disrupt it just for an experiment.

I am attaching my modified version of 404.php (404t.php).

The contents of my .htaccess file are
Code:

ErrorDocument 404 /var/www/html/404t.php

php_flag log_errors on
php_value error_log /var/www/html/php_error.log

I have not yet run this and would appreciate a quick review. I found it was easier to extract values from the cgi style uri than I thought. The php intval function gets a number and ignores any following text. Therefore, you just need to start the evaluation following the "=" in the parameter string for the particular parameter. i.e. ;fid=, ;gtid=, ;pagenumber=.

Jerry 07-30-2008 10:14 PM

Quote:

Originally Posted by jbeam (Post 1580641)
Code:

http://thenewx.org/phpbb2/profile.php?mode=viewprofile&u=1594
This is an example of one of the old URL's. From what I can tell it looks right.

That is a default link for the profile and what the script is expecting, the default in the script should be fine, just set the domain :

PHP Code:

$old_folder     'phpBB/';     // With trailing slash
$old_ext_type    '.php';     // Including preceding dot 

Quote:

Originally Posted by tommythejoat (Post 1586669)
Jerry,

I am planning to install this for my bbV2 migration. I presume there is no reason to keep all the code for the other message board combinations with the conditionals, switches and so forth. I can just hard code it for the bbV2 url forms.

Yes, you don't need any of it, it's the import id's in the vBulletin tables and this script that take care of the look ups and refrences to old data.

Quote:

Originally Posted by tommythejoat (Post 1586669)
bbV2 does not support displaying posts independently of threads, and does not support displaying user profiles externally. I was planning to just provide the translation of thread and forum references.

Half the work then :)

Quote:

Originally Posted by tommythejoat (Post 1586669)
Since bbV2 is a Perl script, the form of the urls are /bbBoard.cgi?a=viewthread;fid=3;gtid=305734 for a thread and bbBoard.cgi?a=viewforum;fid=3 for a forum. I could use your logic for the forum, but I will need to use a regular expression to skip the fid piece for threads.

True, for the forum it looks like a fixed length string with the forumid on the end so crop the string and what ever is left is the forum id, as for the thread id, i'd use this :

PHP Code:

// It's a thread link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_thread_script}") === 0)
{
    
$action 'thread';
    
$old_id intval(substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], 'gtid=')+5));
    
$sql "SELECT threadid FROM {$tableprefix}thread WHERE importthreadid={$old_id}";


Where :

PHP Code:

$old_folder "";
$old_thread_script "bbBoard.cgi?a=viewthread"

For :

PHP Code:

$_SERVER['REQUEST_URI'] = "/bbBoard.cgi?a=viewthread;fid=3;gtid=305734"

Quote:

Originally Posted by tommythejoat (Post 1587416)
As mentioned in my previous response, I was modifying this tool to work with a bbBoardV2 migration.

A question comes up with respect to migrating between two different servers. The old server is still alive and clearly this script needs to run on the new server where vBulletin is located. If I put a redirect on the old board in place of the bbBoard.cgi script, I think that will handle it, but I am not sure.

You could update the DNS to send the old requests to the new server and have the web server handle it.

Jerry 07-30-2008 10:19 PM

Quote:

Originally Posted by Deepdog009 (Post 1586836)
Nice!!!

With ice and a slice :cool:

tommythejoat 07-30-2008 10:48 PM

Thanks Jerry,

I think I have it now.

I may not have easy control of the DNS. I will need to check it for a short time and switch it back. If this were one of my personal sites that is for sure what I would do.

:D Now if I could just get a response to my cleaner questions on the vbulletin.com community forum I would be good to go.

jbeam 07-31-2008 12:05 PM

Jerry,

Thanks for your response.

I think everything is correct and like I said, everything except the profile links work with no problem.

Here is the top half of my 404.php.

Code:

#Currently supported : 'phpBB2' 'ubb.threads' 'vb3' 'ipb2'

$old_system        = 'phpBB2';

// Domain
// Example :: http://www.example.com/phpBB/

$old_folder        = 'phpbb2/';                                                                // With trailing slash
$old_ext_type        = '.php';                                                                        // Including preceding dot
$standard_404        = 'http://www.thenewx.org/404.htm';        // The usual 404 that this script replaces

// Example :: www.example.com/vBulletin/

$new_domain        = 'www.thenewx.org';
$new_folder                = 'forum/';        // With trailing slash
$ext_type                = '.php';                // File extension type that vBulletin is using, i.e. index.php including the preceding dot


Jerry 08-01-2008 05:22 PM

Have you set up the logging table in MySQL ? Does it have any entries for the profiles ?

jbeam 08-04-2008 12:36 PM

I do have a logging table. It however does not have any entries for user profiles. There are a lot of ViewTopic requests and some 404 redirects (since the old phpbb directory does not exist).


All times are GMT. The time now is 06:51 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.01260 seconds
  • Memory Usage 1,764KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (4)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete