Changeset 10425 for branches/2.2/admin


Ignore:
Timestamp:
Apr 16, 2011, 7:40:29 PM (13 years ago)
Author:
plg
Message:

bug 2242 fixed: default theme is changed if upgrade.php deactivated the previous theme.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/admin/include/functions_upgrade.php

    r9597 r10425  
    114114function deactivate_non_standard_themes()
    115115{
    116   global $page;
     116  global $page, $conf;
    117117
    118118  $standard_themes = array(
     
    149149    array_push($page['infos'],
    150150      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>');
     151
     152    // what is the default theme?
     153    $query = '
     154SELECT theme
     155  FROM '.PREFIX_TABLE.'user_infos
     156  WHERE user_id = '.$conf['default_user_id'].'
     157;';
     158    list($default_theme) = pwg_db_fetch_row(pwg_query($query));
     159
     160    // if the default theme has just been deactivated, let's set another core theme as default
     161    if (in_array($default_theme, $theme_ids))
     162    {
     163      $query = '
     164UPDATE '.PREFIX_TABLE.'user_infos
     165  SET theme = \'Sylvia\'
     166  WHERE user_id = '.$conf['default_user_id'].'
     167;';
     168      pwg_query($query);
     169    }
    151170  }
    152171}
Note: See TracChangeset for help on using the changeset viewer.