From 43a98de909fc7b33b1e899e4e94bcbe90f36f1fa Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Tue, 4 Sep 2007 00:15:07 +0000 Subject: [PATCH] Fix up some comments, reduce code duplication. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1409 48356398-32a2-884e-a903-53898d9a118a --- plugins/phorum/settings/migrate-sigs.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/phorum/settings/migrate-sigs.php b/plugins/phorum/settings/migrate-sigs.php index 7896be36..fd990be7 100644 --- a/plugins/phorum/settings/migrate-sigs.php +++ b/plugins/phorum/settings/migrate-sigs.php @@ -20,8 +20,10 @@ function phorum_htmlpurifier_migrate_sigs_check() { function phorum_htmlpurifier_migrate_sigs($offset) { global $PHORUM; - if(!$offset) return; // bail out quick of $offset == 0 + if(!$offset) return; // bail out quick if $offset == 0 + // theoretically, we could get rid of this multi-request + // doo-hickery if safe mode is off @set_time_limit(0); // attempt to let this run $increment = $PHORUM['mod_htmlpurifier']['migrate-sigs-increment']; @@ -52,21 +54,19 @@ function phorum_htmlpurifier_migrate_sigs($offset) { // query for highest ID in database $type = $PHORUM['DBCONFIG']['type']; + $sql = "select MAX(user_id) from {$PHORUM['user_table']}"; if ($type == 'mysql') { $conn = phorum_db_mysql_connect(); - $sql = "select MAX(user_id) from {$PHORUM['user_table']}"; $res = mysql_query($sql, $conn); $row = mysql_fetch_row($res); - $top_id = (int) $row[0]; } elseif ($type == 'mysqli') { $conn = phorum_db_mysqli_connect(); - $sql = "select MAX(user_id) from {$PHORUM['user_table']}"; $res = mysqli_query($conn, $sql); $row = mysqli_fetch_row($res); - $top_id = (int) $row[0]; } else { exit('Unrecognized database!'); } + $top_id = (int) $row[0]; $offset += $increment; if ($offset > $top_id) { // test for end condition