Index: /trunk/admin/include/functions_upgrade.php
===================================================================
--- /trunk/admin/include/functions_upgrade.php	(revision 9596)
+++ /trunk/admin/include/functions_upgrade.php	(revision 9597)
@@ -111,4 +111,45 @@
 }
 
+// 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()
Index: /trunk/language/de_DE/upgrade.lang.php
===================================================================
--- /trunk/language/de_DE/upgrade.lang.php	(revision 9596)
+++ /trunk/language/de_DE/upgrade.lang.php	(revision 9597)
@@ -39,3 +39,4 @@
 $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:';
 ?>
Index: /trunk/language/en_UK/upgrade.lang.php
===================================================================
--- /trunk/language/en_UK/upgrade.lang.php	(revision 9596)
+++ /trunk/language/en_UK/upgrade.lang.php	(revision 9597)
@@ -40,3 +40,4 @@
 $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:';
 ?>
Index: /trunk/language/fr_FR/upgrade.lang.php
===================================================================
--- /trunk/language/fr_FR/upgrade.lang.php	(revision 9596)
+++ /trunk/language/fr_FR/upgrade.lang.php	(revision 9597)
@@ -41,3 +41,4 @@
 $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:';
 ?>
Index: /trunk/upgrade.php
===================================================================
--- /trunk/upgrade.php	(revision 9596)
+++ /trunk/upgrade.php	(revision 9597)
@@ -340,4 +340,6 @@
       deactivate_non_standard_plugins();
     }
+
+    deactivate_non_standard_themes();
 
     $page['upgrade_end'] = get_moment();
