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

Commit 697a00d8 authored by mattl's avatar mattl

Force updateAvatar if desired

parent 67d09532
...@@ -1233,9 +1233,9 @@ class Ostatus_profile extends Managed_DataObject ...@@ -1233,9 +1233,9 @@ class Ostatus_profile extends Managed_DataObject
* @param string $url * @param string $url
* @throws Exception in various failure cases * @throws Exception in various failure cases
*/ */
public function updateAvatar($url) public function updateAvatar($url, $force)
{ {
if ($url == $this->avatar) { if ($url == $this->avatar && !$force) {
// We've already got this one. // We've already got this one.
return; return;
} }
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'u:a'; $shortoptions = 'u:af';
$longoptions = array('uri=', 'all'); $longoptions = array('uri=', 'all', 'force');
$helptext = <<<UPDATE_OSTATUS_PROFILES $helptext = <<<UPDATE_OSTATUS_PROFILES
update_ostatus_profiles.php [options] update_ostatus_profiles.php [options]
...@@ -32,6 +32,7 @@ you have no backup. ...@@ -32,6 +32,7 @@ you have no backup.
-u --uri OStatus profile URI to update -u --uri OStatus profile URI to update
-a --all update all -a --all update all
-f --force Force update (despite identical avatar URLs etc.)
UPDATE_OSTATUS_PROFILES; UPDATE_OSTATUS_PROFILES;
...@@ -230,6 +231,8 @@ if (have_option('u', 'uri')) { ...@@ -230,6 +231,8 @@ if (have_option('u', 'uri')) {
exit(1); exit(1);
} }
$forceUpdates = have_option('f', 'force');
$cnt = $lop->find(); $cnt = $lop->find();
if (!empty($cnt)) { if (!empty($cnt)) {
...@@ -252,7 +255,7 @@ while($lop->fetch()) { ...@@ -252,7 +255,7 @@ while($lop->fetch()) {
$orig = clone($lop); $orig = clone($lop);
$lop->avatar = $oprofile->avatar; $lop->avatar = $oprofile->avatar;
$lop->update($orig); $lop->update($orig);
$lop->updateAvatar($oprofile->avatar); $lop->updateAvatar($oprofile->avatar, $forceUpdates);
if (!$quiet) { print "Done.\n"; } if (!$quiet) { print "Done.\n"; }
} }
} catch (Exception $e) { } catch (Exception $e) {
......
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