File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,21 @@ private function getNewPreviewLocations(): \Iterator {
128128 */
129129 $ like = $ this ->connection ->escapeLikeParameter ($ data ['path ' ]) . '/_/_/_/_/_/_/_/% ' ;
130130
131+ /*
132+ * Deleting a file will not delete related previews right away.
133+ *
134+ * A delete request is usually an HTTP request.
135+ * The preview deleting is done by a background job to avoid timeouts.
136+ *
137+ * Previews for a file are stored within a folder in appdata_/preview using the fileid as folder name.
138+ * Preview folders in oc_filecache are identified by a.storage, a.path (cf. $like) and a.mimetype.
139+ *
140+ * To find preview folders to delete, we query oc_filecache for a preview folder in app data, matching the preview folder structure
141+ * and use the name to left join oc_filecache on a.name = b.fileid. A left join returns all rows from the left table (a),
142+ * even if there are no matches in the right table (b).
143+ *
144+ * If the related file is deleted, b.fileid will be null and the preview folder can be deleted.
145+ */
131146 $ qb = $ this ->connection ->getQueryBuilder ();
132147 $ qb ->select ('a.name ' )
133148 ->from ('filecache ' , 'a ' )
You can’t perform that action at this time.
0 commit comments