phpBB2 + CH to phpBB3 Upgrade Script(s) Package

Stand-alone scripts designed for a specific function, but not neccessarily part of normal forum browsing.
Forum rules
Image Please feel free to download any Scripts here, support for each Script is located it's own thread.

To post your own Script, please first read the MOD / Script Guidelines

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby EXreaction » 29 Dec 2006, 22:29

[quote="jimmygoon":c0ba4]
Actually I didn't "backup" anything, I just copied the directory and the database on my server and used them to play with. I was using the word "luckily" as an expression; I'm actually usually more of a hypocondriak about these things than most people are.

BTW: It wasn't even so much that the script didn't copy the avatars as it was the fact that it failed because of the avatars... luckily my addition fixes that.
[/quote:c0ba4]

Using words in the correct situation, and where they mean what you think helps a lot. Wink

It is fine when you joke around other places, but please don't do so when your asking for support, it confuses the people that are trying to help. Smile
My phpBB3 Mods: Advertisement Management | Anti-Spam ACP | Auto Database Backup | Enable HTML | Advanced Subscriptions | Custom Profile Groups | From Author PM List | FAQ Manager | Forum Anniversary List | One Click Ban | Forum Sponsors | Smilies Categories | Drag 'n Drop Forum List | Soft Delete

Interested in becoming a Jr MOD Validator and helping out validation of mods @phpBB.com? Apply here
User avatar
EXreaction    
Supporter
Supporter
 
Posts: 1316
Joined: 03 Jun 2006, 09:10
Location: Plymouth, WI
Gender: Male


Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby Handyman » 29 Dec 2006, 23:32

Exreaction, here are the files I used for my upgrade https://svn.sourceforge.net/svnroot/olympus/phpBB3/UI/
Most of them are duplicates of the ones that were used in the upgrade directory, except for the forums, topics and possibly posts.
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7454
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby EXreaction » 30 Dec 2006, 17:34

Thanks. Smile
My phpBB3 Mods: Advertisement Management | Anti-Spam ACP | Auto Database Backup | Enable HTML | Advanced Subscriptions | Custom Profile Groups | From Author PM List | FAQ Manager | Forum Anniversary List | One Click Ban | Forum Sponsors | Smilies Categories | Drag 'n Drop Forum List | Soft Delete

Interested in becoming a Jr MOD Validator and helping out validation of mods @phpBB.com? Apply here
User avatar
EXreaction    
Supporter
Supporter
 
Posts: 1316
Joined: 03 Jun 2006, 09:10
Location: Plymouth, WI
Gender: Male

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby EXreaction » 02 Jan 2007, 20:30

Well yours was nowhere near working for CH 1.6. Tongue

