Move abstract classes and interfaces to their own respective folders
This commit is contained in:
parent
bccea8cd2b
commit
600c07f1ca
44
autoload.php
44
autoload.php
@ -45,25 +45,41 @@ function query_autoload($class)
|
|||||||
$class_segments = explode('\\', $class);
|
$class_segments = explode('\\', $class);
|
||||||
$class = strtolower(array_pop($class_segments));
|
$class = strtolower(array_pop($class_segments));
|
||||||
|
|
||||||
// Load Firebird separately
|
// Load DB Driver classes
|
||||||
if (function_exists('fbird_connect') && $class === 'firebird')
|
if ($class_segments == array('Query', 'Driver'))
|
||||||
{
|
{
|
||||||
array_map('do_include', glob(QDRIVER_PATH.'/firebird/*.php'));
|
$driver_path = QDRIVER_PATH . "{$class}";
|
||||||
return;
|
// @codeCoverageIgnoreStart
|
||||||
|
if (is_dir($driver_path))
|
||||||
|
{
|
||||||
|
// Firebird is a special case, since it's not a PDO driver
|
||||||
|
if (
|
||||||
|
in_array($class, PDO::getAvailableDrivers())
|
||||||
|
|| function_exists('fbird_connect') && $class === 'firebird'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
array_map('do_include', glob("{$driver_path}/*.php"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
$class_path = QBASE_PATH . "classes/{$class}.php";
|
// Load other classes
|
||||||
|
foreach(array(
|
||||||
$driver_path = QDRIVER_PATH . "{$class}";
|
QBASE_PATH . "classes/interfaces/{$class}.php",
|
||||||
|
QBASE_PATH . "classes/abstract/{$class}.php",
|
||||||
if (is_file($class_path)) require_once($class_path);
|
QBASE_PATH . "classes/{$class}.php"
|
||||||
elseif (is_dir($driver_path))
|
) as $path)
|
||||||
{
|
{
|
||||||
$class = str_replace("pdo_", "", $class);
|
if (file_exists($path))
|
||||||
|
|
||||||
if (in_array($class, PDO::getAvailableDrivers()))
|
|
||||||
{
|
{
|
||||||
array_map('do_include', glob("{$driver_path}/*.php"));
|
// @codeCoverageIgnoreStart
|
||||||
|
require_once($path);
|
||||||
|
return;
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ function db_filter($array, $index)
|
|||||||
/**
|
/**
|
||||||
* Connection function
|
* Connection function
|
||||||
*
|
*
|
||||||
* @param mixed $params
|
* @param string|object|array $params
|
||||||
* @return Query_Builder
|
* @return Query_Builder
|
||||||
*/
|
*/
|
||||||
function Query($params = '')
|
function Query($params = '')
|
||||||
@ -89,7 +89,7 @@ function Query($params = '')
|
|||||||
{
|
{
|
||||||
return $cmanager->get_connection($params);
|
return $cmanager->get_connection($params);
|
||||||
}
|
}
|
||||||
elseif ( ! is_scalar($params))
|
elseif ( ! is_scalar($params) && ! is_null($params))
|
||||||
{
|
{
|
||||||
$params = new ArrayObject($params, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
|
$params = new ArrayObject($params, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user