diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-05-30 11:52:35 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-05-30 11:52:35 -0400 |
commit | 7b1a72da307694bee40a2278482003855a2a2ab1 (patch) | |
tree | 9991e455705d6d7b0fbc9c0ccf6ebd9dc1f052e2 /scripts/fixup_utf8.php | |
parent | 76ee1fd5daa6ab1999224d8e93df1b7116f24c36 (diff) |
take a max and min argument for fixup_utf8
Diffstat (limited to 'scripts/fixup_utf8.php')
-rw-r--r-- | scripts/fixup_utf8.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/fixup_utf8.php b/scripts/fixup_utf8.php index e5021ff34..67f9c4623 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); |