during upgrade, use the new default Piwigo theme (modus) instead of hardcoded "elegant"

... and make sure the default Piwigo theme is active before that.
This commit is contained in:
plegall
2019-10-08 12:23:54 +02:00
parent 087284eafc
commit 8fe4305d35
3 changed files with 31 additions and 15 deletions
+19 -4
View File
@@ -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);
+8 -8
View File
@@ -1,10 +1,10 @@
<?php
// +-----------------------------------------------------------------------+
// | This file is part of Piwigo. |
// | |
// | For copyright and license information, please view the COPYING.txt |
// | file that was distributed with this source code. |
// +-----------------------------------------------------------------------+
<?php
// +-----------------------------------------------------------------------+
// | This file is part of Piwigo. |
// | |
// | For copyright and license information, please view the COPYING.txt |
// | file that was distributed with this source code. |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
@@ -29,7 +29,7 @@ class updates
{
$this->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)
+4 -3
View File
@@ -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'].'/');