summaryrefslogtreecommitdiff
path: root/scripts/fixup_utf8.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-05-28 16:36:07 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-05-28 16:36:07 -0400
commitdaf845dbe67a909e2bc9e039d3c2ccc560345b4d (patch)
treec45061cd7bfcee97060156c4bddedabc558778e2 /scripts/fixup_utf8.php
parent121cb6afb1822517e215eef23a5cb87796ecea35 (diff)
take an argument for fixup_utf8
Diffstat (limited to 'scripts/fixup_utf8.php')
-rw-r--r--scripts/fixup_utf8.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/fixup_utf8.php b/scripts/fixup_utf8.php
index 0763c72c9..e5021ff34 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 main() {
+function fixup_utf8($id) {
$dbl = doConnect('latin1');
@@ -58,8 +58,16 @@ function main() {
return;
}
- $rn = $dbl->query('SELECT id, content, rendered FROM notice ' .
- 'WHERE LENGTH(content) != CHAR_LENGTH(content)');
+ $sql = 'SELECT id, content, rendered FROM notice ' .
+ 'WHERE LENGTH(content) != CHAR_LENGTH(content)';
+
+ if (!empty($id)) {
+ $sql .= ' AND id < ' . $id;
+ }
+
+ $sql .= ' ORDER BY id DESC';
+
+ $rn = $dbl->query($sql);
if (PEAR::isError($rn)) {
echo "ERROR: " . $rn->getMessage() . "\n";
@@ -128,4 +136,6 @@ function doConnect($charset)
return $db;
}
-main();
+$id = ($argc > 1) ? $argv[1] : null;
+
+fixup_utf8($id);