Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/provider/PhabricatorAuthProvider.php
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | if ($image_uri) { | ||||
// file entry for it, but there's no convenient way to do this with | // file entry for it, but there's no convenient way to do this with | ||||
// PhabricatorFile right now. The storage will get shared, so the impact | // PhabricatorFile right now. The storage will get shared, so the impact | ||||
// here is negligible. | // here is negligible. | ||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | ||||
$image_file = PhabricatorFile::newFromFileDownload( | $image_file = PhabricatorFile::newFromFileDownload( | ||||
$image_uri, | $image_uri, | ||||
array( | array( | ||||
'name' => $name, | 'name' => $name, | ||||
'canCDN' => true, | 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, | ||||
)); | )); | ||||
unset($unguarded); | if ($image_file->isViewableImage()) { | ||||
$image_file | |||||
if ($image_file) { | ->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy()) | ||||
->setCanCDN(true) | |||||
->save(); | |||||
$account->setProfileImagePHID($image_file->getPHID()); | $account->setProfileImagePHID($image_file->getPHID()); | ||||
} else { | |||||
$image_file->delete(); | |||||
} | } | ||||
unset($unguarded); | |||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
// Log this but proceed, it's not especially important that we | // Log this but proceed, it's not especially important that we | ||||
// be able to pull profile images. | // be able to pull profile images. | ||||
phlog($ex); | phlog($ex); | ||||
} | } | ||||
} | } | ||||
$this->willSaveAccount($account); | $this->willSaveAccount($account); | ||||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |