[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/setup/steps/ -> ezstep_database_choice.php (source)

   1  <?php
   2  //
   3  // Definition of eZStepDatabaseChoice class
   4  //
   5  // Created on: <11-Aug-2003 16:45:50 kk>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*! \file ezstep_database_choice.php
  30  */
  31  include_once ( 'kernel/setup/steps/ezstep_installer.php' );
  32  include_once ( 'kernel/setup/ezsetupcommon.php' );
  33  include_once ( "kernel/common/i18n.php" );
  34  
  35  /*!
  36    \class eZStepDatabaseChoice ezstep_database_choice.php
  37    \brief The class eZStepDatabaseChoice does
  38  
  39  */
  40  
  41  class eZStepDatabaseChoice extends eZStepInstaller
  42  {
  43      /*!
  44       Constructor
  45      \reimp
  46      */
  47      function eZStepDatabaseChoice( &$tpl, &$http, &$ini, &$persistenceList )
  48      {
  49          $this->eZStepInstaller( $tpl, $http, $ini, $persistenceList,
  50                                  'database_choice', 'Database choice' );
  51      }
  52  
  53      /*!
  54       \reimp
  55       */
  56      function processPostData()
  57      {
  58          $databaseMap = eZSetupDatabaseMap();
  59          $this->PersistenceList['database_info'] = $databaseMap[$this->Http->postVariable( 'eZSetupDatabaseType' )];
  60          return true;
  61      }
  62  
  63      /*!
  64       \reimp
  65       */
  66      function init()
  67      {
  68          $databaseMap = eZSetupDatabaseMap();
  69  
  70          if ( $this->hasKickstartData() )
  71          {
  72              $data = $this->kickstartData();
  73              $extension = $data['Type'];
  74              $map = array( 'postgresql' => 'pgsql' );
  75              if ( isset( $map[$extension] ) )
  76                  $extension = $map[$extension];
  77  
  78              if ( isset( $databaseMap[$extension] ) )
  79              {
  80                  $this->PersistenceList['database_info'] = $databaseMap[$extension];
  81                  return $this->kickstartContinueNextStep();
  82              }
  83          }
  84  
  85          include_once ( "kernel/setup/ezsetuptests.php" );
  86          if ( eZSetupTestInstaller() == 'windows' )
  87          {
  88              $this->PersistenceList['database_info'] = $databaseMap['mysql'];
  89              return true;
  90          }
  91  
  92          $databaseMap = eZSetupDatabaseMap();
  93          $database = null;
  94          $databaseCount = 0;
  95          if ( isset( $this->PersistenceList['database_extensions']['found'] ) )
  96          {
  97              $databaseExtensions = $this->PersistenceList['database_extensions']['found'];
  98              foreach ( $databaseExtensions as $extension )
  99              {
 100                  if ( !isset( $databaseMap[$extension] ) )
 101                      continue;
 102                  $database = $databaseMap[$extension];
 103                  $database['name'] = null;
 104                  $databaseCount++;
 105              }
 106          }
 107  
 108          if ( $databaseCount != 1 )
 109          {
 110              return false;
 111          }
 112  
 113          $this->PersistenceList['database_info'] = $database;
 114  
 115          return true;
 116      }
 117  
 118      /*!
 119       \reimp
 120       */
 121      function &display()
 122      {
 123          $databaseMap = eZSetupDatabaseMap();
 124          $databaseList = array();
 125          if ( isset( $this->PersistenceList['database_extensions']['found'] ) )
 126          {
 127              $databaseExtensions = $this->PersistenceList['database_extensions']['found'];
 128              foreach ( $databaseExtensions as $extension )
 129              {
 130                  if ( !isset( $databaseMap[$extension] ) )
 131                      continue;
 132                  $databaseList[] = $databaseMap[$extension];
 133              }
 134          }
 135  
 136          $databaseInfo = $databaseList[0];
 137          if ( isset( $this->PersistenceList['database_info'] ) )
 138              $databaseInfo = $this->PersistenceList['database_info'];
 139  
 140          $this->Tpl->setVariable( 'database_list', $databaseList );
 141          $this->Tpl->setVariable( 'database_info', $databaseInfo );
 142  
 143          $result = array();
 144          // Display template
 145          $result['content'] = $this->Tpl->fetch( "design:setup/init/database_choice.tpl" );
 146          $result['path'] = array( array( 'text' => ezi18n( 'design/standard/setup/init',
 147                                                            'Database choice' ),
 148                                          'url' => false ) );
 149          return $result;
 150      }
 151  
 152  }
 153  
 154  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7