Differential D16043 Diff 38609 src/applications/people/cache/PhabricatorUserProfileImageCacheType.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/cache/PhabricatorUserProfileImageCacheType.php
| Show All 11 Lines | return array( | ||||
| self::KEY_URI, | self::KEY_URI, | ||||
| ); | ); | ||||
| } | } | ||||
| public function canManageKey($key) { | public function canManageKey($key) { | ||||
| return ($key === self::KEY_URI); | return ($key === self::KEY_URI); | ||||
| } | } | ||||
| public function getDefaultValue() { | |||||
| return PhabricatorUser::getDefaultProfileImageURI(); | |||||
| } | |||||
| public function newValueForUsers($key, array $users) { | public function newValueForUsers($key, array $users) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $file_phids = mpull($users, 'getProfileImagePHID'); | $file_phids = mpull($users, 'getProfileImagePHID'); | ||||
| $file_phids = array_filter($file_phids); | $file_phids = array_filter($file_phids); | ||||
| if ($file_phids) { | if ($file_phids) { | ||||
| $files = id(new PhabricatorFileQuery()) | $files = id(new PhabricatorFileQuery()) | ||||
| Show All 22 Lines | public function newValueForUsers($key, array $users) { | ||||
| return $results; | return $results; | ||||
| } | } | ||||
| public function getValueFromStorage($value) { | public function getValueFromStorage($value) { | ||||
| $parts = explode(',', $value, 2); | $parts = explode(',', $value, 2); | ||||
| return end($parts); | return end($parts); | ||||
| } | } | ||||
| public function getValueForStorage($value) { | |||||
| return $value; | |||||
| } | |||||
| public function shouldValidateRawCacheData() { | public function shouldValidateRawCacheData() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function isRawCacheDataValid(PhabricatorUser $user, $key, $data) { | public function isRawCacheDataValid(PhabricatorUser $user, $key, $data) { | ||||
| $parts = explode(',', $data, 2); | $parts = explode(',', $data, 2); | ||||
| $version = reset($parts); | $version = reset($parts); | ||||
| return ($version === $this->getCacheVersion($user)); | return ($version === $this->getCacheVersion($user)); | ||||
| Show All 13 Lines | |||||