Firefox PHP

rebuild_meta_data_mysql.php - vroot problem

Posted by Jeff Teeters 
rebuild_meta_data_mysql.php - vroot problem
September 02, 2007 08:51PM
I'm trying to run the rebuild_meta_data_mysql.php script. I'm using phorum 5.1.24a and running an embedded forum. Initially, the script was failing with a message:

        The embed_phorum module needs a global variable \$PHORUM_CONNECTOR
        that contains a PhorumConnector class. This is not the case, which
        probably means that the Phorum is accessed directly instead of 
        through the master application in which Phorum was embedded.

I fixed this by inserting the following line in the script, since admin mode does not use embedded phorum. [Incidentally, the same technique (this line) removed the same error which was generated by loading common.php as required to run the embed_phorum mod syncuser.php script.]
define("PHORUM_ADMIN", true );  // included in rebuild_meta_data_mysql.php to get rid of embed_phorum error

However, now I'm getting this error:
Rebuilding meta-data ... 
Notice: Undefined index: vroot in C:\apache\htdocs\phorum\include\db\mysql.php on line 797

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
 C:\apache\htdocs\phorum\include\db\mysql.php on line 819
1 messages done. Rebuilding meta-data finished successfully if no errors were logged above.

Error is caused by $PHORUM['vroot'] being empty in mysql.php line 737 (i.e. line inside if statement in):
    if (!$ignore_forum_id && !empty($PHORUM["forum_id"])){
        $forum_id_check = "(forum_id = {$PHORUM['forum_id']} OR forum_id={$PHORUM['vroot']}) and";
    }

Any suggestions as to how I can solve this empty $PHORUM['vroot'] problem? That above line needs both $PHORUM['vroot'] and $PHORUM['forum_id'] to have values. The script file sets $PHORUM['forum_id'] and I see that in common.php (lines 212-226 - included below) it looks like if $PHORUM['forum_id'] is set, then $PHORUM['vroot'] is not initialized.

    // load the forum's settings
    if ( !empty( $PHORUM["forum_id"] ) ) {
        $forum_settings = phorum_db_get_forums( $PHORUM["forum_id"] );
        if ( empty( $forum_settings[$PHORUM["forum_id"]] ) ) {
            phorum_hook( "common_no_forum", "" );
            phorum_redirect_by_url( phorum_get_url( PHORUM_INDEX_URL ) );
            exit();
        }
        $PHORUM = array_merge( $PHORUM, $forum_settings[$PHORUM["forum_id"]] );
    } else {
        // some defaults we might need if no forum is set (i.e. on the index-page)
        $PHORUM['vroot']=0;
        $PHORUM['parent_id']=0;
        $PHORUM['active']=1;
        $PHORUM['folder_flag']=1;
    }



Edited 1 time(s). Last edit at 09/02/2007 09:08PM by jefft.
Re: rebuild_meta_data_mysql.php - vroot problem
September 03, 2007 03:59AM
$PHORUM['vroot'] is also set if a forum_id is set as all data is then loaded from the database where a vroot-field is included in the forums-table.
This script wasn't thought with embedding in mind.
Whats the cause why you are running this script? Something broken? Try to disable the embedding module and run this script and reenable the module afterwards.


Thomas Seifert
Re: rebuild_meta_data_mysql.php - vroot problem
September 04, 2007 07:16AM
I wanted to run the rebuild_meta_data_mysql.php script because messages in the forum were inserted by a custom script which had parsed them from listserv log files and mailman archives. That script was not calling phorum_update_thread_info with every message because I thought it would be more efficient to run the rebuild_meta_data_mysql.php script after all the messages were loaded.

Disabling the embed_phorum module and removing the "define("PHORUM_ADMIN", true );" allowed it to run.
How to insert Mailman messages into a Phorum?
August 22, 2008 09:57AM
@jefft: Would you like to share your experiences in how to insert Mailman messages into a Phorum?

I am very much interested in converting old Mailman archives into vivid Phorums, but I have no idea how to do it without re-inventing the wheel ...

Regards, Ulf Dunkel
Re: How to insert Mailman messages into a Phorum?
August 24, 2008 01:36PM
To do the import, rewrote phroummail.php, (which I renamed "mail2phorum") so that it has a function which is called with the email to post. Then the do the import, I wrote another script which parses the downloaded mailman archive logs (extracting individual emails) and then call the function in mail2phorum with each email. I would post the mail2phorum.php script here, but, for some reason I don't see an "attach file" option when composing this reply. So, instead I just put the script on a google notebook.
[www.google.com]

Hopefully, you will be able to copy and paste it from the notebook (file is second entry). If someone can let me know how to put an attachment in my Phorum reply, I'll put it here too.
Re: How to insert Mailman messages into a Phorum?
August 24, 2008 03:22PM
The 5.1 support forum does not have the attachments option enabled. The 5.1 hacks forum could be used to post the code.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: How to insert Mailman messages into a Phorum?
August 25, 2008 02:46AM
Hi Jeff.

Thank you for your fast reply - it seems as if the Google Notebook upload wasn't complete. The last visible line reads:

} elseif(isset($sections->parts) && $sections->parts){
foreach($sections->parts as

Would you like to put your mail2phorum.php code into the hacks forum like suggested by Maurice?

Regards, Ulf Dunkel
Sorry, only registered users may post in this forum.

Click here to login