Mage_Install_Model_Installer_Db Class Reference

Inheritance diagram for Mage_Install_Model_Installer_Db:

Mage_Install_Model_Installer_Abstract

List of all members.

Public Member Functions

 checkDatabase ($data)

Protected Member Functions

 _getConnenctionType ()


Detailed Description

Definition at line 34 of file Db.php.


Member Function Documentation

_getConnenctionType (  )  [protected]

Retrieve Connection Type

Returns:
string

Definition at line 89 of file Db.php.

00090     {
00091         return (string) Mage::getConfig()->getNode('global/resources/default_setup/connection/type');
00092     }

checkDatabase ( data  ) 

Check database connection

$data = array( [db_host] [db_name] [db_user] [db_pass] )

Parameters:
array $data

Definition at line 48 of file Db.php.

00049     {
00050         $config = array(
00051             'host'      => $data['db_host'],
00052             'username'  => $data['db_user'],
00053             'password'  => $data['db_pass'],
00054             'dbname'    => $data['db_name']
00055         );
00056 
00057         try {
00058             $connection = Mage::getSingleton('core/resource')->createConnection('install', $this->_getConnenctionType(), $config);
00059             $variables  = $connection->fetchPairs("SHOW VARIABLES");
00060 
00061             $version = isset($variables['version']) ? $variables['version'] : 'undefined';
00062             $match = array();
00063             if (preg_match("#^([0-9\.]+)#", $version, $match)) {
00064                 $version = $match[0];
00065             }
00066             $requiredVersion = (string)Mage::getSingleton('install/config')->getNode('check/mysql/version');
00067 
00068             // check MySQL Server version
00069             if (version_compare($version, $requiredVersion) == -1) {
00070                 Mage::throwException(Mage::helper('install')->__('Database server version does not match system requirements (required: %s, actual: %s)', $requiredVersion, $version));
00071             }
00072 
00073             // check InnoDB support
00074             if (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') {
00075                 Mage::throwException(Mage::helper('install')->__('Database server does not support InnoDB storage engine'));
00076             }
00077         }
00078         catch (Exception $e){
00079             $this->_getInstaller()->getDataModel()->addError($e->getMessage());
00080             Mage::throwException(Mage::helper('install')->__('Database connection error'));
00081         }
00082     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:27 2009 for Magento by  doxygen 1.5.8