[ Index ]

PHP Cross Reference of Textpattern 4.0.8

title

Body

[close]

/textpattern/update/ -> _update.php (source)

   1  <?php
   2  /*
   3  $HeadURL: https://textpattern.googlecode.com/svn/releases/4.0.8/source/textpattern/update/_update.php $
   4  $LastChangedRevision: 3085 $
   5  */
   6      if (!defined('TXP_UPDATE'))
   7          exit("Nothing here. You can't access this file directly.");
   8      global $txpcfg, $thisversion, $dbversion, $txp_using_svn, $dbupdatetime;
   9  
  10  	function newest_file() {
  11          $newest = 0;
  12          $dp = opendir(txpath.'/update/');
  13          while (false !== ($file = readdir($dp)))
  14          {
  15              if (strpos($file,"_") === 0)
  16                  $newest = max($newest, filemtime(txpath."/update/$file"));
  17          }
  18          closedir($dp);
  19          return $newest;
  20      }
  21  
  22      if ( $txp_using_svn && (newest_file() <= $dbupdatetime) )
  23          return;
  24  
  25      @ignore_user_abort(1);
  26      @set_time_limit(0);
  27  
  28      //Use "ENGINE" if version of MySQL > (4.0.18 or 4.1.2)
  29      // On 4.1 or greater use utf8-tables, if that is configures in config.php
  30      $mysqlversion = mysql_get_server_info();
  31      $tabletype = ( intval($mysqlversion[0]) >= 5 || preg_match('#^4\.(0\.[2-9]|(1[89]))|(1\.[2-9])#',$mysqlversion))
  32                      ? " ENGINE=MyISAM "
  33                      : " TYPE=MyISAM ";
  34      if ( isset($txpcfg['dbcharset']) && (intval($mysqlversion[0]) >= 5 || preg_match('#^4\.[1-9]#',$mysqlversion)))
  35      {
  36          $tabletype .= " CHARACTER SET = ". $txpcfg['dbcharset'] ." ";
  37      }
  38  
  39      // Update to 4.0
  40      if (( $dbversion == '' ) ||
  41          ( strpos($dbversion, 'g1'   ) === 0) ||
  42          ( strpos($dbversion, '1.0rc') === 0) )
  43      {
  44          if ((include txpath.DS.'update'.DS.'_to_1.0.0.php') !== false)
  45              $dbversion = '4.0';
  46      }
  47  
  48      if (version_compare($dbversion, '4.0.2', '<'))
  49      {
  50          if ((include txpath.DS.'update'.DS.'_to_4.0.2.php') !== false)
  51              $dbversion = '4.0.2';
  52      }
  53  
  54      if (version_compare($dbversion, '4.0.3', '<'))
  55      {
  56          if ((include txpath.DS.'update'.DS.'_to_4.0.3.php') !== false)
  57              $dbversion = '4.0.3';
  58      }
  59  
  60      if (version_compare($dbversion, '4.0.4', '<'))
  61      {
  62          if ((include txpath.DS.'update'.DS.'_to_4.0.4.php') !== false)
  63              $dbversion = '4.0.4';
  64      }
  65  
  66      if (version_compare($dbversion, '4.0.5', '<'))
  67      {
  68          if ((include txpath.DS.'update'.DS.'_to_4.0.5.php') !== false)
  69              $dbversion = '4.0.5';
  70      }
  71  
  72      if (version_compare($dbversion, '4.0.6', '<'))
  73      {
  74          if ((include txpath.DS.'update'.DS.'_to_4.0.6.php') !== false)
  75              $dbversion = '4.0.6';
  76      }
  77  
  78      if (version_compare($dbversion, '4.0.7', '<'))
  79      {
  80          if ((include txpath.DS.'update'.DS.'_to_4.0.7.php') !== false)
  81              $dbversion = '4.0.7';
  82      }
  83  
  84      if (version_compare($dbversion, '4.0.8', '<'))
  85      {
  86          if ((include txpath.DS.'update'.DS.'_to_4.0.8.php') !== false)
  87              $dbversion = '4.0.8';
  88      }
  89  
  90      // keep track of updates for svn users
  91      safe_delete('txp_prefs',"name = 'dbupdatetime'");
  92      safe_insert('txp_prefs', "prefs_id=1, name='dbupdatetime',val='".max(newest_file(),time())."', type='2'");
  93      // update version
  94      safe_delete('txp_prefs',"name = 'version'");
  95      safe_insert('txp_prefs', "prefs_id=1, name='version',val='$dbversion', type='2'");
  96      // updated, baby. So let's get the fresh prefs and send them to languages
  97      $event = 'prefs';
  98      $step = 'list_languages';
  99  
 100      $prefs = get_prefs();
 101  
 102      extract($prefs);
 103  
 104  ?>


Generated: Thu May 21 23:03:01 2009 Cross-referenced by PHPXref 0.7