}
}
} else {
- throw new Exception("You have to provide an ID or nickname or 'all'.");
+ show_help();
+ exit(1);
}
} catch (Exception $e) {
print $e->getMessage()."\n";
function updateAvatars($user)
{
+ $touched = false;
+
if (!have_option('q', 'quiet')) {
print "Updating avatars for user '".$user->nickname."' (".$user->id.")...";
}
}
}
- $orig = clone($avatar);
+ $orig_url = $avatar->url;
$avatar->url = Avatar::url($avatar->filename);
- if ($avatar->url != $orig->url) {
+ if ($avatar->url != $orig_url) {
$sql =
"UPDATE avatar SET url = '" . $avatar->url . "' ".
"WHERE profile_id = " . $avatar->profile_id . " ".
if (!$avatar->query($sql)) {
throw new Exception("Can't update avatar for user " . $user->nickname . ".");
+ } else {
+ $touched = true;
}
}
}
+ }
+ if ($touched) {
+ $profile = $user->getProfile();
+ common_broadcast_profile($profile);
}
+
if (have_option('v', 'verbose')) {
- print "DONE.\n";
+ print "DONE.";
+ }
+ if (!have_option('q', 'quiet') || have_option('v', 'verbose')) {
+ print "\n";
}
}