mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Remove gravatar support
Summary: Fixes T6261. The performance of asking gravatar for these images is horrible and causing lots of people to have issues with the page. Test Plan: noted how wildly fast the edit profile picture page loaded Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6261 Differential Revision: https://secure.phabricator.com/D10724
This commit is contained in:
parent
ba2963ecb3
commit
9dd09f7171
1 changed files with 0 additions and 45 deletions
|
@ -156,51 +156,6 @@ final class PhabricatorPeopleProfilePictureController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to add Gravatar images for any email addresses associated with the
|
|
||||||
// account.
|
|
||||||
if (PhabricatorEnv::getEnvConfig('security.allow-outbound-http')) {
|
|
||||||
$emails = id(new PhabricatorUserEmail())->loadAllWhere(
|
|
||||||
'userPHID = %s ORDER BY address',
|
|
||||||
$user->getPHID());
|
|
||||||
|
|
||||||
$futures = array();
|
|
||||||
foreach ($emails as $email_object) {
|
|
||||||
$email = $email_object->getAddress();
|
|
||||||
|
|
||||||
$hash = md5(strtolower(trim($email)));
|
|
||||||
$uri = id(new PhutilURI("https://secure.gravatar.com/avatar/{$hash}"))
|
|
||||||
->setQueryParams(
|
|
||||||
array(
|
|
||||||
'size' => 200,
|
|
||||||
'default' => '404',
|
|
||||||
'rating' => 'x',
|
|
||||||
));
|
|
||||||
$futures[$email] = new HTTPSFuture($uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
|
||||||
foreach (Futures($futures) as $email => $future) {
|
|
||||||
try {
|
|
||||||
list($body) = $future->resolvex();
|
|
||||||
$file = PhabricatorFile::newFromFileData(
|
|
||||||
$body,
|
|
||||||
array(
|
|
||||||
'name' => 'profile-gravatar',
|
|
||||||
'ttl' => (60 * 60 * 4),
|
|
||||||
));
|
|
||||||
if ($file->isTransformableImage()) {
|
|
||||||
$images[$file->getPHID()] = array(
|
|
||||||
'uri' => $file->getBestURI(),
|
|
||||||
'tip' => pht('Gravatar for %s', $email),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (Exception $ex) {
|
|
||||||
// Just continue.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($unguarded);
|
|
||||||
}
|
|
||||||
|
|
||||||
$images[PhabricatorPHIDConstants::PHID_VOID] = array(
|
$images[PhabricatorPHIDConstants::PHID_VOID] = array(
|
||||||
'uri' => $default_image->getBestURI(),
|
'uri' => $default_image->getBestURI(),
|
||||||
'tip' => pht('Default Picture'),
|
'tip' => pht('Default Picture'),
|
||||||
|
|
Loading…
Reference in a new issue