Merge pull request #3046 from rabuzarus/2016125_-_photo_albums_refresh
Update the photo albums cache on upload, album deletion or renaming
This commit is contained in:
commit
c348dd6134
2 changed files with 22 additions and 4 deletions
|
@ -208,6 +208,9 @@ function photos_post(&$a) {
|
||||||
dbesc($album),
|
dbesc($album),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
|
// Update the photo albums cache
|
||||||
|
photo_albums($page_owner_uid, true);
|
||||||
|
|
||||||
$newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']);
|
$newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']);
|
||||||
goaway($newurl);
|
goaway($newurl);
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
|
@ -294,7 +297,11 @@ function photos_post(&$a) {
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the photo albums cache
|
||||||
|
photo_albums($page_owner_uid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
goaway('photos/' . $a->data['user']['nickname']);
|
goaway('photos/' . $a->data['user']['nickname']);
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -359,6 +366,9 @@ function photos_post(&$a) {
|
||||||
$url = App::get_baseurl();
|
$url = App::get_baseurl();
|
||||||
$drop_id = intval($i[0]['id']);
|
$drop_id = intval($i[0]['id']);
|
||||||
|
|
||||||
|
// Update the photo albums cache
|
||||||
|
photo_albums($page_owner_uid, true);
|
||||||
|
|
||||||
if ($i[0]['visible'])
|
if ($i[0]['visible'])
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||||
}
|
}
|
||||||
|
@ -370,10 +380,11 @@ function photos_post(&$a) {
|
||||||
|
|
||||||
if (($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
|
if (($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
|
||||||
|
|
||||||
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
|
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
|
||||||
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
|
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
|
||||||
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
|
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
|
||||||
$albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
|
$albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
|
||||||
|
$origaname = ((x($_POST,'origaname')) ? notags(trim($_POST['origaname'])) : '');
|
||||||
$str_group_allow = perms2str($_POST['group_allow']);
|
$str_group_allow = perms2str($_POST['group_allow']);
|
||||||
$str_contact_allow = perms2str($_POST['contact_allow']);
|
$str_contact_allow = perms2str($_POST['contact_allow']);
|
||||||
$str_group_deny = perms2str($_POST['group_deny']);
|
$str_group_deny = perms2str($_POST['group_deny']);
|
||||||
|
@ -457,6 +468,10 @@ function photos_post(&$a) {
|
||||||
dbesc($resource_id),
|
dbesc($resource_id),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
|
// Update the photo albums cache if album name was changed
|
||||||
|
if ($albname !== $origaname) {
|
||||||
|
photo_albums($page_owner_uid, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't make the item visible if the only change was the album name */
|
/* Don't make the item visible if the only change was the album name */
|
||||||
|
@ -913,6 +928,8 @@ function photos_post(&$a) {
|
||||||
. '[/url]';
|
. '[/url]';
|
||||||
|
|
||||||
$item_id = item_store($arr);
|
$item_id = item_store($arr);
|
||||||
|
// Update the photo albums cache
|
||||||
|
photo_albums($page_owner_uid, true);
|
||||||
|
|
||||||
if ($visible)
|
if ($visible)
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<form action="photos/{{$nickname}}/{{$resource_id}}" method="post" id="photo_edit_form" >
|
<form action="photos/{{$nickname}}/{{$resource_id}}" method="post" id="photo_edit_form" >
|
||||||
|
|
||||||
<input type="hidden" name="item_id" value="{{$item_id}}" />
|
<input type="hidden" name="item_id" value="{{$item_id}}" />
|
||||||
|
<input type="hidden" name="origaname" value="{{$album.2}}" />
|
||||||
|
|
||||||
{{include file="field_input.tpl" field=$album}}
|
{{include file="field_input.tpl" field=$album}}
|
||||||
{{include file="field_input.tpl" field=$caption}}
|
{{include file="field_input.tpl" field=$caption}}
|
||||||
|
|
Loading…
Reference in a new issue