aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php28
-rw-r--r--admin/maintenance.php9
-rw-r--r--admin/themes/default/template/maintenance.tpl1
-rw-r--r--language/en_UK/admin.lang.php1
-rw-r--r--language/fr_FR/admin.lang.php2
5 files changed, 40 insertions, 1 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index c1a3db22c..03bce26cc 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -485,6 +485,34 @@ SELECT DISTINCT id
}
/**
+ * check and repair images integrity
+ *
+ * TODO see delete_elements function to check all linked tables
+ */
+function images_integrity()
+{
+ $query = '
+SELECT
+ image_id
+ FROM '.IMAGE_CATEGORY_TABLE.'
+ LEFT JOIN '.IMAGES_TABLE.' ON id = image_id
+ WHERE id IS NULL
+;';
+ $result = pwg_query($query);
+ $orphan_image_ids = array_from_query($query, 'image_id');
+
+ if (count($orphan_image_ids) > 0)
+ {
+ $query = '
+DELETE
+ FROM '.IMAGE_CATEGORY_TABLE.'
+ WHERE image_id IN ('.implode(',', $orphan_image_ids).')
+;';
+ pwg_query($query);
+ }
+}
+
+/**
* returns an array containing sub-directories which can be a category,
* recursive by default
*
diff --git a/admin/maintenance.php b/admin/maintenance.php
index 22561c39c..5b99bf969 100644
--- a/admin/maintenance.php
+++ b/admin/maintenance.php
@@ -62,6 +62,7 @@ switch ($action)
}
case 'categories' :
{
+ images_integrity();
update_uppercats();
update_category('all');
update_global_rank();
@@ -70,9 +71,11 @@ switch ($action)
}
case 'images' :
{
+ images_integrity();
update_path();
include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
update_rating_score();
+ invalidate_user_cache();
break;
}
case 'delete_orphan_tags' :
@@ -80,6 +83,11 @@ switch ($action)
delete_orphan_tags();
break;
}
+ case 'user_cache' :
+ {
+ invalidate_user_cache();
+ break;
+ }
case 'history_detail' :
{
$query = '
@@ -171,6 +179,7 @@ $template->assign(
'U_MAINT_CATEGORIES' => sprintf($url_format, 'categories'),
'U_MAINT_IMAGES' => sprintf($url_format, 'images'),
'U_MAINT_ORPHAN_TAGS' => sprintf($url_format, 'delete_orphan_tags'),
+ 'U_MAINT_USER_CACHE' => sprintf($url_format, 'user_cache'),
'U_MAINT_HISTORY_DETAIL' => sprintf($url_format, 'history_detail'),
'U_MAINT_HISTORY_SUMMARY' => sprintf($url_format, 'history_summary'),
'U_MAINT_SESSIONS' => sprintf($url_format, 'sessions'),
diff --git a/admin/themes/default/template/maintenance.tpl b/admin/themes/default/template/maintenance.tpl
index c17b2dccf..257adae01 100644
--- a/admin/themes/default/template/maintenance.tpl
+++ b/admin/themes/default/template/maintenance.tpl
@@ -27,6 +27,7 @@
</ul>
<ul>
+ <li><a href="{$U_MAINT_USER_CACHE}">{'Purge user cache'|@translate}</a></li>
<li><a href="{$U_MAINT_ORPHAN_TAGS}">{'Delete orphan tags'|@translate}</a></li>
<li><a href="{$U_MAINT_HISTORY_DETAIL}" onclick="return confirm('{'Purge history detail'|@translate|@escape:'javascript'}');">{'Purge history detail'|@translate}</a></li>
<li><a href="{$U_MAINT_HISTORY_SUMMARY}" onclick="return confirm('{'Purge history summary'|@translate|@escape:'javascript'}');">{'Purge history summary'|@translate}</a></li>
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index 0bd4d29c4..9aaeae9d2 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -947,4 +947,5 @@ $lang['Your configuration settings are saved'] = 'Your configuration settings ar
$lang['Zoom'] = 'Zoom';
$lang['[%s] Visit album %s'] = "[%s] Visit album %s";
$lang['[NBM] Problems or questions'] = "[NBM] Problems or questions";
+$lang['Purge user cache'] = 'Purge user cache';
?> \ No newline at end of file
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index e24116ec8..209cc9b88 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -949,5 +949,5 @@ $lang['This group will be set to default'] = "Ce groupe deviendra par défaut";
$lang['This group will be unset to default'] = "Ce groupe ne sera plus par défaut";
$lang['No members to manage'] = "Aucun membre à gérer";
$lang['Rename'] = 'Renommer';
-
+$lang['Purge user cache'] = 'Purger le cache utilisateur';
?> \ No newline at end of file