aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions_upgrade.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-04-16 17:40:29 +0000
committerplegall <plg@piwigo.org>2011-04-16 17:40:29 +0000
commitbc1cf1e4201eac68edbf4f8f6887604ee23c38de (patch)
treeafc6d16a90d96adedddee46f68348be42f2196d3 /admin/include/functions_upgrade.php
parentd63e8ca58804005841c9148993b69f9d3732d829 (diff)
bug 2242 fixed: default theme is changed if upgrade.php deactivated the previous theme.
git-svn-id: http://piwigo.org/svn/branches/2.2@10425 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include/functions_upgrade.php')
-rw-r--r--admin/include/functions_upgrade.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/admin/include/functions_upgrade.php b/admin/include/functions_upgrade.php
index 4e0bbbb23..7db6cf40e 100644
--- a/admin/include/functions_upgrade.php
+++ b/admin/include/functions_upgrade.php
@@ -113,7 +113,7 @@ WHERE id IN (\'' . implode('\',\'', $plugins) . '\')
// Deactivate all non-standard themes
function deactivate_non_standard_themes()
{
- global $page;
+ global $page, $conf;
$standard_themes = array(
'clear',
@@ -148,6 +148,25 @@ DELETE
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>');
+
+ // what is the default theme?
+ $query = '
+SELECT theme
+ FROM '.PREFIX_TABLE.'user_infos
+ WHERE user_id = '.$conf['default_user_id'].'
+;';
+ list($default_theme) = pwg_db_fetch_row(pwg_query($query));
+
+ // if the default theme has just been deactivated, let's set another core theme as default
+ if (in_array($default_theme, $theme_ids))
+ {
+ $query = '
+UPDATE '.PREFIX_TABLE.'user_infos
+ SET theme = \'Sylvia\'
+ WHERE user_id = '.$conf['default_user_id'].'
+;';
+ pwg_query($query);
+ }
}
}