We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit b47fc9c0 authored by Brion Vibber's avatar Brion Vibber

Fix for strip_geo's decaching; also added --all option to run over all notices...

Fix for strip_geo's decaching; also added --all option to run over all notices by given profile to help in fixing up cache inconsistencies
parent 4e3fad4f
......@@ -21,7 +21,7 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
$shortoptions = 'i::n::y';
$longoptions = array('id=', 'nickname=', 'yes', 'dry-run');
$longoptions = array('id=', 'nickname=', 'yes', 'dry-run', 'all');
$helptext = <<<END_OF_HELP
strip_geo.php [options]
......@@ -31,6 +31,8 @@ Removes geolocation info from the given user's notices.
-n --nickname nickname of the user
-y --yes do not wait for confirmation
--dry-run list affected notices without deleting
--all run over and decache all messages, even if they don't
have geo data now (helps to fix cache bugs)
END_OF_HELP;
......@@ -67,10 +69,14 @@ if (!have_option('y', 'yes') && !have_option('--dry-run')) {
}
// @fixme for a very prolific poster this could be too many.
print "Finding notices with geolocation data...";
$notice = new Notice();
$notice->profile_id = $profile->id;
$notice->whereAdd("lat != ''");
if (have_option('--all')) {
print "Finding all notices by $profile->nickname...";
} else {
print "Finding notices by $profile->nickname with geolocation data...";
$notice->whereAdd("lat != ''");
}
$notice->find();
if ($notice->N) {
......@@ -101,10 +107,10 @@ if ($notice->N) {
$ok = $update->query($query);
if ($ok) {
// And now we decache him manually, as query() doesn't know what we're doing...
$orig->blow();
$orig->decache();
echo "(removed)";
} else {
echo "(failed?)";
echo "(unchanged?)";
}
}
print "\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment