diff --git a/admin/include/functions_upgrade.php b/admin/include/functions_upgrade.php index 8581527cc..e36960dcd 100644 --- a/admin/include/functions_upgrade.php +++ b/admin/include/functions_upgrade.php @@ -100,9 +100,7 @@ function deactivate_non_standard_themes() global $page, $conf; $standard_themes = array( - 'clear', - 'Sylvia', - 'dark', + 'modus', 'elegant', 'smartpocket', ); @@ -146,9 +144,26 @@ SELECT theme // if the default theme has just been deactivated, let's set another core theme as default if (in_array($default_theme, $theme_ids)) { + // make sure default Piwigo theme is active + $query = ' +SELECT + COUNT(*) + FROM '.PREFIX_TABLE.'themes + WHERE id = \''.PHPWG_DEFAULT_TEMPLATE.'\' +;'; + list($counter) = pwg_db_fetch_row(pwg_query($query)); + if ($counter < 1) + { + // we need to activate theme first + include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php'); + $themes = new themes(); + $themes->perform_action('activate', PHPWG_DEFAULT_TEMPLATE); + } + + // then associate it to default user $query = ' UPDATE '.PREFIX_TABLE.'user_infos - SET theme = \'elegant\' + SET theme = \''.PHPWG_DEFAULT_TEMPLATE.'\' WHERE user_id = '.$conf['default_user_id'].' ;'; pwg_query($query); diff --git a/admin/include/updates.class.php b/admin/include/updates.class.php index 82d52e1bb..294917375 100644 --- a/admin/include/updates.class.php +++ b/admin/include/updates.class.php @@ -1,10 +1,10 @@ -types = array($page); } - $this->default_themes = array('clear', 'dark', 'Sylvia', 'elegant', 'smartpocket'); + $this->default_themes = array('modus', 'elegant', 'smartpocket'); $this->default_plugins = array('AdminTools', 'TakeATour', 'language_switch', 'LocalFilesEditor'); foreach ($this->types as $type) diff --git a/include/constants.php b/include/constants.php index 844356c10..8c43a4521 100644 --- a/include/constants.php +++ b/include/constants.php @@ -9,9 +9,10 @@ // Default settings define('PHPWG_VERSION', '2.10.0'); define('PHPWG_DEFAULT_LANGUAGE', 'en_UK'); -// this constant is actually never used, the true default theme is the theme or user "guest", -// which is initialized with column user_infos.theme default value -// (see file install/piwigo_structure-mysql.sql) + +// this constant is only used in the upgrade process, the true default theme +// is the theme of user "guest", which is initialized with column user_infos.theme +// default value (see file install/piwigo_structure-mysql.sql) define('PHPWG_DEFAULT_TEMPLATE', 'modus'); define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/');