add revision date to main profile photo to overcome cache when updated, other photos (e.g. conversations) must wait for cache update

This commit is contained in:
friendica 2011-11-12 17:50:14 -08:00
parent 240a3431cc
commit bbf857ba39
3 changed files with 10 additions and 8 deletions

View File

@ -796,17 +796,17 @@ function profile_load(&$a, $nickname, $profile = 0) {
if($profile) { if($profile) {
$profile_int = intval($profile); $profile_int = intval($profile);
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile` $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d LIMIT 1", WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d and `contact`.`self` = 1 LIMIT 1",
dbesc($nickname), dbesc($nickname),
intval($profile_int) intval($profile_int)
); );
} }
if(! count($r)) { if(! count($r)) {
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile` $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 LIMIT 1", WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 and `contact`.`self` = 1 LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
} }
@ -881,6 +881,8 @@ function profile_sidebar($profile, $block = 0) {
if((! is_array($profile)) && (! count($profile))) if((! is_array($profile)) && (! count($profile)))
return $o; return $o;
$profile['picdate'] = urlencode($profile['picdate']);
call_hooks('profile_sidebar_enter', $profile); call_hooks('profile_sidebar_enter', $profile);

View File

@ -21,7 +21,7 @@
{{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }} {{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo" alt="$profile.name" /></div> <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo?rev=$profile.picdate" alt="$profile.name" /></div>

View File

@ -5,7 +5,7 @@
{{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }} {{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo" alt="$profile.name"></div> <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo?rev=$profile.picdate" alt="$profile.name"></div>