So I made my own:
Spoiler:
Code: Select all
<?php
/**
*
* @package Categories Hiearchy 1.6 to phpBB3
* @copyright  2006 EXreaction
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

function add_subforums($forum_id, $parent_id, &$left_id)
{
    global
$phpbb2_prefix, $db_phpbb2, $db, $forums_assignment;

    
$sql = "SELECT * FROM {$phpbb2_prefix}forums
        WHERE forum_main = '"
. $forum_id . "'
        ORDER BY forum_order ASC"
;
    
$subforum_ids = $db_phpbb2->sql_query($sql);
    while(
$row = $db_phpbb2->sql_fetchrow($subforum_ids))
    {
        
// set the forum type
        
switch ($row['forum_type'])
        {
            case
'c': // category
                
$forum_type = 0;
            break;
            case
'f': // forum
                
$forum_type = 1;
            break;
            case
'l': // link
                
$forum_type = 2;
            break;
        }

        
$db->sql_transaction();
        
$sql_ary = array(
            
'parent_id'                    => $parent_id,
            
'left_id'                    => $left_id,
            
'forum_name'                => $row['forum_name'],
            
'forum_desc'                => ($row['forum_desc'] == NULL) ? '' : $row['forum_desc'],
            
'forum_desc_options'        => 7,
            
'forum_link'                => ($row['forum_link'] == NULL) ? '' : $row['forum_link'],
            
'forum_rules_options'        => 7,
            
'forum_type'                => $forum_type,
            
'forum_posts'                => $row['forum_posts'],
            
'forum_topics'                => $row['forum_topics'],
            
'forum_last_post_id'        => $row['forum_last_post_id'],
            
'forum_last_poster_id'        => $row['forum_last_poster'],
            
'forum_last_post_time'        => $row['forum_last_time'],
            
'forum_last_poster_name'    => $row['forum_last_title'],
            
'forum_last_poster_name'    => $row['forum_last_username'],
        );
        
$sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
        
$db->sql_query($sql);

        
$left_id++;

        
// $new_id is the new forum's id
        
$new_id = $db->sql_nextid();

        
// we use this later in the posts and topics upgrade
        
$forums_assignment[$row['forum_id']] = $new_id;

        
// add all subforums for the current forum
        
add_subforums($row['forum_id'], $new_id, &$left_id);

        
// Update the right_id
        
$sql = 'UPDATE ' . FORUMS_TABLE . " SET right_id = '" . $left_id . "'
            WHERE forum_id = '"
. $new_id . "'";
        
$db->sql_query($sql);

        
$left_id++;
    }
}

// Truncate the forums table so we don't have any duplicate entry problems from old data
$sql = 'TRUNCATE TABLE ' . FORUMS_TABLE;
$db->sql_query($sql);

// initiate the left id
$left_id = 1;

// Start at the first level with main categories
$sql = "SELECT * FROM {$phpbb2_prefix}forums
    WHERE forum_type = 'c'
    ORDER BY forum_order ASC"
;
$phpbb2_categories = $db_phpbb2->sql_query($sql);
while (
$row = $db_phpbb2->sql_fetchrow($phpbb2_categories))
{
    
// set the forum type
    
switch ($row['forum_type'])
    {
        case
'c': // category
            
$forum_type = 0;
        break;
        case
'f': // forum
            
$forum_type = 1;
        break;
        case
'l': // link
            
$forum_type = 2;
        break;
    }

    
$db->sql_transaction();
    
$sql_ary = array(
        
'parent_id'                    => 0,
        
'left_id'                    => $left_id,
        
'forum_name'                => $row['forum_name'],
        
'forum_desc'                => ($row['forum_desc'] == NULL) ? '' : $row['forum_desc'],
        
'forum_desc_options'        => 7,
        
'forum_link'                => ($row['forum_link'] == NULL) ? '' : $row['forum_link'],
        
'forum_rules_options'        => 7,
        
'forum_type'                => $forum_type,
        
'forum_posts'                => $row['forum_posts'],
        
'forum_topics'                => $row['forum_topics'],
        
'forum_last_post_id'        => $row['forum_last_post_id'],
        
'forum_last_poster_id'        => $row['forum_last_poster'],
        
'forum_last_post_time'        => $row['forum_last_time'],
        
'forum_last_poster_name'    => $row['forum_last_title'],
        
'forum_last_poster_name'    => $row['forum_last_username'],
    );
    
$sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
    
$db->sql_query($sql);

    
$left_id++;

    
// $new_id is the new forum's id
    
$new_id = $db->sql_nextid();

    
// we use this later in the posts and topics upgrade
    
$forums_assignment[$row['forum_id']] = $new_id;

    
// add all subforums for the current forum
    
add_subforums($row['forum_id'], $new_id, &$left_id);

    
// Update the right_id
    
$sql = 'UPDATE ' . FORUMS_TABLE . " SET right_id = '" . $left_id . "'
        WHERE forum_id = '"
. $new_id . "'";
    
$db->sql_query($sql);

    
$left_id++;
}

// used later on in the posts upgrade script to make sure the correct forum_id is used with the topics and posts which are converted
$handle = fopen("{$phpbb_root_path}cache/forums.dat", 'w');
fwrite($handle, serialize($forums_assignment));
fclose($handle);
?>


Tongue

Also...I wish converting the forum wouldn't take so long. Sad
...there are only 196 members...but 84,068 posts. Swoon

The 500 second php time limit wasn't enough. Swoon
My phpBB3 Mods: Advertisement Management | Anti-Spam ACP | Auto Database Backup | Enable HTML | Advanced Subscriptions | Custom Profile Groups | From Author PM List | FAQ Manager | Forum Anniversary List | One Click Ban | Forum Sponsors | Smilies Categories | Drag 'n Drop Forum List | Soft Delete

Interested in becoming a Jr MOD Validator and helping out validation of mods @phpBB.com? Apply here
User avatar
EXreaction    
Supporter
Supporter
 
Posts: 1316
Joined: 03 Jun 2006, 09:10
Location: Plymouth, WI
Gender: Male

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby lord idiot » 03 Jan 2007, 06:38

Try migrating a 770,722 post forum Smile I had to add limits to the sql query's otherwise the server went down Swoon But I'm halfway now Smile
lord idiot
Crewman
Crewman
 
Posts: 1
Joined: 02 Jan 2007, 11:30
Gender: Male

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby Overfiend » 03 Jan 2007, 07:20

greetings foks. first time caller, long time listener. Any changes I can make to get this to allow the NULL? Many thanks in advance for your help.

Spoiler:
Code: Select all
SQL ERROR [ mysql4 ]

Column 'topic_id' cannot be null [1048]

SQL

INSERT INTO phpbb_attachments (attach_id, post_msg_id, topic_id, in_message, poster_id, physical_filename, real_filename, download_count, attach_comment, extension, mimetype, filesize, filetime, thumbnail) VALUES ('14', '570', NULL, '0', 9, 'thechamp_252.jpg', 'THECHAMP.JPG', '32', '', 'jpg', 'image/jpeg', '10988', '1128471294', '0')

BACKTRACE


FILE: includes/db/mysql4.php
LINE: 120
CALL: dbal_mysql4->sql_error()

FILE: upgrade/attach_upgrade.php
LINE: 109
CALL: dbal_mysql4->sql_query()

FILE: upgrade/index.php
LINE: 405
CALL: include_once('upgrade/attach_upgrade.php')
Last edited by Highway of Life on 03 Jan 2007, 10:43, edited 1 time in total.
Reason: Spoilerized and enclosed in code.
Overfiend
Crewman
Crewman
 
Posts: 4
Joined: 20 Dec 2006, 11:55
Gender: Male

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby Highway of Life » 03 Jan 2007, 10:48

Try this, in attach_upgrade.php
FIND:
Code: Select all
'topic_id'                    => $phpbb2_topic_id,

REPLACE, WITH
Code: Select all
'topic_id'                    => ($phpbb2_topic_id == NULL) ? '' : $phpbb2_topic_id,


If you are still getting an error, use:
Code: Select all
'topic_id'                    => ($phpbb2_topic_id == NULL) ? 0 : $phpbb2_topic_id,
instead.
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby Overfiend » 03 Jan 2007, 11:10

your heroism is legendary, sir.
Overfiend
Crewman
Crewman
 
Posts: 4
Joined: 20 Dec 2006, 11:55
Gender: Male

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby EXreaction » 03 Jan 2007, 11:36

lord idiot wrote:Try migrating a 770,722 post forum Smile I had to add limits to the sql query's otherwise the server went down Swoon But I'm halfway now Smile


Swoon

Highway of Life wrote:Try this, in attach_upgrade.php
FIND:
Code: Select all
'topic_id'                    => $phpbb2_topic_id,

REPLACE, WITH
Code: Select all
'topic_id'                    => ($phpbb2_topic_id == NULL) ? '' : $phpbb2_topic_id,


If you are still getting an error, use:
Code: Select all
'topic_id'                    => ($phpbb2_topic_id == NULL) ? 0 : $phpbb2_topic_id,
instead.


Eh, that isn't a good idea. Wink
My phpBB3 Mods: Advertisement Management | Anti-Spam ACP | Auto Database Backup | Enable HTML | Advanced Subscriptions | Custom Profile Groups | From Author PM List | FAQ Manager | Forum Anniversary List | One Click Ban | Forum Sponsors | Smilies Categories | Drag 'n Drop Forum List | Soft Delete

Interested in becoming a Jr MOD Validator and helping out validation of mods @phpBB.com? Apply here
User avatar
EXreaction    
Supporter
Supporter
 
Posts: 1316
Joined: 03 Jun 2006, 09:10
Location: Plymouth, WI
Gender: Male

Re: phpBB2 to phpBB3 Upgrade Script(s) Package

Postby Overfiend » 03 Jan 2007, 11:41

ran the script and it went through with no errors. But none of the attachments are showing in the posts.
Overfiend
Crewman
Crewman
 
Posts: 4
Joined: 20 Dec 2006, 11:55
Gender: Male

PreviousNext

Return to Scripts

Who is online

Users browsing this forum: Exabot [Bot] and 4 guests