aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
Diffstat (limited to 'admin/include')
-rw-r--r--admin/include/functions.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 7d29f5734..5cd44b31d 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -2775,4 +2775,22 @@ SELECT CONCAT(
}
return $keys;
+}
+
+/**
+ * Return the list of image ids associated to no album
+ *
+ * @return int[] $image_ids
+ */
+function get_orphans()
+{
+ $query = '
+SELECT
+ id
+ FROM '.IMAGES_TABLE.'
+ LEFT JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
+ WHERE category_id is null
+;';
+
+ return query2array($query, null, 'id');
} \ No newline at end of file