All pastes #445265 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-17 19:50 UTC
rendered paste body
foreach($forums as $forumid => $forumdata) {
if ( $forumid == 10 ) {
    $newforum = phorum_convert_prepareForum($forumdata);

    if (!$forumdata['folder']) {
        $PHORUM['forum_id'] = $forumid;
        $CONVERT['forum_id'] = $forumid;

        echo "Reading maximum message-id from messages-table... {$CONVERT['lbr']}";
        flush();
        $CONVERT['max_id'] = phorum_db_get_max_messageid();
        $offsets[$forumid]=$CONVERT['max_id'];

        echo "Writing postings for forum " . $forumdata['name'] . "...{$CONVERT['lbr']}";
        flush();

        $count = 1;
        $total = 0;

        $res = phorum_convert_selectMessages($forumdata, $oldlink);
        while ($newmessage = phorum_convert_getNextMessage($res,$forumdata['table_name'])) {

            if(phorum_db_post_message($newmessage, true)) {
              phorum_update_thread_info($newmessage['thread']);
              echo "+";
              flush();
              if ($count == 50) {
                  $total += $count;
                  echo " $total from \"{$forumdata['name']}\"";
                  if($CONVERT['lbr']=="\n"){
                      // lets just go back on this line if we are on the console
                      echo "\r";
                  } else {
                      echo $CONVERT['lbr'];
                  }
                  flush();
                  $count = 0;
              }
              $count++;
            } else {
              print "Error in message: ".$CONVERT['lbr'];
              print_var($newmessage);
              print $CONVERT['lbr'];
            }
        }

        echo "{$CONVERT['lbr']}Updating forum-statistics: {$CONVERT['lbr']}";
        flush();
        phorum_db_update_forum_stats(true);
        echo $CONVERT['lbr'];
        flush();
    }
}
}