aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-03-10 10:50:11 +0000
committerplegall <plg@piwigo.org>2011-03-10 10:50:11 +0000
commit59b87ac06b92aafaee841ec8fdabb3cef8afb956 (patch)
tree3e76c3b0a5ba35632515397d37398a15b6cdcba4 /admin/include
parent3e7a89edb289877af8a756ef9984d07a656e6fb6 (diff)
bug 2218: deactivate non core themes after upgrade
git-svn-id: http://piwigo.org/svn/trunk@9597 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include')
-rw-r--r--admin/include/functions_upgrade.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/admin/include/functions_upgrade.php b/admin/include/functions_upgrade.php
index c8b56740d..4e0bbbb23 100644
--- a/admin/include/functions_upgrade.php
+++ b/admin/include/functions_upgrade.php
@@ -110,6 +110,47 @@ WHERE id IN (\'' . implode('\',\'', $plugins) . '\')
}
}
+// Deactivate all non-standard themes
+function deactivate_non_standard_themes()
+{
+ global $page;
+
+ $standard_themes = array(
+ 'clear',
+ 'Sylvia',
+ 'dark',
+ );
+
+ $query = '
+SELECT
+ id,
+ name
+ FROM '.PREFIX_TABLE.'themes
+ WHERE id NOT IN (\''.implode("','", $standard_themes).'\')
+;';
+ $result = pwg_query($query);
+ $theme_ids = array();
+ $theme_names = array();
+ while ($row = pwg_db_fetch_assoc($result))
+ {
+ array_push($theme_ids, $row['id']);
+ array_push($theme_names, $row['name']);
+ }
+
+ if (!empty($theme_ids))
+ {
+ $query = '
+DELETE
+ FROM '.PREFIX_TABLE.'themes
+ WHERE id IN (\''.implode("','", $theme_ids).'\')
+;';
+ pwg_query($query);
+
+ array_push($page['infos'],
+ l10n('As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:').'<p><i>'.implode(', ', $theme_names).'</i></p>');
+ }
+}
+
// Check access rights
function check_upgrade_access_rights()
{