From: Mikael Nordfeldth Date: Mon, 26 Jan 2015 16:25:46 +0000 (+0100) Subject: Force updateAvatar if desired X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=697a00d8e1495fbf2018f8aa26cf7c6bdef551ba;p=quix0rs-gnu-social.git Force updateAvatar if desired --- 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) {