|
From: <red...@us...> - 2013-08-24 04:39:04
|
Revision: 11967
http://sourceforge.net/p/xoops/svn/11967
Author: redheadedrod
Date: 2013-08-24 04:38:58 +0000 (Sat, 24 Aug 2013)
Log Message:
-----------
Updated 2.6 database connectors.
mysqldatabase.php - merged my version and Richards version.
connection.php - Added support for most items in legacy connector. Added query and queryForce(Old queryF), added some prefix based functions to use doctrine functions with prefix already added. Also added XoopsQueryBuilder to take new query builder function.
querybuilder.php - xoopsquerybuilder class is an extension of Doctrine querybuilder. Adds prefix versions of all the functions related to tables.
xoopsload.php - added xoopsquerybuilder to loader.
databasefactory.php - commented out code I didn't end up using and updated to support new features in doctrine connector.
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/connection.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/databasefactory.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/mysqldatabase.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/xoopsload.php
Added Paths:
-----------
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/querybuilder.php
Modified: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/connection.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/connection.php 2013-08-23 00:10:44 UTC (rev 11966)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/connection.php 2013-08-24 04:38:58 UTC (rev 11967)
@@ -26,7 +26,25 @@
*/
class XoopsConnection extends \Doctrine\DBAL\Connection
{
+ private $safe = true;
+ public $allowedWebChanges = true;
+
+ public function __construct(array $params,
+ \Doctrine\DBAL\Driver\PDOMySql\Driver $driver,
+ \Doctrine\DBAL\Configuration $config = null,
+ \Doctrine\Common\EventManager $eventManager = null)
+ {
+ // $this->prefix = XOOPS_DB_PREFIX;
+ //$this->allowWebChanges = ($_SERVER['REQUEST_METHOD'] != 'GET');
+ if (!defined('XOOPS_DB_PROXY')) {
+ $this->safe = true;
+ } else {
+ $this->safe = false;
+ }
+ parent::__construct($params, $driver, $config, $eventManager);
+ }
+
/**
* Prepend the prefix.'_' to the given tablename
* If tablename is empty, just return the prefix.
@@ -35,13 +53,155 @@
*
* @return string prefixed tablename, or prefix if tablename is empty
*/
- public function prefix($tablename = '')
+ public static function prefix($tablename = '')
{
+ static $prefix = XOOPS_DB_PREFIX;
if ($tablename != '') {
- return XOOPS_DB_PREFIX . '_' . $tablename;
+ return $prefix . '_' . $tablename;
} else {
- return XOOPS_DB_PREFIX;
+ return $prefix;
}
}
+ /**
+ * Inserts a table row with specified data.
+ *
+ * Adds prefix to the name of the table then passes to normal function.
+ *
+ * @param string $tableName The name of the table to insert data into.
+ * @param array $data An associative array containing column-value pairs.
+ * @param array $types Types of the inserted data.
+ * @return integer The number of affected rows.
+ */
+ public function insertPrefix($tableName, array $data, array $types = array())
+ {
+ $tableName = $this->prefix($tableName);
+ return $this->insert($tableName, $data, $types);
+ }
+
+
+ /**
+ * Executes an SQL UPDATE statement on a table.
+ *
+ * Adds prefix to the name of the table then passes to normal function.
+ *
+ * @param string $tableName The name of the table to update.
+ * @param array $data
+ * @param array $identifier The update criteria. An associative array containing column-value pairs.
+ * @param array $types Types of the merged $data and $identifier arrays in that order.
+ * @return integer The number of affected rows.
+ */
+ public function updatePrefix($tableName, array $data, array $identifier, array $types = array())
+ {
+ $tableName = $this->prefix($tableName);
+ return $this->update($tableName, $data, $identifier, $types);
+ }
+
+
+ /**
+ * Executes an SQL DELETE statement on a table.
+ *
+ * Adds prefix to the name of the table then passes to normal function.
+ *
+ * @param string $tableName The name of the table on which to delete.
+ * @param array $identifier The deletion criteria. An associative array containing column-value pairs.
+ * @return integer The number of affected rows.
+ */
+ public function deletePrefix($tableName, array $identifier)
+ {
+ $tableName = $this->prefix($tableName);
+ return $this->delete($tableName, $identifier);
+ }
+
+
+
+ /**
+ * perform a query on the database
+ *
+ * @param string $sql a valid MySQL query
+ * @return bool|resource query result or FALSE if not successful
+ * or TRUE if successful and no result
+ */
+ public function queryForce()
+ {
+ $sql = func_get_arg(0);
+ $xoopsPreload = XoopsPreload::getInstance();
+ $xoopsPreload->triggerEvent('core.database.query.start');
+ try {
+ $result = call_user_func_array(array('parent', 'query'), func_get_args());
+ }
+ catch (Exception $e) {
+ $result=false;
+ }
+ /* if(is_object($result)) {
+ $this->_lastResult = clone $result; // Has to be clone or it is reference.
+ } */
+ $xoopsPreload->triggerEvent('core.database.query.end');
+
+ if ($result) {
+ $xoopsPreload->triggerEvent('core.database.query.success', (array($sql)));
+ return $result;
+ } else {
+ $xoopsPreload->triggerEvent('core.database.query.failure', (array($sql, $this)));
+ return false;
+ }
+ }
+
+ /**
+ * perform a query
+ *
+ * This method is empty and does nothing! It should therefore only be
+ * used if nothing is exactly what you want done! ;-)
+ *
+ * @param string $sql a valid MySQL query
+ * @abstract
+ */
+ public function query()
+ {
+ if ($this->safe) {
+ return call_user_func_array(array($this, "queryForce"), func_get_args());
+ } else {
+ $sql = ltrim(func_get_arg(0));
+ if (!$this->allowedWebChanges && strtolower(substr($sql, 0, 6)) != 'select') {
+ //trigger_error('Database updates are not allowed during processing of a GET request', E_USER_WARNING);
+ return false;
+ }
+ return call_user_func_array(array($this, "queryForce"), func_get_args());
+ }
+ }
+
+ /**
+ * perform queries from SQL dump file in a batch
+ *
+ * @param string $file file path to an SQL dump file
+ * @return bool FALSE if failed reading SQL file or TRUE if the file has been read and queries executed
+ */
+ public function queryFromFile($file)
+ {
+ if (false !== ($fp = fopen($file, 'r'))) {
+ $sql_queries = trim(fread($fp, filesize($file)));
+ SqlUtility::splitMySqlFile($pieces, $sql_queries);
+ foreach ($pieces as $query) {
+ // [0] contains the prefixed query
+ // [4] contains unprefixed table name
+ $prefixed_query = SqlUtility::prefixQuery(trim($query), $this->prefix());
+ if ($prefixed_query != false) {
+ $this->query($prefixed_query[0]);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Create a new instance of a SQL query builder.
+ *
+ * @return \Doctrine\DBAL\Query\QueryBuilder
+ */
+ public function createXoopsQueryBuilder()
+ {
+ return new XoopsQueryBuilder($this);
+ }
+
}
\ No newline at end of file
Modified: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/databasefactory.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/databasefactory.php 2013-08-23 00:10:44 UTC (rev 11966)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/databasefactory.php 2013-08-24 04:38:58 UTC (rev 11967)
@@ -21,6 +21,14 @@
defined('XOOPS_ROOT_PATH') or die('Restricted access');
+/**
+ * XoopsDatabaseFactory
+ *
+ * @package Kernel
+ * @author Kazumi Ono <on...@xo...>
+ * @access public
+ */
+
class XoopsDatabaseFactory
{
@@ -30,6 +38,9 @@
* if the class has not been instantiated yet, this will also take
* care of that
*
+ * NOTE: Persistance connection is not included. XOOPS_DB_PCONNECT is ignored.
+ * allowWebChanges also needs to be addressed
+ *
* @static
* @staticvar XoopsDatabase The only instance of database class
* @return XoopsDatabase Reference to the only instance of database class
@@ -50,7 +61,10 @@
// 'unix_socket' => ?,
'charset' => XOOPS_DB_CHARSET,
'driver' => 'pdo_mysql',
- 'wrapperClass' => 'XoopsConnection'
+ 'wrapperClass' => 'XoopsConnection',
+ // 'driverOptions' => array (PDO::ATTR_PERSISTENT => TRUE)
+ // this is how you call them but not compatible with doctrine.
+
);
$instance = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
// Legacy support
@@ -76,7 +90,7 @@
return $instance;
}
- static function getNewDatabaseConnection()
+ /* static function getNewDatabaseConnection()
{
static $instance;
if (!isset($instance)) {
@@ -84,14 +98,14 @@
$xoopsPreload = XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class));
/* @var $instance XoopsDatabase */
- $instance = new $class();
+ /* $instance = new $class();
$instance->setPrefix(XOOPS_DB_PREFIX);
if (!$instance->connect()) {
trigger_error('notrace:Unable to connect to database', E_USER_ERROR);
}
}
return $instance;
- }
+ } */
/**
* Gets a reference to the only instance of database class. Currently
Modified: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/mysqldatabase.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/mysqldatabase.php 2013-08-23 00:10:44 UTC (rev 11966)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/mysqldatabase.php 2013-08-24 04:38:58 UTC (rev 11967)
@@ -19,6 +19,7 @@
* @since 1.0.0
* @author Kazumi Ono <on...@xo...>
* @version $Id$
+ *
*/
defined('XOOPS_ROOT_PATH') or die('Restricted access');
@@ -26,8 +27,7 @@
/**
* connection to a mysql database
*
- * @abstract
- * @author Kazumi Ono <on...@xo...>
+ * @author Kazumi Ono <on...@xo...>
* @copyright copyright (c) 2000-2003 XOOPS.org
* @package class
* @subpackage database
@@ -36,11 +36,37 @@
{
/**
- * @var object keep track of last result since we need it for getAffectedRows
+ * Database connection
+ *
+ * @var resource
*/
+ public $conn;
+
+ /**
+ * Database connection
+ *
+ * @var resource
+ */
private $_lastResult;
/**
+ * Database connection
+ *
+ * @var resource
+ */
+ private $_connect = false;
+
+ /**
+ * Database connection
+ *
+ * @var resource
+ */
+ public $_selectdb;
+
+
+
+
+ /**
* connect to the database
*
* @param bool $selectdb select the database now?
@@ -48,29 +74,13 @@
*/
public function connect($selectdb = true)
{
- static $db_charset_set;
+ $this->_connect = (is_object($this->conn));
+ $this->_selectdb = $selectdb;
+ $this->allowWebChanges = ($_SERVER['REQUEST_METHOD'] != 'GET');
+ return $this->_connect;
+ }
- $config = new \Doctrine\DBAL\Configuration();
- $connectionParams = array(
- 'dbname' => XOOPS_DB_NAME,
- 'user' => XOOPS_DB_USER,
- 'password' => XOOPS_DB_PASS,
- 'host' => XOOPS_DB_HOST,
-// 'port' => ?,
-// 'unix_socket' => ?,
- 'charset' => XOOPS_DB_CHARSET,
- 'driver' => 'pdo_mysql'
- );
- $this->conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
- if (!$this->conn) {
- $xoopsPreload = XoopsPreload::getInstance();
- $xoopsPreload->triggerEvent('core.database.noconn', array($this));
- return false;
- }
- return true;
- }
-
/**
* generate an ID for a new row
*
@@ -173,6 +183,10 @@
*/
public function getAffectedRows()
{
+ if(!is_object($this->_lastResult))
+ {
+ return null;
+ }
return $this->_lastResult->rowCount();
}
@@ -236,7 +250,9 @@
*/
public function quote($string)
{
- return $this->conn->quote($string);
+ //return $this->conn->quote($string);
+ //There was a reason for this longer command but can't recall what it was...
+ return str_replace("\\\"", '"', str_replace("\\"", '"', $this->conn->quote($string)));
}
/**
@@ -264,7 +280,9 @@
catch (Exception $e) {
$result=false;
}
- $this->_lastResult = $result;
+ if(is_object($result)) {
+ $this->_lastResult = clone $result; // Has to be clone or it is reference.
+ }
$xoopsPreload->triggerEvent('core.database.query.end');
if ($result) {
@@ -326,10 +344,16 @@
*/
public function getFieldName($result, $offset)
{
- $xoops = Xoops::getInstance();
- $xoops->deprecated('getFieldName() is deprecated. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
+ try
+ {
+ $temp = $result->getColumnMeta($offset);
+ return $temp['name'];
+ }
+ catch (PDOException $e)
+ {
+ return null;
+ }
- return null;
}
/**
@@ -344,10 +368,32 @@
*/
public function getFieldType($result, $offset)
{
- $xoops = Xoops::getInstance();
- $xoops->deprecated('getFieldType() is deprecated. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
+ try
+ {
+ $temp = ($result->getColumnMeta($offset));
+ $t = $temp['native_type'];
- return null;
+ $temp = (string)(
+ ((($t == 'STRING') || ($t == 'VAR_STRING') ) ? 'string' : '' ) .
+ ( (in_array($t, array('TINY', 'SHORT', 'LONG', 'LONGLONG', 'INT24'))) ? 'int' : '' ) .
+ ( (in_array($t, array('FLOAT', 'DOUBLE', 'DECIMAL', 'NEWDECIMAL'))) ? 'real' : '' ) .
+ ( ($t == 'TIMESTAMP') ? 'timestamp' : '' ) .
+ ( ($t == 'YEAR') ? 'year' : '') .
+ ( (($t == 'DATE') || ($t == 'NEWDATE') ) ? 'date' : '' ) .
+ ( ($t == 'TIME') ? 'time' : '' ) .
+ ( ($t == 'SET') ? 'set' : '' ) .
+ ( ($t == 'ENUM') ? 'enum' : '' ) .
+ ( ($t == 'GEOMETRY') ? 'geometry' : '' ) .
+ ( ($t == 'DATETIME') ? 'datetime' : '' ) .
+ ( (in_array($t, array('TINY_BLOB', 'BLOB', 'MEDIUM_BLOB', 'LONG_BLOB'))) ? 'blob' : '' ) .
+ ( ($t == 'NULL') ? 'null' : '' )
+ );
+ return $temp;
+ }
+ catch (PDOException $e)
+ {
+ return null;
+ }
}
/**
@@ -366,11 +412,12 @@
*
* @return object Doctrine\DBAL\Connection
*/
+ /* not needed
public function direct()
{
return $this->conn;
}
-
+ */
}
/**
Added: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/querybuilder.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/querybuilder.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/querybuilder.php 2013-08-24 04:38:58 UTC (rev 11967)
@@ -0,0 +1,190 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+/**
+ * Connection wrapper for Doctrine DBAL Connection
+ *
+ * @category Xoops\Database\XoopsConnection
+ * @package Xoops
+ * @author readheadedrod
+ * @author Richard Griffith <ri...@ge...>
+ * @copyright 2013 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @version Release: 1.0
+ * @link http://xoops.org
+ * @since 1.0
+ */
+
+
+class XoopsQueryBuilder extends \Doctrine\DBAL\Query\QueryBuilder
+{
+
+
+ public function __construct(\Doctrine\DBAL\Connection $connection)
+ {
+ $this->prefix = XOOPS_DB_PREFIX;
+ parent::__construct($connection);
+ }
+
+
+ /**
+ * Turns the query being built into a bulk delete query that ranges over
+ * a certain table.
+ *
+ * <code>
+ * $qb = $conn->createQueryBuilder()
+ * ->delete('users', 'u')
+ * ->where('u.id = :user_id');
+ * ->setParameter(':user_id', 1);
+ * </code>
+ *
+ * @param string $delete The table whose rows are subject to the deletion. Adds table prefix.
+ * @param string $alias The table alias used in the constructed query.
+ * @return QueryBuilder This QueryBuilder instance.
+ */
+ public function deletePrefix($delete = null, $alias = null)
+ {
+ $delete = XoopsConnection::prefix($delete);
+ return $this->delete($delete, $alias);
+ }
+
+ /**
+ * Turns the query being built into a bulk update query that ranges over
+ * a certain table
+ *
+ * <code>
+ * $qb = $conn->createQueryBuilder()
+ * ->update('users', 'u')
+ * ->set('u.password', md5('password'))
+ * ->where('u.id = ?');
+ * </code>
+ *
+ * @param string $update The table whose rows are subject to the update. Adds table prefix.
+ * @param string $alias The table alias used in the constructed query.
+ * @return QueryBuilder This QueryBuilder instance.
+ */
+ public function updatePrefix($update = null, $alias = null)
+ {
+ $update = XoopsConnection::prefix($update);
+ return $this->update($update, $alias);
+ }
+
+ /**
+ * Create and add a query root corresponding to the table identified by the
+ * given alias, forming a cartesian product with any existing query roots.
+ *
+ * <code>
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.id')
+ * ->from('users', 'u')
+ * </code>
+ *
+ * @param string $from The table. Adds table prefix.
+ * @param string $alias The alias of the table
+ * @return QueryBuilder This QueryBuilder instance.
+ */
+ public function fromPrefix($from, $alias)
+ {
+ $from = XoopsConnection::prefix($from);
+ return $this->from($from, $alias);
+ }
+
+ /**
+ * Creates and adds a join to the query.
+ *
+ * <code>
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
+ * </code>
+ *
+ * @param string $fromAlias The alias that points to a from clause
+ * @param string $join The table name to join. Adds table prefix.
+ * @param string $alias The alias of the join table
+ * @param string $condition The condition for the join
+ * @return QueryBuilder This QueryBuilder instance.
+ */
+ public function joinPrefix($fromAlias, $join, $alias, $condition = null)
+ {
+ $join = XoopsConnection::prefix($join);
+ return $this->join($fromAlias, $join, $alias, $condition);
+ }
+
+
+ /**
+ * Creates and adds a join to the query.
+ *
+ * <code>
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
+ * </code>
+ *
+ * @param string $fromAlias The alias that points to a from clause
+ * @param string $join The table name to join. Adds table prefix.
+ * @param string $alias The alias of the join table
+ * @param string $condition The condition for the join
+ * @return QueryBuilder This QueryBuilder instance.
+ */
+ public function innerJoinPrefix($fromAlias, $join, $alias, $condition = null)
+ {
+ $join = XoopsConnection::prefix($join);
+ return $this->innerJoin($fromAlias, $join, $alias, $condition);
+ }
+
+ /**
+ * Creates and adds a left join to the query.
+ *
+ * <code>
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
+ * </code>
+ *
+ * @param string $fromAlias The alias that points to a from clause
+ * @param string $join The table name to join. Adds table prefix.
+ * @param string $alias The alias of the join table
+ * @param string $condition The condition for the join
+ * @return QueryBuilder This QueryBuilder instance.
+ */
+ public function leftJoinPrefix($fromAlias, $join, $alias, $condition = null)
+ {
+ $join = XoopsConnection::prefix($join);
+ return $this->leftJoin($fromAlias, $join, $alias, $condition);
+ }
+
+ /**
+ * Creates and adds a right join to the query.
+ *
+ * <code>
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
+ * </code>
+ *
+ * @param string $fromAlias The alias that points to a from clause
+ * @param string $join The table name to join. Adds table prefix.
+ * @param string $alias The alias of the join table
+ * @param string $condition The condition for the join
+ * @return QueryBuilder This QueryBuilder instance.
+ */
+ public function rightJoinPrefix($fromAlias, $join, $alias, $condition = null)
+ {
+ $join = XoopsConnection::prefix($join);
+ return $this->rightJoin($fromAlias, $join, $alias, $condition);
+ }
+}
\ No newline at end of file
Modified: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/xoopsload.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/xoopsload.php 2013-08-23 00:10:44 UTC (rev 11966)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/xoopsload.php 2013-08-24 04:38:58 UTC (rev 11967)
@@ -263,6 +263,7 @@
'xoopsconfigoptionhandler' => XOOPS_ROOT_PATH . '/kernel/configoption.php',
'xoopsdatabase' => XOOPS_ROOT_PATH . '/class/database/database.php',
'xoopsconnection' => XOOPS_ROOT_PATH . '/class/database/connection.php',
+ 'xoopsquerybuilder' => XOOPS_ROOT_PATH . '/class/database/querybuilder.php',
'xoopsdatabasefactory' => XOOPS_ROOT_PATH . '/class/database/databasefactory.php',
'xoopsdatabasemanager' => XOOPS_ROOT_PATH . '/class/database/manager.php',
'xoopsdownloader' => XOOPS_ROOT_PATH . '/class/downloader.php',
|
|
From: <red...@us...> - 2013-08-24 23:41:27
|
Revision: 11976
http://sourceforge.net/p/xoops/svn/11976
Author: redheadedrod
Date: 2013-08-24 23:41:24 +0000 (Sat, 24 Aug 2013)
Log Message:
-----------
Updated all files in the class/database directory. Some had wrong EOL on them. They now pass PHP code sniffer with just a couple warnings.
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/connection.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/database.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/databasefactory.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/manager.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/mysqldatabase.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/querybuilder.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/sqlutility.php
XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/xoopsload.php
Modified: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/connection.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/connection.php 2013-08-24 22:35:00 UTC (rev 11975)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/connection.php 2013-08-24 23:41:24 UTC (rev 11976)
@@ -1,14 +1,28 @@
<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
+/**
+ * Connection wrapper for Doctrine DBAL Connection
+ *
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material of the original
+ * comment or credit authors.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @category Xoops\Class\Database\XoopsConnection
+ * @package Class
+ * @subpackage Database
+ * @author readheadedrod <red...@ho...>
+ * @author Richard Griffith <ri...@ge...>
+ * @copyright 2013 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @version $Id: connection.php 10328 2012-12-07 00:56:07Z trabis $
+ * @link http://xoops.org
+ * @since 1.0
+ */
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
defined('XOOPS_ROOT_PATH') or die('Restricted access');
/**
@@ -16,7 +30,7 @@
*
* @category Xoops\Database\XoopsConnection
* @package Xoops
- * @author readheadedrod
+ * @author readheadedrod <red...@ho...>
* @author Richard Griffith <ri...@ge...>
* @copyright 2013 The XOOPS Project http://sourceforge.net/projects/xoops/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
@@ -26,17 +40,28 @@
*/
class XoopsConnection extends \Doctrine\DBAL\Connection
{
- private $safe = true;
+ private $_safe = true;
- public $allowedWebChanges = true;
+ private $_allowedWebChanges = true;
+
+ /**
+ * Initializes a new instance of the Connection class.
+ *
+ * This sets up necissary variables before calling parent constructor
+ *
+ * @param array $params Parameters for the driver
+ * @param Driver $driver The driver to use
+ * @param Configuration $config The connection configuration
+ * @param EventManager $eventManager Event manager to use
+ */
public function __construct(array $params,
- \Doctrine\DBAL\Driver\PDOMySql\Driver $driver,
- \Doctrine\DBAL\Configuration $config = null,
- \Doctrine\Common\EventManager $eventManager = null)
- {
- // $this->prefix = XOOPS_DB_PREFIX;
- //$this->allowWebChanges = ($_SERVER['REQUEST_METHOD'] != 'GET');
+ \Doctrine\DBAL\Driver\PDOMySql\Driver $driver,
+ \Doctrine\DBAL\Configuration $config = null,
+ \Doctrine\Common\EventManager $eventManager = null
+ ) {
+ // Not sure if this next line does anything
+ $this->allowWebChanges = ($_SERVER['REQUEST_METHOD'] != 'GET');
if (!defined('XOOPS_DB_PROXY')) {
$this->safe = true;
} else {
@@ -69,14 +94,15 @@
* Adds prefix to the name of the table then passes to normal function.
*
* @param string $tableName The name of the table to insert data into.
- * @param array $data An associative array containing column-value pairs.
- * @param array $types Types of the inserted data.
+ * @param array $data An associative array containing column-value pairs.
+ * @param array $types Types of the inserted data.
+ *
* @return integer The number of affected rows.
*/
public function insertPrefix($tableName, array $data, array $types = array())
{
- $tableName = $this->prefix($tableName);
- return $this->insert($tableName, $data, $types);
+ $tableName = $this->prefix($tableName);
+ return $this->insert($tableName, $data, $types);
}
@@ -85,14 +111,20 @@
*
* Adds prefix to the name of the table then passes to normal function.
*
- * @param string $tableName The name of the table to update.
- * @param array $data
- * @param array $identifier The update criteria. An associative array containing column-value pairs.
- * @param array $types Types of the merged $data and $identifier arrays in that order.
+ * @param string $tableName The name of the table to update.
+ * @param array $data The data to update
+ * @param array $identifier The update criteria.
+ * An associative array containing column-value pairs.
+ * @param array $types Types of the merged $data and
+ * $identifier arrays in that order.
+ *
* @return integer The number of affected rows.
*/
- public function updatePrefix($tableName, array $data, array $identifier, array $types = array())
- {
+ public function updatePrefix($tableName,
+ array $data,
+ array $identifier,
+ array $types = array()
+ ) {
$tableName = $this->prefix($tableName);
return $this->update($tableName, $data, $identifier, $types);
}
@@ -103,8 +135,10 @@
*
* Adds prefix to the name of the table then passes to normal function.
*
- * @param string $tableName The name of the table on which to delete.
- * @param array $identifier The deletion criteria. An associative array containing column-value pairs.
+ * @param string $tableName The name of the table on which to delete.
+ * @param array $identifier The deletion criteria.
+ * An associative array containing column-value pairs.
+ *
* @return integer The number of affected rows.
*/
public function deletePrefix($tableName, array $identifier)
@@ -117,8 +151,8 @@
/**
* perform a query on the database
+ * Always performs query and triggers timer to time it
*
- * @param string $sql a valid MySQL query
* @return bool|resource query result or FALSE if not successful
* or TRUE if successful and no result
*/
@@ -128,33 +162,39 @@
$xoopsPreload = XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.database.query.start');
try {
- $result = call_user_func_array(array('parent', 'query'), func_get_args());
+ $result = call_user_func_array(
+ array('parent', 'query'),
+ func_get_args()
+ );
}
catch (Exception $e) {
$result=false;
}
- /* if(is_object($result)) {
- $this->_lastResult = clone $result; // Has to be clone or it is reference.
- } */
+ /* if(is_object($result)) {
+ $this->_lastResult = clone $result;
+ } */ // Remove if not using getAffectedRows
$xoopsPreload->triggerEvent('core.database.query.end');
if ($result) {
- $xoopsPreload->triggerEvent('core.database.query.success', (array($sql)));
+ $xoopsPreload->triggerEvent(
+ 'core.database.query.success',
+ (array($sql))
+ );
return $result;
} else {
- $xoopsPreload->triggerEvent('core.database.query.failure', (array($sql, $this)));
+ $xoopsPreload->triggerEvent(
+ 'core.database.query.failure',
+ (array($sql, $this))
+ );
return false;
}
}
/**
- * perform a query
+ * perform a safe query if allowed
+ * can receive variable number of arguments
*
- * This method is empty and does nothing! It should therefore only be
- * used if nothing is exactly what you want done! ;-)
- *
- * @param string $sql a valid MySQL query
- * @abstract
+ * @return returns the value received from queryForce
*/
public function query()
{
@@ -162,8 +202,12 @@
return call_user_func_array(array($this, "queryForce"), func_get_args());
} else {
$sql = ltrim(func_get_arg(0));
- if (!$this->allowedWebChanges && strtolower(substr($sql, 0, 6)) != 'select') {
- //trigger_error('Database updates are not allowed during processing of a GET request', E_USER_WARNING);
+ if (!$this->allowedWebChanges
+ && strtolower(substr($sql, 0, 6))!= 'select'
+ ) {
+ //trigger_error('Database updates are not allowed
+ //during processing of a GET request', E_USER_WARNING);
+ //needs to be replaced with standard error
return false;
}
return call_user_func_array(array($this, "queryForce"), func_get_args());
@@ -174,7 +218,9 @@
* perform queries from SQL dump file in a batch
*
* @param string $file file path to an SQL dump file
- * @return bool FALSE if failed reading SQL file or TRUE if the file has been read and queries executed
+ *
+ * @return bool FALSE if failed reading SQL file or
+ * TRUE if the file has been read and queries executed
*/
public function queryFromFile($file)
{
@@ -184,7 +230,10 @@
foreach ($pieces as $query) {
// [0] contains the prefixed query
// [4] contains unprefixed table name
- $prefixed_query = SqlUtility::prefixQuery(trim($query), $this->prefix());
+ $prefixed_query = SqlUtility::prefixQuery(
+ trim($query),
+ $this->prefix()
+ );
if ($prefixed_query != false) {
$this->query($prefixed_query[0]);
}
Modified: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/database.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/database.php 2013-08-24 22:35:00 UTC (rev 11975)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/database.php 2013-08-24 23:41:24 UTC (rev 11976)
@@ -1,24 +1,25 @@
<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
/**
* Abstract base class for XOOPS Database access classes
*
- * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package class
- * @subpackage database
- * @since 1.0.0
- * @author Kazumi Ono <on...@xo...>
- * @version $Id$
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material
+ * of the original comment or credit authors.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @category Xoops\Class\Database\Database
+ * @package Class
+ * @subpackage Database
+ * @author Kazumi Ono <on...@xo...>
+ * @copyright 2013 The XOOPS project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @version $Id$
+ * @link http://xoops.org
+ * @since 1.0.0
*/
defined('XOOPS_ROOT_PATH') or die('Restricted access');
@@ -26,12 +27,18 @@
/**
* Abstract base class for Database access classes
*
+
+ * @category Xoops\Class\Database\Database
+ * @package Class
+ * @subpackage Database
+ * @author Kazumi Ono <on...@xo...>
+ * @copyright 2013 The XOOPS project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @link http://xoops.org
+ * @since 1.0.0
* @abstract
- * @author Kazumi Ono <on...@xo...>
- * @package kernel
- * @subpackage database
*/
-abstract class XoopsDatabase
+abstract class XoopsDatabase // Depreciated with 2.6
{
/**
* Database connection
@@ -59,6 +66,8 @@
* set the prefix for tables in the database
*
* @param string $value table prefix
+ *
+ * @return this does not return a value
*/
public function setPrefix($value)
{
@@ -75,6 +84,7 @@
*/
public function prefix($tablename = '')
{
+
if ($tablename != '') {
return $this->prefix . '_' . $tablename;
} else {
@@ -83,148 +93,240 @@
}
/**
- * @abstract
+ * connect to the database
*
- * @param bool $selectdb
+ * @param bool $selectdb select the database now?
*
- * @return void
+ * @return bool successful?
+ * @deprecated since version 2.6.0 - alpha 3
+ * @abstract
*/
abstract function connect($selectdb = true);
/**
- * @param $sequence
+ * generate an ID for a new row
*
+ * This is for compatibility only. Will always return 0, because MySQL supports
+ * autoincrement for primary keys.
+ *
+ * @param string $sequence name of the sequence from which to get the next ID
+ *
+ * @return int always 0, because mysql has support for autoincrement
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function genId($sequence);
/**
- * @param $result
+ * Get a result row as an enumerated array
*
+ * @param resource $result resource to get result from
+ *
+ * @return array
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function fetchRow($result);
/**
- * @param $result
+ * Fetch a result row as an associative array
*
+ * @param resource $result resource to get result from
+ *
* @return array
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function fetchArray($result);
/**
- * @param $result
+ * Fetch a result row as an associative array
*
- * @abstract
+ * @param resource $result resource to get result from
+ *
+ * @return array
+ * @deprecated since version 2.6.0 - alpha 3
*/
abstract function fetchBoth($result);
/**
- * @param $result
+ * Fetch a result row as an object
*
+ * @param resource $result resource to get result from
+ *
+ * @return object|stdClass
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function fetchObject($result);
/**
+ * Get the ID generated from the previous INSERT operation
+ *
+ * @return int
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function getInsertId();
/**
- * @param $result
+ * Get number of rows in result
*
+ * @param resource $result the resource containing the number of rows
+ *
+ * @return int the number of rows to return
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function getRowsNum($result);
/**
+ * Get number of affected rows
+ *
+ * @return int
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function getAffectedRows();
/**
+ * Close MySQL connection
+ *
+ * @return void
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function close();
/**
- * @param $result
+ * Free all memory associated with the result identifier result.
*
+ * @param resource $result query result
+ *
+ * @return bool TRUE on success or FALSE on failure.
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function freeRecordSet($result);
/**
+ * Returns the text of the error message from previous MySQL operation
+ *
+ * @return bool Returns the error text from the last MySQL function,
+ * or '' (the empty string) if no error occurred.
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function error();
/**
+ * Returns the numerical value of the error message from previous
+ * MySQL operation
+ *
+ * @return int Returns the error number from the last MySQL function
+ * , or 0 (zero) if no error occurred.
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function errno();
/**
- * @param $str
+ * Returns escaped string text with single
+ * quotes around it to be safely stored in database
*
+ * @param string $str unescaped string text
+ *
+ * @return string escaped string text with single quotes around
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function quoteString($str);
/**
- * @param $string
+ * Quotes a string for use in a query.
*
+ * @param string $string string to quote
+ *
+ * @return string
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function quote($string);
/**
- * @param $sql
- * @param int $limit
- * @param int $start
+ * perform a query on the database
*
+ * @param string $sql a valid MySQL query
+ * @param int $limit number of records to return
+ * @param int $start offset of first record to return
+ *
+ * @return bool|resource query result or FALSE if successful
+ * or TRUE if successful and no result
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function queryF($sql, $limit = 0, $start = 0);
/**
- * @param $sql
- * @param int $limit
- * @param int $start
+ * perform a query
*
+ * This method is empty and does nothing! It should therefore only be
+ * used if nothing is exactly what you want done! ;-)
+ *
+ * @param string $sql a valid MySQL query
+ * @param int $limit number of records to return
+ * @param int $start offset of first record to return
+ *
+ * @return this returns nothing
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function query($sql, $limit = 0, $start = 0);
/**
- * @param $file
+ * perform queries from SQL dump file in a batch
*
+ * @param string $file file path to an SQL dump file
+ *
+ * @return bool FALSE if failed reading SQL file or TRUE
+ * if the file has been read and queries executed
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function queryFromFile($file);
/**
- * @param $result
- * @param $offset
+ * Get field name
*
+ * @param resource $result query result
+ * @param int $offset numerical field index
+ *
+ * @return string
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function getFieldName($result, $offset);
/**
- * @param $result
- * @param $offset
+ * Get field type
*
+ * @param resource $result query result
+ * @param int $offset numerical field index
+ *
+ * @return string
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function getFieldType($result, $offset);
/**
- * @param $result
+ * Get number of fields in result
*
+ * @param resource $result query result
+ *
+ * @return int
+ * @deprecated since version 2.6.0 - alpha 3
* @abstract
*/
abstract function getFieldsNum($result);
-}
\ No newline at end of file
+}
Modified: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/databasefactory.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/databasefactory.php 2013-08-24 22:35:00 UTC (rev 11975)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/databasefactory.php 2013-08-24 23:41:24 UTC (rev 11976)
@@ -1,22 +1,25 @@
<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
/**
* Factory Class for XOOPS Database
*
- * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @package class
- * @subpackage database
- * @version $Id$
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material
+ * of the original comment or credit authors.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @category Xoops\Class\Database\Xoopsdatabasefactory
+ * @package Class
+ * @subpackage Database
+ * @author Kazumi Ono <on...@xo...>
+ * @copyright 2013 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @version $Id$
+ * @link http://xoops.org
+ * @since 1.0
*/
defined('XOOPS_ROOT_PATH') or die('Restricted access');
@@ -24,9 +27,13 @@
/**
* XoopsDatabaseFactory
*
- * @package Kernel
- * @author Kazumi Ono <on...@xo...>
- * @access public
+ * @category Xoops\Class\Database\Xoopsdatabasefactory
+ * @package Kernel
+ * @author Kazumi Ono <on...@xo...>
+ * @access public
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @link http://xoops.org
+ * @since 1.0
*/
class XoopsDatabaseFactory
@@ -43,6 +50,7 @@
*
* @static
* @staticvar XoopsDatabase The only instance of database class
+ *
* @return XoopsDatabase Reference to the only instance of database class
*/
static function getDatabaseConnection()
@@ -57,26 +65,31 @@
'user' => XOOPS_DB_USER,
'password' => XOOPS_DB_PASS,
'host' => XOOPS_DB_HOST,
-// 'port' => ?,
-// 'unix_socket' => ?,
+ 'port' => '',
+ 'unix_socket' => '',
'charset' => XOOPS_DB_CHARSET,
'driver' => 'pdo_mysql',
'wrapperClass' => 'XoopsConnection',
- // 'driverOptions' => array (PDO::ATTR_PERSISTENT => TRUE)
- // this is how you call them but not compatible with doctrine.
-
+ 'driverOptions' => ''
);
- $instance = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
+ $instance
+ = \Doctrine\DBAL\DriverManager::getConnection(
+ $connectionParams,
+ $config
+ );
// Legacy support
- if (isset($instance)) {
- require_once XOOPS_ROOT_PATH . '/class/database/mysqldatabase.php';
+ if (isset($instance)) {
+ include_once XOOPS_ROOT_PATH . '/class/database/mysqldatabase.php';
if (!defined('XOOPS_DB_PROXY')) {
$class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseSafe';
} else {
$class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseProxy';
}
$xoopsPreload = XoopsPreload::getInstance();
- $xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class));
+ $xoopsPreload->triggerEvent(
+ 'core.class.database.databasefactory.connection',
+ array(&$class)
+ );
$xoopsDB = new $class();
$xoopsDB->setPrefix(XOOPS_DB_PREFIX);
$xoopsDB->conn = $instance;
@@ -86,27 +99,9 @@
trigger_error('notrace:Unable to connect to database', E_USER_ERROR);
}
}
- //echo '<pre>'.print_r($xoopsDB, true).print_r($instance, true) . '</pre>'. 'done... <br />';
return $instance;
}
- /* static function getNewDatabaseConnection()
- {
- static $instance;
- if (!isset($instance)) {
- require_once 'xoopsdatabase.php';
- $xoopsPreload = XoopsPreload::getInstance();
- $xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class));
- /* @var $instance XoopsDatabase */
- /* $instance = new $class();
- $instance->setPrefix(XOOPS_DB_PREFIX);
- if (!$instance->connect()) {
- trigger_error('notrace:Unable to connect to database', E_USER_ERROR);
- }
- }
- return $instance;
- } */
-
/**
* Gets a reference to the only instance of database class. Currently
* only being used within the installer.
@@ -119,7 +114,10 @@
{
static $database;
if (!isset($database)) {
- if (XoopsLoad::fileExists($file = XOOPS_ROOT_PATH . '/class/database/' . XOOPS_DB_TYPE . 'database.php')) {
+ if (XoopsLoad::fileExists(
+ $file = XOOPS_ROOT_PATH . '/class/database/'
+ . XOOPS_DB_TYPE . 'database.php'
+ )) {
include_once $file;
if (!defined('XOOPS_DB_PROXY')) {
$class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseSafe';
@@ -129,9 +127,13 @@
unset($database);
$database = new $class();
} else {
- trigger_error('notrace:Failed to load database of type: ' . XOOPS_DB_TYPE . ' in file: ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
+ trigger_error(
+ 'notrace:Failed to load database of type: ' . XOOPS_DB_TYPE
+ . ' in file: ' . __FILE__ . ' at line '
+ . __LINE__, E_USER_WARNING
+ );
}
}
return $database;
}
-}
\ No newline at end of file
+}
Modified: XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/manager.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/manager.php 2013-08-24 22:35:00 UTC (rev 11975)
+++ XoopsCore/branches/2.6.x/2.6.0_doctrine/htdocs/class/database/manager.php 2013-08-24 23:41:24 UTC (rev 11976)
@@ -1,24 +1,41 @@
<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
+/**
+ * Database manager for XOOPS
+ *
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material
+ * of the original comment or credit authors.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*/
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @category Xoops\Class\Database\Manager
+ * @package Class
+ * @subpackage Database
+ * @author Haruki Setoyama <ha...@pl...>
+ * @copyright 2013 The XOOPS project http://sourceforge.net/projects/xoops/
+ * @license G...
[truncated message content] |