aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2008-11-19 20:06:20 +0000
committerrub <rub@piwigo.org>2008-11-19 20:06:20 +0000
commit487ba19c94efce6baee8ac1670e197f369f2abf1 (patch)
treea19a75f1ba051bcea823c59a79ce3f2a507126d1
parentbac95a7c7f802b508d2752fed5dcdeb79d561108 (diff)
Delete caches and optimize tables on upgrade
merge -c2890 from trunk to branch 2.0 The exact copy of commit log in 2890. git-svn-id: http://piwigo.org/svn/branches/2.0@2891 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php20
-rw-r--r--admin/maintenance.php2
-rw-r--r--upgrade.php10
3 files changed, 25 insertions, 7 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index d7369ddf0..764f7b97c 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1762,12 +1762,24 @@ function pwg_URL()
/**
* Invalidates cahed data (permissions and category counts) for all users.
*/
-function invalidate_user_cache()
+function invalidate_user_cache($full = true)
{
- $query = '
+ if ($full)
+ {
+ $query = '
+TRUNCATE TABLE '.USER_CACHE_CATEGORIES_TABLE.';';
+ pwg_query($query);
+ $query = '
+TRUNCATE TABLE '.USER_CACHE_TABLE.';';
+ pwg_query($query);
+ }
+ else
+ {
+ $query = '
UPDATE '.USER_CACHE_TABLE.'
- SET need_update = \'true\'';
- pwg_query($query);
+ SET need_update = \'true\';';
+ pwg_query($query);
+ }
trigger_action('invalidate_user_cache');
}
diff --git a/admin/maintenance.php b/admin/maintenance.php
index 946fcf916..56f9b592b 100644
--- a/admin/maintenance.php
+++ b/admin/maintenance.php
@@ -46,7 +46,7 @@ switch ($action)
update_uppercats();
update_category('all');
update_global_rank();
- invalidate_user_cache();
+ invalidate_user_cache(true);
break;
}
case 'images' :
diff --git a/upgrade.php b/upgrade.php
index 20ab360da..97e1b5247 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -298,8 +298,6 @@ if (isset($_POST['submit']) and check_upgrade())
l10n('perform a maintenance check')
);
- invalidate_user_cache();
-
// c13y_upgrade plugin means "check integrity after upgrade", so it
// becomes useful just after an upgrade
$query = '
@@ -308,6 +306,14 @@ REPLACE INTO '.PLUGINS_TABLE.'
VALUES (\'c13y_upgrade\', \'active\')
;';
pwg_query($query);
+
+ // Delete cache data
+ invalidate_user_cache(true);
+ $template->delete_compiled_templates();
+
+ // Tables Maintenance
+ do_maintenance_all_tables();
+
}
}