phorum_api_user_save(array("user_id" => $user["user_id"])); // ... but still we run the name updates here, so inconsitencies // are flattened out. $user = phorum_api_user_get($user["user_id"]); phorum_db_user_display_name_updates(array("user_id" => $user["user_id"], "display_name" => $user["display_name"])); } if ($updated == 0) { $frm = new PhorumInputForm("", "post", "Finish"); $frm->addbreak("Display names updated"); $frm->addmessage("The display names are all updated successfully."); $frm->show(); return; } } // Retrieve user count. $user_count = isset($_REQUEST['user_count']) ? (int) $_REQUEST['user_count'] : phorum_db_user_count(); $perc = floor(($batch + 1) * $batchsize / $user_count * 100); if ($perc > 100) { $perc = 100; } ?> <strong>Running display name updates.</strong><br/> <strong>This might take a while ...</strong><br/><br/> <table><tr><td> <div style="height:20px;width:300px; border:1px solid black"> <div style="height:20px;width:<?php print $perc; ?> %;background-color:green"> </div></div></td><td style="padding-left:10px">
// if we are running in the webserver, bail out if ('cli' != php_sapi_name()) { echo "This script cannot be run from a browser."; return; } define("PHORUM_ADMIN", 1); define('phorum_page', 'rebuild_real_names'); chdir(dirname(__FILE__) . "/.."); require_once './common.php'; // Make sure that the output is not buffered. phorum_ob_clean(); if (!ini_get('safe_mode')) { set_time_limit(0); ini_set("memory_limit", "64M"); } $count_total = phorum_db_user_count(); $res = phorum_db_user_get_all(); print "\nRebuilding display name information ...\n"; $size = strlen($count_total); $count = 0; while ($user = phorum_db_fetch_row($res, DB_RETURN_ASSOC)) { // We save an empty user, to make sure that the display name in the // database is up-to-date. This will already run needed updates in // case the display name changed ... phorum_api_user_save(array("user_id" => $user["user_id"])); // ... but still we run the name updates here, so inconsistencies // are flattened out. $user = phorum_api_user_get($user["user_id"]); phorum_db_user_display_name_updates(array("user_id" => $user["user_id"], "display_name" => $user["display_name"])); $count++; $perc = floor($count / $count_total * 100);