0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-23 00:41:52 +00:00

Fix up some comments, reduce code duplication.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1409 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2007-09-04 00:15:07 +00:00
parent b9d886d53b
commit 43a98de909

View File

@ -20,8 +20,10 @@ function phorum_htmlpurifier_migrate_sigs_check() {
function phorum_htmlpurifier_migrate_sigs($offset) { function phorum_htmlpurifier_migrate_sigs($offset) {
global $PHORUM; 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 @set_time_limit(0); // attempt to let this run
$increment = $PHORUM['mod_htmlpurifier']['migrate-sigs-increment']; $increment = $PHORUM['mod_htmlpurifier']['migrate-sigs-increment'];
@ -52,21 +54,19 @@ function phorum_htmlpurifier_migrate_sigs($offset) {
// query for highest ID in database // query for highest ID in database
$type = $PHORUM['DBCONFIG']['type']; $type = $PHORUM['DBCONFIG']['type'];
$sql = "select MAX(user_id) from {$PHORUM['user_table']}";
if ($type == 'mysql') { if ($type == 'mysql') {
$conn = phorum_db_mysql_connect(); $conn = phorum_db_mysql_connect();
$sql = "select MAX(user_id) from {$PHORUM['user_table']}";
$res = mysql_query($sql, $conn); $res = mysql_query($sql, $conn);
$row = mysql_fetch_row($res); $row = mysql_fetch_row($res);
$top_id = (int) $row[0];
} elseif ($type == 'mysqli') { } elseif ($type == 'mysqli') {
$conn = phorum_db_mysqli_connect(); $conn = phorum_db_mysqli_connect();
$sql = "select MAX(user_id) from {$PHORUM['user_table']}";
$res = mysqli_query($conn, $sql); $res = mysqli_query($conn, $sql);
$row = mysqli_fetch_row($res); $row = mysqli_fetch_row($res);
$top_id = (int) $row[0];
} else { } else {
exit('Unrecognized database!'); exit('Unrecognized database!');
} }
$top_id = (int) $row[0];
$offset += $increment; $offset += $increment;
if ($offset > $top_id) { // test for end condition if ($offset > $top_id) { // test for end condition