[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/setup/ -> ezsetupcommon.php (source)

   1  <?php
   2  //
   3  // eZSetup
   4  //
   5  // Created on: <08-Nov-2002 11:00:54 kd>
   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  // This file holds shared functions for the ezsetup files
  30  
  31  include_once ( 'lib/ezutils/classes/ezini.php' );
  32  
  33  /*!
  34   \return an array with tests that need to be run
  35           and succeed for the setup to continue.
  36  */
  37  function eZSetupCriticalTests()
  38  {
  39      $ini =& eZINI::instance();
  40      return $ini->variableArray( 'SetupSettings', 'CriticalTests' );
  41  }
  42  
  43  /*!
  44   \return an array with tests that when run will give information on finetuning.
  45  */
  46  function eZSetupOptionalTests()
  47  {
  48      $ini =& eZINI::instance();
  49      return $ini->variableArray( 'SetupSettings', 'OptionalTests' );
  50  }
  51  
  52  function eZSetupDatabaseMap()
  53  {
  54      return array( 'mysql' => array( 'type' => 'mysql',
  55                                      'driver' => 'ezmysql',
  56                                      'name' => 'MySQL',
  57                                      'required_version' => '3.23',
  58                                      'has_demo_data' => true,
  59                                      'supports_unicode' => false ),
  60                    'pgsql' => array( 'type' => 'pgsql',
  61                                      'driver' => 'ezpostgresql',
  62                                      'name' => 'PostgreSQL',
  63                                      'required_version' => '7.3',
  64                                      'has_demo_data' => false,
  65                                      'supports_unicode' => true ) );
  66  }
  67  
  68  function eZSetupFetchPersistenceList()
  69  {
  70      $persistenceList = array();
  71      include_once ( 'lib/ezutils/classes/ezhttptool.php' );
  72      $http =& eZHTTPTool::instance();
  73      $postVariables = $http->attribute( 'post' );
  74  
  75      foreach ( $postVariables as $name => $value )
  76      {
  77          if ( preg_match( '/^P_([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)$/', $name, $matches ) )
  78          {
  79              $persistenceGroup = $matches[1];
  80              $persistenceName = $matches[2];
  81              $persistenceList[$persistenceGroup][$persistenceName] = $value;
  82          }
  83      }
  84  
  85      return $persistenceList;
  86  }
  87  
  88  function eZSetupSetPersistencePostVariable( $var, $value )
  89  {
  90      include_once ( 'lib/ezutils/classes/ezhttptool.php' );
  91      $http =& eZHTTPTool::instance();
  92      if ( is_array( $value ) )
  93      {
  94          foreach ( $value as $valueKey => $valueItem )
  95          {
  96              $http->setPostVariable( 'P_' . $var . '-' . $valueKey, $valueItem );
  97          }
  98      }
  99      else
 100      {
 101          $http->setPostVariable( 'P_' . $var . '-0', $value );
 102      }
 103  }
 104  
 105  function eZSetupMergePersistenceList( &$persistenceList, $persistenceDataList )
 106  {
 107      foreach ( $persistenceDataList as $persistenceData )
 108      {
 109          $persistenceName = $persistenceData[0];
 110          $persistenceValues = $persistenceData[1];
 111          if ( !isset( $persistenceList[$persistenceName] ) )
 112          {
 113              $values =& $persistenceList[$persistenceName];
 114              foreach ( $persistenceValues as $persistenceValueName => $persistenceValueData )
 115              {
 116                  $values[$persistenceValueName] = $persistenceValueData['value'];
 117              }
 118          }
 119          else
 120          {
 121              $oldValues =& $persistenceList[$persistenceName];
 122              foreach ( $persistenceValues as $persistenceValueName => $persistenceValueData )
 123              {
 124  //                eZDebug::writeDebug( $oldValues, 'oldValues' );
 125  //                eZDebug::writeDebug( $persistenceValueName, 'persistenceValueName' );
 126  //                eZDebug::writeDebug( $persistenceValueData, 'persistenceValueData' );
 127                  if ( !isset( $oldValues[$persistenceValueName] ) )
 128                  {
 129                      $oldValues[$persistenceValueName] = $persistenceValueData['value'];
 130                  }
 131                  else if ( is_array( $persistenceValueData['value'] ) and
 132                            isset( $persistenceValueData['merge'] ) and
 133                            $persistenceValueData['merge'] )
 134                  {
 135                       $merged = array_merge( $oldValues[$persistenceValueName], $persistenceValueData['value'] );
 136                       if ( isset( $persistenceValueData['unique'] ) and
 137                            $persistenceValueData['unique'] )
 138                            $merged = array_unique( $merged );
 139                       $oldValues[$persistenceValueName] = $merged;
 140                  }
 141                  else
 142                  {
 143                      $oldValues[$persistenceValueName] = $persistenceValueData['value'];
 144                  }
 145              }
 146          }
 147      }
 148  }
 149  ?>


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