aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-10-09 20:34:35 +0200
committerplegall <plg@piwigo.org>2015-10-09 20:34:35 +0200
commit11ccdff58523d10ccc970b879c5de01e7ec40ee2 (patch)
tree93bb4b59fd1c70980645422bc24cc2cc1cb46027 /admin/include
parent4bf7792c779ee2312de59366afb38f666d49ce46 (diff)
parent474942e62d283e392262082a0f544c8b30b17c4c (diff)
Merge branch 'feature/357-orphans'
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