From bc4acec569ca5629deba162a9931a72d9adc77e1 Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 24 Jul 2025 21:29:38 +0200 Subject: [PATCH] issue #2390 warn about duplicate paths --- admin/include/functions.php | 24 ++++++++++++++++++++++++ language/en_UK/admin.lang.php | 1 + language/fr_FR/admin.lang.php | 1 + 3 files changed, 26 insertions(+) diff --git a/admin/include/functions.php b/admin/include/functions.php index 71b3c2706..654ce4515 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -3636,6 +3636,30 @@ SELECT return; } } + + // search for duplicate paths + $query = ' +SELECT + path + FROM '.IMAGES_TABLE.' + GROUP BY path + HAVING COUNT(*) > 1 +;'; + $duplicate_paths = query2array($query); + + if (count($duplicate_paths) > 0) + { + global $template; + + $template->assign( + 'header_msgs', + array( + l10n('We have found %d duplicate paths. Details provided by plugin Check Uploads', count($duplicate_paths)), + ) + ); + + return; + } } /** diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index b229ebc8b..5ab96daf5 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -1410,5 +1410,6 @@ $lang['Welcome to %s'] = 'Welcome to %s'; $lang['Save all photos'] = 'Save all photos'; $lang['Use standard Piwigo template for common pages.'] = 'Use standard Piwigo template for common pages.'; $lang['When enabled, a common template is used for the login, registration and forgotten password pages, regardless of the theme. Some themes might use these templates even if you uncheck this option'] = 'When enabled, a common template is used for the login, registration and forgotten password pages, regardless of the theme. Some themes might use these templates even if you uncheck this option'; +$lang['We have found %d duplicate paths. Details provided by plugin Check Uploads'] = 'We have found %d duplicate paths. Details provided by plugin Check Uploads'; // Leave this line empty \ No newline at end of file diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index 75144e438..2b0d5b94e 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -1412,4 +1412,5 @@ $lang['Welcome to %s'] = 'Bienvenue sur %s'; $lang['Save all photos'] = 'Enregistrer toutes les photos'; $lang['Use standard Piwigo template for common pages.'] = 'Utiliser le modèle standard de Piwigo pour les pages courantes.'; $lang['When enabled, a common template is used for the login, registration and forgotten password pages, regardless of the theme. Some themes might use these templates even if you uncheck this option'] = 'Lorsque cette option est activée, un modèle commun est utilisé pour les pages de connexion, d\'inscription et de mot de passe oublié, quel que soit le thème. Certains thèmes peuvent utiliser ces modèles même si cette option est décochée.'; +$lang['We have found %d duplicate paths. Details provided by plugin Check Uploads'] = 'Nous avons trouvé %d chemins anormalement dupliqués. À contrôler avec le plugin Check Uploads.'; // Leave this line empty