[ Index ]
 

Code source de PunBB 1.2.16

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/extras/ -> mise_a_jour_1-2_a_1-2-16.php (source)

   1  <?php
   2  /***********************************************************************

   3  

   4    Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

   5  

   6    This file is part of PunBB.

   7  

   8    PunBB is free software; you can redistribute it and/or modify it

   9    under the terms of the GNU General Public License as published

  10    by the Free Software Foundation; either version 2 of the License,

  11    or (at your option) any later version.

  12  

  13    PunBB is distributed in the hope that it will be useful, but

  14    WITHOUT ANY WARRANTY; without even the implied warranty of

  15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  16    GNU General Public License for more details.

  17  

  18    You should have received a copy of the GNU General Public License

  19    along with this program; if not, write to the Free Software

  20    Foundation, Inc., 59 Temple Place, Suite 330, Boston,

  21    MA  02111-1307  USA

  22  

  23  ************************************************************************/
  24  
  25  
  26  // Ce script met à jour la base de données des forums de la version 1.2 à la 1.2.16.

  27  // Copiez ce fichier à la racine de vos forums et lancez-le. Ensuite retirez-le

  28  // du répertoire racine quand la mise à jour est terminée.

  29  
  30  
  31  $update_from = array('1.2', '1.2.1', '1.2.2', '1.2.3', '1.2.4', '1.2.5', '1.2.6', '1.2.7', '1.2.8', '1.2.9', '1.2.10', '1.2.11', '1.2.12', '1.2.13', '1.2.14', '1.2.15');
  32  $update_to = '1.2.16';
  33  $update_to_fr = '1.2.16';
  34  
  35  
  36  define('PUN_ROOT', './');
  37  @include PUN_ROOT.'config.php';
  38  
  39  // If PUN isn't defined, config.php is missing or corrupt or we are outside the root directory

  40  if (!defined('PUN'))
  41      exit('Ce fichier doit être lancé depuis le répertoire racine des forums.');
  42  
  43  // Enable debug mode

  44  define('PUN_DEBUG', 1);
  45  
  46  // Disable error reporting for uninitialized variables

  47  error_reporting(E_ERROR | E_WARNING | E_PARSE);
  48  
  49  // Turn off magic_quotes_runtime

  50  set_magic_quotes_runtime(0);
  51  
  52  // Turn off PHP time limit

  53  @set_time_limit(0);
  54  
  55  
  56  // Load the functions script

  57  require  PUN_ROOT.'include/functions.php';
  58  
  59  
  60  // Load DB abstraction layer and try to connect

  61  require  PUN_ROOT.'include/dblayer/common_db.php';
  62  
  63  
  64  // Check current version

  65  $result1 = $db->query('SELECT cur_version FROM '.$db->prefix.'options');
  66  $result2 = $db->query('SELECT conf_value FROM '.$db->prefix.'config WHERE conf_name=\'o_cur_version\'');
  67  $cur_version = ($result1) ? $db->result($result1) : (($result2 && $db->num_rows($result2)) ? $db->result($result2) : 'beta');
  68  
  69  if (!in_array($cur_version, $update_from))
  70      error('Incompatibilité de version. Ce script met à jour de la version '.implode(', ', $update_from).' à la version '.$update_to.'. La base de données \''.$db_name.'\' ne semble pas fonctionnner pour la version voulue.', __FILE__, __LINE__);
  71  
  72  
  73  // Get the forum config

  74  $result = $db->query('SELECT * FROM '.$db->prefix.'config');
  75  while ($cur_config_item = $db->fetch_row($result))
  76      $pun_config[$cur_config_item[0]] = $cur_config_item[1];
  77  
  78  
  79  if (!isset($_POST['form_sent']))
  80  {
  81  
  82  ?>
  83  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  84  
  85  <html dir="ltr">
  86  <head>
  87  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  88  <title>Mise à jour PunBB</title>
  89  <link rel="stylesheet" type="text/css" href="style/Oxygen.css" />
  90  </head>
  91  <body>
  92  
  93  <div id="punwrap">
  94  <div id="puninstall" class="pun" style="margin: 10% 20% auto 20%">
  95  
  96  <div class="blockform">
  97      <h2><span>Mise à jour PunBB</span></h2>
  98      <div class="box">
  99          <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="this.start.disabled=true">
 100              <div><input type="hidden" name="form_sent" value="1" /></div>
 101              <div class="inform">
 102                  <p style="font-size: 1.1em">Ce script va mettre à jour  votre base de données de vos  forums actuellement PunBB <?php echo $cur_version ?> à PunBB <?php echo $update_to ?>. La procédure de mise à jour peut prendre d'une seconde à quelques minutes selon la vitesse du serveur et de la taille de la base de données des forums. N'oubliez pas de réaliser une copie de sauvegarde de votre base de données actuelle avant de continuer.</p>
 103                  <p style="font-size: 1.1em">Avez-vous lu les instructions de mise à jour dans la documentation ? Si ce n'est pas le cas, alors commencez par cela.</p>
 104            </div>
 105              <p><input type="submit" name="start" value="Lancer la mise à jour" /></p>
 106          </form>
 107      </div>
 108  </div>
 109  
 110  </div>
 111  </div>
 112  
 113  </body>
 114  </html>
 115  <?php
 116  
 117  }
 118  else
 119  {
 120      // If we're upgrading from 1.2

 121      if ($cur_version == '1.2')
 122      {
 123          // Insert new config option o_additional_navlinks

 124          $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_additional_navlinks\', NULL)') or error('Unable to alter DB structure.', __FILE__, __LINE__, $db->error());
 125      }
 126  
 127      // We need to add a unique index to avoid users having multiple rows in the online table

 128      if ($db_type == 'mysql' || $db_type == 'mysqli')
 129      {
 130          $result = $db->query('SHOW INDEX FROM '.$db->prefix.'online') or error('Unable to check DB structure.', __FILE__, __LINE__, $db->error());
 131  
 132          if ($db->num_rows($result) == 1)
 133              $db->query('ALTER TABLE '.$db->prefix.'online ADD UNIQUE INDEX '.$db->prefix.'online_user_id_ident_idx(user_id,ident)') or error('Unable to alter DB structure.', __FILE__, __LINE__, $db->error());
 134      }
 135  
 136      // This feels like a good time to synchronize the forums

 137      $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum info.', __FILE__, __LINE__, $db->error());
 138  
 139      while ($row = $db->fetch_row($result))
 140          update_forum($row[0]);
 141  
 142  
 143      // We'll empty the search cache table as well (using DELETE FROM since SQLite does not support TRUNCATE TABLE)

 144      $db->query('DELETE FROM '.$db->prefix.'search_cache') or error('Unable to flush search results.', __FILE__, __LINE__, $db->error());
 145  
 146  
 147      // Finally, we update the official version number

 148      $db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$update_to.'\' WHERE conf_name=\'o_cur_version\'') or error('Unable to update version.', __FILE__, __LINE__, $db->error());
 149  
 150  
 151      // Special french version, update french version number

 152      if (isset($pun_config['o_cur_version_fr']))
 153          $db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$update_to_fr.'\' WHERE conf_name=\'o_cur_version_fr\'') or error('Unable to update french number version.', __FILE__, __LINE__, $db->error());    
 154      else
 155          $db->query('INSERT INTO '.$db_prefix.'config (conf_name, conf_value) VALUES(\'o_cur_version_fr\', \''.$update_to_fr.'\')') or error('Impossible d\'insérer dans la table '.$db_prefix.'config.');
 156  
 157  
 158      // Delete all .php files in the cache (someone might have visited the forums while we were updating and thus, generated incorrect cache files)

 159      $d = dir(PUN_ROOT.'cache');
 160      while (($entry = $d->read()) !== false)
 161      {
 162          if (substr($entry, strlen($entry)-4) == '.php')
 163              @unlink(PUN_ROOT.'cache/'.$entry);
 164      }
 165      $d->close();
 166  
 167  ?>
 168  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 169  
 170  <html dir="ltr">
 171  <head>
 172  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 173  <title>Mise à jour PunBB</title>
 174  <link rel="stylesheet" type="text/css" href="style/Oxygen.css" />
 175  </head>
 176  <body>
 177  
 178  <div id="punwrap">
 179  <div id="puninstall" class="pun" style="margin: 10% 20% auto 20%">
 180  
 181  <div class="block">
 182      <h2><span>Mise à jour terminée</span></h2>
 183      <div class="box">
 184          <div class="inbox">
 185              <p>Mise à jour réussie ! Votre base de données des forums a maintenant été mise à jour à la version <?php echo $update_to ?>. Vous pouvez maintenant retirer ce script de la racine de vos forums et suivre la suite des instructions de la documentation.</p>
 186          </div>
 187      </div>
 188  </div>
 189  
 190  </div>
 191  </div>
 192  
 193  </body>
 194  </html>
 195  <?php
 196  
 197  }


Généré le : Sat Nov 24 22:44:38 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics