XOOPS  2.6.0
databasefactory.php
Go to the documentation of this file.
1 <?php
13 
30 {
31 
45  public static function getDatabaseConnection()
46  {
47  static $legacy;
48 
49  $file = \XoopsBaseConfig::get('root-path') . '/class/database/mysqldatabase.php';
50  if (!isset($legacy) && file_exists($file)) {
51  require_once $file;
52  if (!defined('XOOPS_DB_PROXY')) {
53  $class = 'XoopsMysqlDatabaseSafe';
54  } else {
55  $class = 'XoopsMysqlDatabaseProxy';
56  }
57  $xoopsPreload = XoopsPreload::getInstance();
58  $xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class));
59  $legacy = new $class();
60  $legacy->setPrefix(\XoopsBaseConfig::get('db-prefix'));
61  $legacy->conn = \Xoops\Core\Database\Factory::getConnection();
62  }
63  if (is_null($legacy->conn)) {
64  trigger_error('notrace:Unable to connect to database', E_USER_ERROR);
65  }
66  return $legacy;
67  }
68 }
static getInstance()
Definition: Events.php:57
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
Definition: browse.php:55
static get($name)