1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 14:30: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:
Bob Trahan 2014-10-17 09:56:34 -07:00
parent ba2963ecb3
commit 9dd09f7171

View file

@ -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'),