Skip to content
Permalink
Browse files

during upgrade, use the new default Piwigo theme (modus) instead of h…

…ardcoded "elegant"

... and make sure the default Piwigo theme is active before that.
  • Loading branch information...
plegall committed Oct 8, 2019
1 parent 087284e commit 8fe4305d356d763827ee9c3f52981a59b6afe9d5
Showing with 31 additions and 15 deletions.
  1. +19 −4 admin/include/functions_upgrade.php
  2. +8 −8 admin/include/updates.class.php
  3. +4 −3 include/constants.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 @@ function deactivate_non_standard_themes()
// 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);
@@ -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 @@ function __construct($page='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)
@@ -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'].'/');

0 comments on commit 8fe4305

Please sign in to comment.
You can’t perform that action at this time.