]> git.mxchange.org Git - friendica.git/commitdiff
Add Photo album cache flushes to Friendica Photo endpoints
authorHank Grabowski <hankgrabowski@gmail.com>
Tue, 13 Dec 2022 18:27:23 +0000 (13:27 -0500)
committerHank Grabowski <hankgrabowski@gmail.com>
Tue, 13 Dec 2022 18:27:23 +0000 (13:27 -0500)
src/Module/Api/Friendica/Photo/Create.php
src/Module/Api/Friendica/Photo/Delete.php
src/Module/Api/Friendica/Photo/Update.php
src/Module/Api/Friendica/Photoalbum/Delete.php
src/Module/Api/Friendica/Photoalbum/Update.php

index 868296342a9e13dc422f9b09278f8fa66f11dd79..1f60998b7b5f8d22902a39a48cf2ae3531f89704 100644 (file)
@@ -88,6 +88,7 @@ class Create extends BaseApi
 
                // return success of updating or error message
                if (!empty($photo)) {
+                       Photo::clearAlbumCache($uid);
                        $data = ['photo' => $this->friendicaPhoto->createFromId($photo['resource_id'], null, $uid, $type)];
                        $this->response->exit('photo_create', $data, $this->parameters['extension'] ?? null);
                } else {
index e8dabe3a1fb19fc8413a2ae1a05de2fee371f6d6..64cc2e03aeada7f2ab091ddb01a08b59c041f249 100644 (file)
@@ -60,7 +60,7 @@ class Delete extends BaseApi
                        // to the user and the contacts of the users (drop_items() do all the necessary magic to avoid orphans in database and federate deletion)
                        $condition = ['uid' => $uid, 'resource-id' => $request['photo_id'], 'post-type' => Item::PT_IMAGE, 'origin' => true];
                        Item::deleteForUser($condition, $uid);
-
+                       Photo::clearAlbumCache($uid);
                        $result = ['result' => 'deleted', 'message' => 'photo with id `' . $request['photo_id'] . '` has been deleted from server.'];
                        $this->response->exit('photo_delete', ['$result' => $result], $this->parameters['extension'] ?? null);
                } else {
index 44fd554b090d84968ef8eeaa6b00e0faa49389eb..83ceb7a5c55795c77291e77200879044bde44674 100644 (file)
@@ -135,6 +135,7 @@ class Update extends BaseApi
 
                // return success of updating or error message
                if ($result) {
+                       Photo::clearAlbumCache($uid);
                        $answer = ['result' => 'updated', 'message' => 'Image id `' . $photo_id . '` has been updated.'];
                        $this->response->exit('photo_update', ['$result' => $answer], $this->parameters['extension'] ?? null);
                        return;
index 4215ddda7f8aae84249dfd7f9d21708930ba6eb6..76062b2fdedfe6e7df15fda0e2b607f003b1e7a7 100644 (file)
@@ -66,6 +66,7 @@ class Delete extends BaseApi
 
                // return success of deletion or error message
                if ($result) {
+                       Photo::clearAlbumCache($uid);
                        $answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.'];
                        $this->response->exit('photoalbum_delete', ['$result' => $answer], $this->parameters['extension'] ?? null);
                } else {
index 0eca5b22ee4e55dd41d0bafc97f1338160845a41..3fa01fe1b495b0434128d565e937c63a468bf061 100644 (file)
@@ -58,6 +58,7 @@ class Update extends BaseApi
 
                // return success of updating or error message
                if ($result) {
+                       Photo::clearAlbumCache($uid);
                        $answer = ['result' => 'updated', 'message' => 'album `' . $request['album'] . '` with all containing photos has been renamed to `' . $request['album_new'] . '`.'];
                        $this->response->exit('photoalbum_update', ['$result' => $answer], $this->parameters['extension'] ?? null);
                } else {