From 697a00d8e1495fbf2018f8aa26cf7c6bdef551ba Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 26 Jan 2015 17:25:46 +0100 Subject: [PATCH] Force updateAvatar if desired --- plugins/OStatus/classes/Ostatus_profile.php | 4 ++-- plugins/OStatus/scripts/update_ostatus_profiles.php | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 2fb869e2f3..af699db500 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -1233,9 +1233,9 @@ class Ostatus_profile extends Managed_DataObject * @param string $url * @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. return; } diff --git a/plugins/OStatus/scripts/update_ostatus_profiles.php b/plugins/OStatus/scripts/update_ostatus_profiles.php index dc8232e0d7..2a32ae0491 100644 --- a/plugins/OStatus/scripts/update_ostatus_profiles.php +++ b/plugins/OStatus/scripts/update_ostatus_profiles.php @@ -20,8 +20,8 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); -$shortoptions = 'u:a'; -$longoptions = array('uri=', 'all'); +$shortoptions = 'u:af'; +$longoptions = array('uri=', 'all', 'force'); $helptext = <<find(); if (!empty($cnt)) { @@ -252,7 +255,7 @@ while($lop->fetch()) { $orig = clone($lop); $lop->avatar = $oprofile->avatar; $lop->update($orig); - $lop->updateAvatar($oprofile->avatar); + $lop->updateAvatar($oprofile->avatar, $forceUpdates); if (!$quiet) { print "Done.\n"; } } } catch (Exception $e) { -- 2.39.5