]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/updateavatarurl.php
Extra debug instrumentation for xmppdaemon
[quix0rs-gnu-social.git] / scripts / updateavatarurl.php
index acafa74b0654c3ae35b14b69cd25704e81d4033f..617c2e24c744233990b651010bb09fe45138d1ca 100644 (file)
@@ -60,7 +60,8 @@ try {
             }
         }
     } 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";
@@ -69,6 +70,8 @@ try {
 
 function updateAvatars($user)
 {
+    $touched = false;
+
     if (!have_option('q', 'quiet')) {
         print "Updating avatars for user '".$user->nickname."' (".$user->id.")...";
     }
@@ -108,12 +111,22 @@ function updateAvatars($user)
 
                 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";
     }
 }