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

Source for file install_database.php

Documentation is available at install_database.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. /**
  9.  * assign next step in installation process
  10.  */
  11. $gBitSmarty->assign( 'next_step',$step );
  12.  
  13. require_once( "get_databases_inc.php" );
  14.  
  15. // next block checks if there is a config/kernel/config_inc.php and if we can connect through this.
  16. if( isset( $_REQUEST['submit_db_info'] )) {
  17.     if( $gBitDbType == 'sybase' ) {
  18.         // avoid database change messages
  19.         ini_set( 'sybct.min_server_severity', '11' );
  20.     }
  21.     
  22.     // for Oracle force database name to use one from tnsnames
  23.     // this way we avoid further StartTrans errors that was often reported,
  24.     if( $gBitDbType == 'oci8po' && empty( $gBitDbName ) ) {
  25.         $gBitSmarty->assign( 'error', TRUE );
  26.         $gBitSmarty->assign( 'errorMsg', "Please fill Database Name field. If you don't know it and you're using Express Edition it's probably 'XE'. Otherwise check your \"tnsnames.ora\" file to get appropriate one." );
  27.         $error = TRUE; 
  28.     } else {
  29.         
  30.         $gBitDb = &ADONewConnection( $gBitDbType );
  31.     
  32.         if( $gBitDb->Connect( $gBitDbHost, $gBitDbUser, $gBitDbPassword, $gBitDbName )) {
  33.             // display success page when done
  34.             $app = '_done';
  35.             $gBitSmarty->assign( 'next_step',$step + 1 );
  36.             // this is where we tell the installer that this is the first install
  37.             // if so, clear out session variables
  38.             // if we are coming here from the upgrade process, don't change any value
  39.             if( isset( $_SESSION['first_install'] ) && $_SESSION['first_install'] == TRUE && isset( $_SESSION['upgrade'] ) && $_SESSION['upgrade'] == TRUE ) {
  40.                 // nothing to do
  41.             } elseif( !$gBitUser->isAdmin() ) {
  42.                 $_SESSION = NULL;
  43.                 $_SESSION['first_install'] = TRUE;
  44.             } else {
  45.                 $_SESSION['first_install'] = FALSE;
  46.             }
  47.     
  48.             if( $_SESSION['first_install'] == TRUE ) {
  49.                 // For MySql only, on first install check if server support
  50.                 // InnoDB and set a smarty var for template to offer using
  51.                 // the transaction safe storage engine
  52.                 if( preg_match( '/mysql/', $gBitDbType )) {
  53.                     $_SESSION['use_innodb'] = FALSE;
  54.                     $rs = $gBitDb->Execute('SHOW ENGINES');
  55.                     while ( !$rs->EOF) {
  56.                         $row = $rs->GetRowAssoc(false);
  57.                         switch( isset( $row['Engine'] ) ? strtoupper( $row['Engine'] ) : strtoupper( $row['Type'] )) {
  58.                             case 'INNODB':
  59.                             case 'INNOBASE':
  60.                                 if( strtoupper( $row['Support'] ) == 'YES' || strtoupper( $row['Support'] ) == 'DEFAULT' ) {
  61.                                     $gBitSmarty->assign( 'has_innodb_support',strtoupper( $row['Support'] ) );
  62.                                     break 2;
  63.                                 }
  64.                         }
  65.     
  66.                         $rs->MoveNext();
  67.                     }
  68.                     $rs->Close();
  69.                 }
  70.             }
  71.         } else {
  72.             $gBitSmarty->assign( 'error', TRUE );
  73.             $gBitSmarty->assign( 'errorMsg', $gBitDb->_errorMsg );
  74.             $error = TRUE;
  75.         }
  76.     }
  77. }
  78. ?>

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