aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-03-10 10:50:11 +0000
committerplegall <plg@piwigo.org>2011-03-10 10:50:11 +0000
commit59b87ac06b92aafaee841ec8fdabb3cef8afb956 (patch)
tree3e76c3b0a5ba35632515397d37398a15b6cdcba4
parent3e7a89edb289877af8a756ef9984d07a656e6fb6 (diff)
bug 2218: deactivate non core themes after upgrade
git-svn-id: http://piwigo.org/svn/trunk@9597 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/include/functions_upgrade.php41
-rw-r--r--language/de_DE/upgrade.lang.php3
-rw-r--r--language/en_UK/upgrade.lang.php1
-rw-r--r--language/fr_FR/upgrade.lang.php1
-rw-r--r--upgrade.php2
5 files changed, 47 insertions, 1 deletions
diff --git a/admin/include/functions_upgrade.php b/admin/include/functions_upgrade.php
index c8b56740d..4e0bbbb23 100644
--- a/admin/include/functions_upgrade.php
+++ b/admin/include/functions_upgrade.php
@@ -110,6 +110,47 @@ WHERE id IN (\'' . implode('\',\'', $plugins) . '\')
}
}
+// Deactivate all non-standard themes
+function deactivate_non_standard_themes()
+{
+ global $page;
+
+ $standard_themes = array(
+ 'clear',
+ 'Sylvia',
+ 'dark',
+ );
+
+ $query = '
+SELECT
+ id,
+ name
+ FROM '.PREFIX_TABLE.'themes
+ WHERE id NOT IN (\''.implode("','", $standard_themes).'\')
+;';
+ $result = pwg_query($query);
+ $theme_ids = array();
+ $theme_names = array();
+ while ($row = pwg_db_fetch_assoc($result))
+ {
+ array_push($theme_ids, $row['id']);
+ array_push($theme_names, $row['name']);
+ }
+
+ if (!empty($theme_ids))
+ {
+ $query = '
+DELETE
+ FROM '.PREFIX_TABLE.'themes
+ WHERE id IN (\''.implode("','", $theme_ids).'\')
+;';
+ pwg_query($query);
+
+ array_push($page['infos'],
+ 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>');
+ }
+}
+
// Check access rights
function check_upgrade_access_rights()
{
diff --git a/language/de_DE/upgrade.lang.php b/language/de_DE/upgrade.lang.php
index 78a193b49..378ef1bc6 100644
--- a/language/de_DE/upgrade.lang.php
+++ b/language/de_DE/upgrade.lang.php
@@ -38,4 +38,5 @@ $lang['This page proposes to upgrade your database corresponding to your old ver
Der Upgradeassistent ist der Meinung sie haben folgende Version installiert <strong>release %s</strong> (oder identisch).';
$lang['As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:'] = 'Als Vorsichtsmaßnahme wurden folgende Plugins abgeschaltet. Prüfen Sie, ob ein Pluginupdate verfügbar ist, bevor Sie diese wieder aktivieren:';
$lang['In <i>%s</i>, before <b>?></b>, insert:'] = 'In der Datei <i>%s</i>, vor <b>?></b> folgendes einfügen:';
-?>
+$lang['As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:'] = 'Als Vorsichtsmaßnahme wurden folgende Themen abgeschaltet. Prüfen Sie, ob ein Pluginupdate verfügbar ist, bevor Sie diese wieder aktivieren:';
+?> \ No newline at end of file
diff --git a/language/en_UK/upgrade.lang.php b/language/en_UK/upgrade.lang.php
index 206f04985..e0dcaf5b4 100644
--- a/language/en_UK/upgrade.lang.php
+++ b/language/en_UK/upgrade.lang.php
@@ -39,4 +39,5 @@ $lang['All sub-albums of private albums become private'] = "All sub-albums of pr
$lang['User permissions and group permissions have been erased'] = "Users and groups permissions have been erased";
$lang['Only thumbnails prefix and webmaster mail address have been saved from previous configuration'] = "Only thumbnails prefix and webmaster mail address have been saved from previous configuration";
$lang['In <i>%s</i>, before <b>?></b>, insert:'] = 'In <i>%s</i>, before <b>?></b>, insert:';
+$lang['As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:'] = 'As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:';
?>
diff --git a/language/fr_FR/upgrade.lang.php b/language/fr_FR/upgrade.lang.php
index 10b928e18..0f8189c52 100644
--- a/language/fr_FR/upgrade.lang.php
+++ b/language/fr_FR/upgrade.lang.php
@@ -40,4 +40,5 @@ $lang['All sub-albums of private albums become private'] = 'Toutes les sous-albu
$lang['User permissions and group permissions have been erased'] = "Les permissions des utilisateurs et des groupes ont été effacées";
$lang['Only thumbnails prefix and webmaster mail address have been saved from previous configuration'] = "Seuls le préfixe des miniatures et l'adresse email du webmestre ont étés conservés de la précédente configuration";
$lang['In <i>%s</i>, before <b>?></b>, insert:'] = 'Dans le fichier <i>%s</i>, avant <b>?></b>, insérez:';
+$lang['As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:'] = 'Par précaution, les thèmes suivants ont été désactivés. Vérifiez s\'il existe des mises à jour avant de les réactiver:';
?> \ No newline at end of file
diff --git a/upgrade.php b/upgrade.php
index 0ded5e815..64f81964f 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -340,6 +340,8 @@ if ((isset($_POST['submit']) or isset($_GET['now']))
deactivate_non_standard_plugins();
}
+ deactivate_non_standard_themes();
+
$page['upgrade_end'] = get_moment();
$template->assign(