install
[ class tree: install ] [ index: install ] [ all elements ]

Source for file upgrade_packages.php

Documentation is available at upgrade_packages.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package install
  5.  * @subpackage upgrade
  6.  */
  7.  
  8. // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  9. // All Rights Reserved. See below for details and a complete list of authors.
  10. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  11.  
  12. $gBitSmarty->assign( 'next_step',$step );
  13. $config_file = empty($_SERVER['CONFIG_INC']) ? '../config/kernel/config_inc.php' : $_SERVER['CONFIG_INC'];
  14.  
  15. // set the maximum execution time to very high
  16. ini_set( "max_execution_time", "86400" );
  17.  
  18. /**
  19.  * required setup
  20.  */
  21. include_once( $config_file ); // relative, but we know we are in the installer here...
  22. $gBitInstaller->scanPackages( 'admin/upgrade_inc.php' );
  23.  
  24. // get some nice R1 to R2 specific upgrade info on the screen - should keep users happy...
  25. if( !empty( $_SESSION['upgrade_r1'] ) ) {
  26.     if( $rs = $gBitSystem->mDb->query( "SELECT `name` ,`value` FROM `" . BIT_DB_PREFIX . "tiki_preferences`" ) ) {
  27.         while( $row = $rs->fetchRow() ) {
  28.             $oldPrefs[$row['name']] = $row['value'];
  29.         }
  30.     }
  31.     foreach( array_keys( $gBitSystem->mPackages ) as $package ) {
  32.         if( @$oldPrefs['package_'.$package] == 'y' ) {
  33.             $upgrading[] = $package;
  34.         }
  35.     }
  36.     asort( $upgrading );
  37.     $gBitSmarty->assign( 'upgrading', $upgrading );
  38. }
  39.  
  40. $upgradePath = array (
  41.     'TikiWiki 1.8' => array(
  42.         'TIKIWIKI18' => 'BONNIE',
  43.         'BONNIE' => 'BWR1',
  44.         'BWR1' => 'BWR2',
  45.     ),
  46.     'TikiWiki 1.9' => array(
  47.         'TIKIWIKI19' => 'TIKIWIKI18',
  48.         'TIKIWIKI18' => 'BONNIE',
  49.         'BONNIE' => 'BWR1',
  50.         'BWR1' => 'BWR2',
  51.     ),
  52.     'BWR0' => array(
  53.         'BONNIE' => 'BWR1',
  54.         'BWR1' => 'BWR2',
  55.     ),
  56.     'BWR1' => array(
  57.         'BWR1' => 'BWR2',
  58.     ),
  59. );
  60.  
  61. $gBitSmarty->assign( 'upgradeFrom', $gUpgradeFrom );
  62. $gBitSmarty->assign( 'upgradeTo', $gUpgradeTo );
  63.  
  64. $upPackages = array();
  65.  
  66. if( !empty( $_REQUEST['upgrade'] ) ) {
  67.     if( isset( $upgradePath[$_REQUEST['upgrade_from']] ) ) {
  68.         if( !empty( $gDebug ) || !empty( $_REQUEST['debug'] ) ) {
  69.             $gBitInstaller->debug();
  70.         }
  71.  
  72.         foreach( $upgradePath[$_REQUEST['upgrade_from']] as $from=>$to ) {
  73.             global $gUpgradeFrom, $gUpgradeTo;
  74.             $gUpgradeFrom = $from;
  75.             $gUpgradeTo = $to;
  76.  
  77.             $gBitInstaller->scanPackages( 'admin/upgrade_inc.php', FALSE );
  78.             $firstPackages = array_flip( array( 'kernel', 'users', 'categories', 'liberty', 'wiki', 'blogs' ) );
  79.             $secondPackages = array_flip( $upgrading );
  80.  
  81.             // upgrade the ones that are order critical first
  82.             foreach( array_keys( $firstPackages ) as $package ) {
  83.                 $gBitInstaller->upgradePackage( $package );
  84.                 if( isset( $secondPackages[$package] ) ) {
  85.                     unset( $secondPackages[$package] );
  86.                 }
  87.                 array_push( $upPackages, $package );
  88.             }
  89.  
  90.             // upgrade remaining packages
  91.             foreach( array_keys( $secondPackages ) as $package ) {
  92.                 $gBitInstaller->upgradePackage( $package );
  93.                 array_push( $upPackages, $package );
  94.             }
  95.             unset( $gBitInstaller->mUpgrades );
  96.         }
  97.         // If server supports InnoDB for MySql and selected for use
  98.         // we traverse all tables in db after upgrade and change engine if needed
  99.         if( isset( $_SESSION['use_innodb'] ) && $_SESSION['use_innodb'] == TRUE ) {
  100.             $rs = $gBitInstaller->mDb->Execute("SHOW TABLE STATUS");
  101.             while ( !$rs->EOF) {
  102.                 $row = $rs->GetRowAssoc(false);
  103.                 switch( isset( $row['Engine'] ) ? strtoupper( $row['Engine'] ) : strtoupper( $row['Type'] )) {
  104.                     case 'INNODB':
  105.                     case 'INNOBASE':
  106.                         break;
  107.                     default:
  108.                         $gBitInstaller->mDb->Execute("ALTER TABLE " . $row['Name'] . " ENGINE = INNODB");
  109.                         break;
  110.                 }
  111.  
  112.                 $rs->MoveNext();
  113.             }
  114.             $rs->Close();
  115.         }
  116.     }
  117.  
  118.     $gBitSmarty->assign( 'package_list', $upPackages );
  119.  
  120.     $app = '_done';
  121.     $gBitSmarty->assign( 'next_step',$step + 1 );
  122. }
  123. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:31 +0000 by phpDocumentor 1.5.0-lsces