Review update
Rename function and add new function.
This commit is contained in:
parent
e37640c44c
commit
71534a1475
|
@ -61,7 +61,7 @@ function photos_init(App $a) {
|
||||||
'$pdesc' => defaults($profile, 'pdesc', ''),
|
'$pdesc' => defaults($profile, 'pdesc', ''),
|
||||||
));
|
));
|
||||||
|
|
||||||
$albums = Photo::photoAlbums($a->data['user']['uid']);
|
$albums = Photo::getAlbums($a->data['user']['uid']);
|
||||||
|
|
||||||
$albums_visible = ((intval($a->data['user']['hidewall']) && !local_user() && !remote_user()) ? false : true);
|
$albums_visible = ((intval($a->data['user']['hidewall']) && !local_user() && !remote_user()) ? false : true);
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ function photos_post(App $a)
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
// Update the photo albums cache
|
// Update the photo albums cache
|
||||||
Photo::photoAlbums($page_owner_uid, true);
|
Photo::clearAlbumCache($page_owner_uid);
|
||||||
|
|
||||||
$newurl = str_replace(bin2hex($album), bin2hex($newalbum), $_SESSION['photo_return']);
|
$newurl = str_replace(bin2hex($album), bin2hex($newalbum), $_SESSION['photo_return']);
|
||||||
goaway($newurl);
|
goaway($newurl);
|
||||||
|
@ -299,7 +299,7 @@ function photos_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the photo albums cache
|
// Update the photo albums cache
|
||||||
Photo::photoAlbums($page_owner_uid, true);
|
Photo::clearAlbumCache($page_owner_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
goaway('photos/' . $a->data['user']['nickname']);
|
goaway('photos/' . $a->data['user']['nickname']);
|
||||||
|
@ -367,7 +367,7 @@ function photos_post(App $a)
|
||||||
$drop_id = intval($i[0]['id']);
|
$drop_id = intval($i[0]['id']);
|
||||||
|
|
||||||
// Update the photo albums cache
|
// Update the photo albums cache
|
||||||
Photo::photoAlbums($page_owner_uid, true);
|
Photo::clearAlbumCache($page_owner_uid);
|
||||||
|
|
||||||
if ($i[0]['visible']) {
|
if ($i[0]['visible']) {
|
||||||
Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id);
|
Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id);
|
||||||
|
@ -471,7 +471,7 @@ function photos_post(App $a)
|
||||||
|
|
||||||
// Update the photo albums cache if album name was changed
|
// Update the photo albums cache if album name was changed
|
||||||
if ($albname !== $origaname) {
|
if ($albname !== $origaname) {
|
||||||
Photo::photoAlbums($page_owner_uid, true);
|
Photo::clearAlbumCache($page_owner_uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -931,13 +931,13 @@ function photos_post(App $a)
|
||||||
|
|
||||||
$item_id = item_store($arr);
|
$item_id = item_store($arr);
|
||||||
// Update the photo albums cache
|
// Update the photo albums cache
|
||||||
Photo::photoAlbums($page_owner_uid, true);
|
Photo::clearAlbumCache($page_owner_uid);
|
||||||
|
|
||||||
if ($visible) {
|
if ($visible) {
|
||||||
Worker::add(PRIORITY_HIGH, "Notifier", 'wall-new', $item_id);
|
Worker::add(PRIORITY_HIGH, "Notifier", 'wall-new', $item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
call_hooks('photo_post_end',intval($item_id));
|
call_hooks('photo_post_end', intval($item_id));
|
||||||
|
|
||||||
// addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
|
// addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
|
||||||
// if they do not wish to be redirected
|
// if they do not wish to be redirected
|
||||||
|
|
|
@ -220,7 +220,7 @@ class Photo
|
||||||
*
|
*
|
||||||
* @return array Returns array of the photo albums
|
* @return array Returns array of the photo albums
|
||||||
*/
|
*/
|
||||||
public static function photoAlbums($uid, $update = false)
|
public static function getAlbums($uid, $update = false)
|
||||||
{
|
{
|
||||||
$sql_extra = permissions_sql($uid);
|
$sql_extra = permissions_sql($uid);
|
||||||
|
|
||||||
|
@ -252,4 +252,14 @@ class Photo
|
||||||
}
|
}
|
||||||
return $albums;
|
return $albums;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $uid User id of the photos
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function clearAlbumCache($uid)
|
||||||
|
{
|
||||||
|
$key = "photo_albums:".$uid.":".local_user().":".remote_user();
|
||||||
|
Cache::set($key, null, CACHE_DAY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,8 @@ class CronJobs
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($r AS $user) {
|
foreach ($r as $user) {
|
||||||
Photo::photoAlbums($user['uid'], true);
|
Photo::clearAlbumCache($user['uid']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue