[ Index ] [ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]

PHP Cross Reference of TXP stable 4.0.6

title

Body

[close]

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

   1  <?php
   2  /*
   3  $HeadURL: http://svn.textpattern.com/releases/4.0.6/source/textpattern/update/_update.php $
   4  $LastChangedRevision: 2792 $
   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      // keep track of updates for svn users
  79      safe_delete('txp_prefs',"name = 'dbupdatetime'");
  80      safe_insert('txp_prefs', "prefs_id=1, name='dbupdatetime',val='".max(newest_file(),time())."', type='2'");
  81      // update version
  82      safe_delete('txp_prefs',"name = 'version'");
  83      safe_insert('txp_prefs', "prefs_id=1, name='version',val='$dbversion', type='2'");
  84      // updated, baby. So let's get the fresh prefs and send them to languages
  85      $event = 'prefs';
  86      $step = 'list_languages';
  87      $prefs = extract(get_prefs());
  88  ?>


Generated: Mon Feb 18 03:42:45 2008 Cross-referenced by PHPXref 0.7