mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-07 17:27:16 +02:00
Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/11103
# By Oleg Pudeyev (21) and others # Via Andreas Fischer (7) and others * 'develop' of github.com:phpbb/phpbb3: (56 commits) [ticket/11015] Move comment in the right place. [ticket/11015] Correctly transform 'mysqli' etc. in phpbb_convert_30_dbms_to_31 [ticket/11015] Fix 3.0 to 3.1 dbms conversion for mysqli. [ticket/11015] Change permission adding in database updater to new style. [ticket/11015] Change more docblocks to phpbb_db_driver. [ticket/11015] Installer still needs 3.0-style dbms name. [ticket/11262] Add .lock in cache directory to .gitignore [ticket/11015] Include functions.php because it is not always included. [ticket/11265] Add assertions for board installation success. [ticket/11263] Fix PHP Notice: Undefined variable: extension_manager [ticket/11015] Convert database drivers to new spelling in post setup sync. [ticket/11015] Convert connect test to the new syntax. [ticket/11015] Restore whitespace to avoid conflict when merging develop. [ticket/10975] Add a test for viewing a profile. [ticket/10975] Test restricting by first character. [ticket/10975] Avoid rewriting global config twice. [ticket/10975] Test memberlist, not user creation. [ticket/10975] Some quick tests to check the memberlist behaviour [ticket/10491] Make recreate_database static. [ticket/11088] Pass required objects in as arguments ... Conflicts: phpBB/install/database_update.php
This commit is contained in:
@@ -16,10 +16,10 @@ class acp_extensions_info
|
||||
{
|
||||
return array(
|
||||
'filename' => 'acp_extensions',
|
||||
'title' => 'ACP_EXTENSIONS',
|
||||
'title' => 'ACP_EXTENSIONS_MANAGEMENT',
|
||||
'version' => '1.0.0',
|
||||
'modes' => array(
|
||||
'main' => array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_GENERAL_TASKS')),
|
||||
'main' => array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_EXTENSIONS_MANAGEMENT')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ class acp_language_info
|
||||
'title' => 'ACP_LANGUAGE',
|
||||
'version' => '1.0.0',
|
||||
'modes' => array(
|
||||
'lang_packs' => array('title' => 'ACP_LANGUAGE_PACKS', 'auth' => 'acl_a_language', 'cat' => array('ACP_GENERAL_TASKS')),
|
||||
'lang_packs' => array('title' => 'ACP_LANGUAGE_PACKS', 'auth' => 'acl_a_language', 'cat' => array('ACP_LANGUAGE')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ class phpbb_config_db extends phpbb_config
|
||||
|
||||
/**
|
||||
* Database connection
|
||||
* @var dbal
|
||||
* @var phpbb_db_driver
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
@@ -42,11 +42,11 @@ class phpbb_config_db extends phpbb_config
|
||||
/**
|
||||
* Creates a configuration container with a default set of values
|
||||
*
|
||||
* @param dbal $db Database connection
|
||||
* @param phpbb_db_driver $db Database connection
|
||||
* @param phpbb_cache_driver_interface $cache Cache instance
|
||||
* @param string $table Configuration table name
|
||||
*/
|
||||
public function __construct(dbal $db, phpbb_cache_driver_interface $cache, $table)
|
||||
public function __construct(phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $table)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->cache = $cache;
|
||||
|
@@ -37,9 +37,9 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_config $config The config
|
||||
* @param dbal $db The db connection
|
||||
* @param phpbb_db_driver $db The db connection
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db)
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
@@ -47,9 +47,9 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_config $config The config
|
||||
* @param dbal $db The db connection
|
||||
* @param phpbb_db_driver $db The db connection
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db)
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
@@ -38,10 +38,10 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_auth $auth The auth
|
||||
* @param phpbb_config $config The config
|
||||
* @param dbal $db The db connection
|
||||
* @param phpbb_db_driver $db The db connection
|
||||
* @param phpbb_user $user The user
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, dbal $db, phpbb_user $user)
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, phpbb_db_driver $db, phpbb_user $user)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
@@ -300,7 +300,7 @@ class phpbb_db_tools
|
||||
/**
|
||||
* Constructor. Set DB Object and set {@link $return_statements return_statements}.
|
||||
*
|
||||
* @param phpbb_dbal $db DBAL object
|
||||
* @param phpbb_db_driver $db Database connection
|
||||
* @param bool $return_statements True if only statements should be returned and no SQL being executed
|
||||
*/
|
||||
function phpbb_db_tools(&$db, $return_statements = false)
|
||||
|
@@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
|
||||
* Database Abstraction Layer
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal
|
||||
class phpbb_db_driver
|
||||
{
|
||||
var $db_connect_id;
|
||||
var $query_result;
|
||||
@@ -72,17 +72,17 @@ class dbal
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function dbal()
|
||||
function __construct()
|
||||
{
|
||||
$this->num_queries = array(
|
||||
'cached' => 0,
|
||||
'normal' => 0,
|
||||
'total' => 0,
|
||||
'cached' => 0,
|
||||
'normal' => 0,
|
||||
'total' => 0,
|
||||
);
|
||||
|
||||
// Fill default sql layer based on the class being called.
|
||||
// This can be changed by the specified layer itself later if needed.
|
||||
$this->sql_layer = substr(get_class($this), 5);
|
||||
$this->sql_layer = substr(get_class($this), strlen('phpbb_db_driver_'));
|
||||
|
||||
// Do not change this please! This variable is used to easy the use of it - and is hardcoded.
|
||||
$this->any_char = chr(0) . '%';
|
||||
@@ -1042,8 +1042,3 @@ class dbal
|
||||
return $rows_total;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This variable holds the class name to use later
|
||||
*/
|
||||
$sql_db = (!empty($dbms)) ? 'dbal_' . basename($dbms) : 'dbal';
|
@@ -15,14 +15,12 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* Firebird/Interbase Database Abstraction Layer
|
||||
* Minimum Requirement is Firebird 2.1
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_firebird extends dbal
|
||||
class phpbb_db_driver_firebird extends phpbb_db_driver
|
||||
{
|
||||
var $last_query_text = '';
|
||||
var $service_handle = false;
|
@@ -15,14 +15,12 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* MSSQL Database Abstraction Layer
|
||||
* Minimum Requirement is MSSQL 2000+
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_mssql extends dbal
|
||||
class phpbb_db_driver_mssql extends phpbb_db_driver
|
||||
{
|
||||
var $connect_error = '';
|
||||
|
@@ -15,8 +15,6 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* Unified ODBC functions
|
||||
* Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere...
|
||||
@@ -28,7 +26,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
*
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_mssql_odbc extends dbal
|
||||
class phpbb_db_driver_mssql_odbc extends phpbb_db_driver
|
||||
{
|
||||
var $last_query_text = '';
|
||||
var $connect_error = '';
|
@@ -19,8 +19,6 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* Prior to version 1.1 the SQL Server Native PHP driver didn't support sqlsrv_num_rows, or cursor based seeking so we recall all rows into an array
|
||||
* and maintain our own cursor index into that array.
|
||||
@@ -193,7 +191,7 @@ class result_mssqlnative
|
||||
/**
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_mssqlnative extends dbal
|
||||
class phpbb_db_driver_mssqlnative extends phpbb_db_driver
|
||||
{
|
||||
var $m_insert_id = NULL;
|
||||
var $last_query_text = '';
|
@@ -15,8 +15,6 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* MySQL4 Database Abstraction Layer
|
||||
* Compatible with:
|
||||
@@ -26,7 +24,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
* MySQL 5.0+
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_mysql extends dbal
|
||||
class phpbb_db_driver_mysql extends phpbb_db_driver
|
||||
{
|
||||
var $multi_insert = true;
|
||||
var $connect_error = '';
|
@@ -15,15 +15,13 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* MySQLi Database Abstraction Layer
|
||||
* mysqli-extension has to be compiled with:
|
||||
* MySQL 4.1+ or MySQL 5.0+
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_mysqli extends dbal
|
||||
class phpbb_db_driver_mysqli extends phpbb_db_driver
|
||||
{
|
||||
var $multi_insert = true;
|
||||
var $connect_error = '';
|
@@ -15,13 +15,11 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* Oracle Database Abstraction Layer
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_oracle extends dbal
|
||||
class phpbb_db_driver_oracle extends phpbb_db_driver
|
||||
{
|
||||
var $last_query_text = '';
|
||||
var $connect_error = '';
|
@@ -15,19 +15,12 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
if (!class_exists('phpbb_error_collector'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* PostgreSQL Database Abstraction Layer
|
||||
* Minimum Requirement is Version 7.3+
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_postgres extends dbal
|
||||
class phpbb_db_driver_postgres extends phpbb_db_driver
|
||||
{
|
||||
var $last_query_text = '';
|
||||
var $connect_error = '';
|
@@ -15,14 +15,12 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
|
||||
/**
|
||||
* Sqlite Database Abstraction Layer
|
||||
* Minimum Requirement: 2.8.2+
|
||||
* @package dbal
|
||||
*/
|
||||
class dbal_sqlite extends dbal
|
||||
class phpbb_db_driver_sqlite extends phpbb_db_driver
|
||||
{
|
||||
var $connect_error = '';
|
||||
|
@@ -43,8 +43,8 @@ class phpbb_di_extension_config extends Extension
|
||||
require($this->config_file);
|
||||
|
||||
$container->setParameter('core.table_prefix', $table_prefix);
|
||||
$container->setParameter('cache.driver.class', $this->fix_acm_type($acm_type));
|
||||
$container->setParameter('dbal.driver.class', 'dbal_'.$dbms);
|
||||
$container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
|
||||
$container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($dbms));
|
||||
$container->setParameter('dbal.dbhost', $dbhost);
|
||||
$container->setParameter('dbal.dbuser', $dbuser);
|
||||
$container->setParameter('dbal.dbpasswd', $dbpasswd);
|
||||
@@ -66,12 +66,12 @@ class phpbb_di_extension_config extends Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert old (3.0) values to 3.1 class names
|
||||
* Convert 3.0 ACM type to 3.1 cache driver class name
|
||||
*
|
||||
* @param style $acm_type ACM type
|
||||
* @return ACM type class
|
||||
* @param string $acm_type ACM type
|
||||
* @return cache driver class
|
||||
*/
|
||||
protected function fix_acm_type($acm_type)
|
||||
protected function convert_30_acm_type($acm_type)
|
||||
{
|
||||
if (preg_match('#^[a-z]+$#', $acm_type))
|
||||
{
|
||||
|
@@ -34,7 +34,7 @@ class phpbb_extension_manager
|
||||
/**
|
||||
* Creates a manager and loads information from database
|
||||
*
|
||||
* @param dbal $db A database connection
|
||||
* @param phpbb_db_driver $db A database connection
|
||||
* @param phpbb_config $config phpbb_config
|
||||
* @param string $extension_table The name of the table holding extensions
|
||||
* @param string $phpbb_root_path Path to the phpbb includes directory.
|
||||
@@ -42,7 +42,7 @@ class phpbb_extension_manager
|
||||
* @param phpbb_cache_driver_interface $cache A cache instance or null
|
||||
* @param string $cache_name The name of the cache variable, defaults to _ext
|
||||
*/
|
||||
public function __construct(dbal $db, phpbb_config $config, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
|
||||
public function __construct(phpbb_db_driver $db, phpbb_config $config, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->db = $db;
|
||||
|
@@ -34,12 +34,12 @@ class phpbb_extension_metadata_manager
|
||||
/**
|
||||
* Creates the metadata manager
|
||||
*
|
||||
* @param dbal $db A database connection
|
||||
* @param phpbb_db_driver $db A database connection
|
||||
* @param string $extension_manager An instance of the phpbb extension manager
|
||||
* @param string $phpbb_root_path Path to the phpbb includes directory.
|
||||
* @param string $phpEx php file extension
|
||||
*/
|
||||
public function __construct($ext_name, dbal $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php', phpbb_template $template, phpbb_config $config)
|
||||
public function __construct($ext_name, phpbb_db_driver $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php', phpbb_template $template, phpbb_config $config)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->db = $db;
|
||||
|
@@ -5627,6 +5627,52 @@ function phpbb_to_numeric($input)
|
||||
return ($input > PHP_INT_MAX) ? (float) $input : (int) $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name.
|
||||
*
|
||||
* If $dbms is a valid 3.1 db driver class name, returns it unchanged.
|
||||
* Otherwise prepends phpbb_db_driver_ to the dbms to convert a 3.0 dbms
|
||||
* to 3.1 db driver class name.
|
||||
*
|
||||
* @param string $dbms dbms parameter
|
||||
* @return db driver class
|
||||
*/
|
||||
function phpbb_convert_30_dbms_to_31($dbms)
|
||||
{
|
||||
// Note: this check is done first because mysqli extension
|
||||
// supplies a mysqli class, and class_exists($dbms) would return
|
||||
// true for mysqli class.
|
||||
// However, per the docblock any valid 3.1 driver name should be
|
||||
// recognized by this function, and have priority over 3.0 dbms.
|
||||
if (class_exists('phpbb_db_driver_' . $dbms))
|
||||
{
|
||||
return 'phpbb_db_driver_' . $dbms;
|
||||
}
|
||||
|
||||
if (class_exists($dbms))
|
||||
{
|
||||
// Additionally we could check that $dbms extends phpbb_db_driver.
|
||||
// http://php.net/manual/en/class.reflectionclass.php
|
||||
// Beware of possible performance issues:
|
||||
// http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
|
||||
// We could check for interface implementation in all paths or
|
||||
// only when we do not prepend phpbb_db_driver_.
|
||||
|
||||
/*
|
||||
$reflection = new \ReflectionClass($dbms);
|
||||
|
||||
if ($reflection->isSubclassOf('phpbb_db_driver'))
|
||||
{
|
||||
return $dbms;
|
||||
}
|
||||
*/
|
||||
|
||||
return $dbms;
|
||||
}
|
||||
|
||||
throw new \RuntimeException("You have specified an invalid dbms driver: $dbms");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Symfony Request object from phpbb_request object
|
||||
*
|
||||
|
@@ -596,7 +596,7 @@ function phpbb_parse_range_request($request_array, $filesize)
|
||||
/**
|
||||
* Increments the download count of all provided attachments
|
||||
*
|
||||
* @param dbal $db The database object
|
||||
* @param phpbb_db_driver $db The database object
|
||||
* @param array|int $ids The attach_id of each attachment
|
||||
*
|
||||
* @return null
|
||||
@@ -617,7 +617,7 @@ function phpbb_increment_downloads($db, $ids)
|
||||
/**
|
||||
* Handles authentication when downloading attachments from a post or topic
|
||||
*
|
||||
* @param dbal $db The database object
|
||||
* @param phpbb_db_driver $db The database object
|
||||
* @param phpbb_auth $auth The authentication object
|
||||
* @param int $topic_id The id of the topic that we are downloading from
|
||||
*
|
||||
@@ -651,7 +651,7 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id)
|
||||
/**
|
||||
* Handles authentication when downloading attachments from PMs
|
||||
*
|
||||
* @param dbal $db The database object
|
||||
* @param phpbb_db_driver $db The database object
|
||||
* @param phpbb_auth $auth The authentication object
|
||||
* @param int $user_id The user id
|
||||
* @param int $msg_id The id of the PM that we are downloading from
|
||||
@@ -678,7 +678,7 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id)
|
||||
/**
|
||||
* Checks whether a user can download from a particular PM
|
||||
*
|
||||
* @param dbal $db The database object
|
||||
* @param phpbb_db_driver $db The database object
|
||||
* @param int $user_id The user id
|
||||
* @param int $msg_id The id of the PM that we are downloading from
|
||||
*
|
||||
|
@@ -28,7 +28,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'firebird',
|
||||
'MODULE' => 'interbase',
|
||||
'DELIM' => ';;',
|
||||
'DRIVER' => 'firebird',
|
||||
'DRIVER' => 'phpbb_db_driver_firebird',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
@@ -37,7 +37,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'mysql_41',
|
||||
'MODULE' => 'mysqli',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'mysqli',
|
||||
'DRIVER' => 'phpbb_db_driver_mysqli',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
@@ -46,7 +46,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'mysql',
|
||||
'MODULE' => 'mysql',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'mysql',
|
||||
'DRIVER' => 'phpbb_db_driver_mysql',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
@@ -55,7 +55,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'mssql',
|
||||
'MODULE' => 'mssql',
|
||||
'DELIM' => 'GO',
|
||||
'DRIVER' => 'mssql',
|
||||
'DRIVER' => 'phpbb_db_driver_mssql',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
@@ -64,7 +64,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'mssql',
|
||||
'MODULE' => 'odbc',
|
||||
'DELIM' => 'GO',
|
||||
'DRIVER' => 'mssql_odbc',
|
||||
'DRIVER' => 'phpbb_db_driver_mssql_odbc',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
@@ -73,7 +73,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'mssql',
|
||||
'MODULE' => 'sqlsrv',
|
||||
'DELIM' => 'GO',
|
||||
'DRIVER' => 'mssqlnative',
|
||||
'DRIVER' => 'phpbb_db_driver_mssqlnative',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
@@ -82,7 +82,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'oracle',
|
||||
'MODULE' => 'oci8',
|
||||
'DELIM' => '/',
|
||||
'DRIVER' => 'oracle',
|
||||
'DRIVER' => 'phpbb_db_driver_oracle',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
@@ -91,7 +91,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'postgres',
|
||||
'MODULE' => 'pgsql',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'postgres',
|
||||
'DRIVER' => 'phpbb_db_driver_postgres',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
@@ -100,7 +100,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||
'SCHEMA' => 'sqlite',
|
||||
'MODULE' => 'sqlite',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'sqlite',
|
||||
'DRIVER' => 'phpbb_db_driver_sqlite',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
@@ -205,26 +205,19 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
|
||||
$dbms = $dbms_details['DRIVER'];
|
||||
|
||||
if ($load_dbal)
|
||||
{
|
||||
// Include the DB layer
|
||||
include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
|
||||
}
|
||||
|
||||
// Instantiate it and set return on error true
|
||||
$sql_db = 'dbal_' . $dbms;
|
||||
$db = new $sql_db();
|
||||
$db = new $dbms();
|
||||
$db->sql_return_on_error(true);
|
||||
|
||||
// Check that we actually have a database name before going any further.....
|
||||
if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '')
|
||||
if ($dbms_details['DRIVER'] != 'phpbb_db_driver_sqlite' && $dbms_details['DRIVER'] != 'phpbb_db_driver_oracle' && $dbname === '')
|
||||
{
|
||||
$error[] = $lang['INST_ERR_DB_NO_NAME'];
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
|
||||
if ($dbms_details['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0)
|
||||
if ($dbms_details['DRIVER'] == 'phpbb_db_driver_sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0)
|
||||
{
|
||||
$error[] = $lang['INST_ERR_DB_FORUM_PATH'];
|
||||
return false;
|
||||
@@ -233,8 +226,8 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
// Check the prefix length to ensure that index names are not too long and does not contain invalid characters
|
||||
switch ($dbms_details['DRIVER'])
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
case 'phpbb_db_driver_mysql':
|
||||
case 'phpbb_db_driver_mysqli':
|
||||
if (strspn($table_prefix, '-./\\') !== 0)
|
||||
{
|
||||
$error[] = $lang['INST_ERR_PREFIX_INVALID'];
|
||||
@@ -243,22 +236,22 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
|
||||
// no break;
|
||||
|
||||
case 'postgres':
|
||||
case 'phpbb_db_driver_postgres':
|
||||
$prefix_length = 36;
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
case 'mssqlnative':
|
||||
case 'phpbb_db_driver_mssql':
|
||||
case 'phpbb_db_driver_mssql_odbc':
|
||||
case 'phpbb_db_driver_mssqlnative':
|
||||
$prefix_length = 90;
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
case 'phpbb_db_driver_sqlite':
|
||||
$prefix_length = 200;
|
||||
break;
|
||||
|
||||
case 'firebird':
|
||||
case 'oracle':
|
||||
case 'phpbb_db_driver_firebird':
|
||||
case 'phpbb_db_driver_oracle':
|
||||
$prefix_length = 6;
|
||||
break;
|
||||
}
|
||||
@@ -296,21 +289,21 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
// Make sure that the user has selected a sensible DBAL for the DBMS actually installed
|
||||
switch ($dbms_details['DRIVER'])
|
||||
{
|
||||
case 'mysqli':
|
||||
case 'phpbb_db_driver_mysqli':
|
||||
if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<'))
|
||||
{
|
||||
$error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
case 'phpbb_db_driver_sqlite':
|
||||
if (version_compare(sqlite_libversion(), '2.8.2', '<'))
|
||||
{
|
||||
$error[] = $lang['INST_ERR_DB_NO_SQLITE'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'firebird':
|
||||
case 'phpbb_db_driver_firebird':
|
||||
// check the version of FB, use some hackery if we can't get access to the server info
|
||||
if ($db->service_handle !== false && function_exists('ibase_server_info'))
|
||||
{
|
||||
@@ -391,7 +384,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
}
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
case 'phpbb_db_driver_oracle':
|
||||
if ($unicode_check)
|
||||
{
|
||||
$sql = "SELECT *
|
||||
@@ -413,7 +406,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgres':
|
||||
case 'phpbb_db_driver_postgres':
|
||||
if ($unicode_check)
|
||||
{
|
||||
$sql = "SHOW server_encoding;";
|
||||
|
@@ -210,7 +210,7 @@ class messenger
|
||||
{
|
||||
$style_resource_locator = new phpbb_style_resource_locator();
|
||||
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
|
||||
$tpl = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $extension_manager);
|
||||
$tpl = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager);
|
||||
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl);
|
||||
|
||||
$this->tpl_msg[$template_lang . $template_file] = $tpl;
|
||||
|
@@ -48,7 +48,7 @@ class phpbb_lock_db
|
||||
|
||||
/**
|
||||
* A database connection
|
||||
* @var dbal
|
||||
* @var phpbb_db_driver
|
||||
*/
|
||||
private $db;
|
||||
|
||||
@@ -59,9 +59,9 @@ class phpbb_lock_db
|
||||
*
|
||||
* @param string $config_name A config variable to be used for locking
|
||||
* @param array $config The phpBB configuration
|
||||
* @param dbal $db A database connection
|
||||
* @param phpbb_db_driver $db A database connection
|
||||
*/
|
||||
public function __construct($config_name, phpbb_config $config, dbal $db)
|
||||
public function __construct($config_name, phpbb_config $config, phpbb_db_driver $db)
|
||||
{
|
||||
$this->config_name = $config_name;
|
||||
$this->config = $config;
|
||||
|
@@ -260,6 +260,8 @@ class phpbb_questionnaire_phpbb_data_provider
|
||||
include("{$phpbb_root_path}config.$phpEx");
|
||||
unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
|
||||
|
||||
$dbms = phpbb_convert_30_dbms_to_31($dbms);
|
||||
|
||||
// Only send certain config vars
|
||||
$config_vars = array(
|
||||
'active_sessions' => true,
|
||||
|
@@ -41,8 +41,8 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* DBAL object
|
||||
* @var dbal
|
||||
* Database connection
|
||||
* @var phpbb_db_driver
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
|
@@ -85,8 +85,8 @@ class phpbb_search_fulltext_native extends phpbb_search_base
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* DBAL object
|
||||
* @var dbal
|
||||
* Database connection
|
||||
* @var phpbb_db_driver
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
|
@@ -66,8 +66,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* DBAL object
|
||||
* @var dbal
|
||||
* Database connection
|
||||
* @var phpbb_db_driver
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
|
@@ -84,8 +84,8 @@ class phpbb_search_fulltext_sphinx
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* DBAL object
|
||||
* @var dbal
|
||||
* Database connection
|
||||
* @var phpbb_db_driver
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
|
Reference in New Issue
Block a user