From: Evan Prodromou Date: Sat, 30 May 2009 15:52:35 +0000 (-0400) Subject: take a max and min argument for fixup_utf8 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7b1a72da307694bee40a2278482003855a2a2ab1;p=quix0rs-gnu-social.git take a max and min argument for fixup_utf8 --- diff --git a/scripts/fixup_utf8.php b/scripts/fixup_utf8.php index e5021ff343..67f9c46236 100644 --- a/scripts/fixup_utf8.php +++ b/scripts/fixup_utf8.php @@ -35,7 +35,7 @@ define('LACONICA', true); require_once(INSTALLDIR . '/lib/common.php'); require_once('DB.php'); -function fixup_utf8($id) { +function fixup_utf8($max_id, $min_id) { $dbl = doConnect('latin1'); @@ -61,8 +61,12 @@ function fixup_utf8($id) { $sql = 'SELECT id, content, rendered FROM notice ' . 'WHERE LENGTH(content) != CHAR_LENGTH(content)'; - if (!empty($id)) { - $sql .= ' AND id < ' . $id; + if (!empty($max_id)) { + $sql .= ' AND id <= ' . $max_id; + } + + if (!empty($min_id)) { + $sql .= ' AND id >= ' . $min_id; } $sql .= ' ORDER BY id DESC'; @@ -136,6 +140,7 @@ function doConnect($charset) return $db; } -$id = ($argc > 1) ? $argv[1] : null; +$max_id = ($argc > 1) ? $argv[1] : null; +$min_id = ($argc > 2) ? $argv[2] : null; -fixup_utf8($id); +fixup_utf8($max_id, $min_id);