Changeset 9597 for trunk/admin/include


Ignore:
Timestamp:
Mar 10, 2011, 11:50:11 AM (13 years ago)
Author:
plg
Message:

bug 2218: deactivate non core themes after upgrade

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_upgrade.php

    r8728 r9597  
    111111}
    112112
     113// Deactivate all non-standard themes
     114function deactivate_non_standard_themes()
     115{
     116  global $page;
     117
     118  $standard_themes = array(
     119    'clear',
     120    'Sylvia',
     121    'dark',
     122    );
     123
     124  $query = '
     125SELECT
     126    id,
     127    name
     128  FROM '.PREFIX_TABLE.'themes
     129  WHERE id NOT IN (\''.implode("','", $standard_themes).'\')
     130;';
     131  $result = pwg_query($query);
     132  $theme_ids = array();
     133  $theme_names = array();
     134  while ($row = pwg_db_fetch_assoc($result))
     135  {
     136    array_push($theme_ids, $row['id']);
     137    array_push($theme_names, $row['name']);
     138  }
     139
     140  if (!empty($theme_ids))
     141  {
     142    $query = '
     143DELETE
     144  FROM '.PREFIX_TABLE.'themes
     145  WHERE id IN (\''.implode("','", $theme_ids).'\')
     146;';
     147    pwg_query($query);
     148
     149    array_push($page['infos'],
     150      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}
     153
    113154// Check access rights
    114155function check_upgrade_access_rights()
Note: See TracChangeset for help on using the changeset viewer.