Skip to content

Commit

Permalink
Merge pull request SimpleMachines#390 from gnif/MySQLi
Browse files Browse the repository at this point in the history
Added MySQLi database abstraction layer
  • Loading branch information
Oldiesmann committed Jun 19, 2013
2 parents d272b1e + 1fd5a2b commit f5d3043
Show file tree
Hide file tree
Showing 13 changed files with 1,207 additions and 270 deletions.
8 changes: 4 additions & 4 deletions Sources/ManageMaintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ function MaintainDatabase()
global $context, $db_type, $db_character_set, $modSettings, $smcFunc, $txt, $maintenance;

// Show some conversion options?
$context['convert_utf8'] = $db_type == 'mysql' && (!isset($db_character_set) || $db_character_set !== 'utf8' || empty($modSettings['global_character_set']) || $modSettings['global_character_set'] !== 'UTF-8') && version_compare('4.1.2', preg_replace('~\-.+?$~', '', $smcFunc['db_server_info']()), '<=');
$context['convert_entities'] = $db_type == 'mysql' && isset($db_character_set, $modSettings['global_character_set']) && $db_character_set === 'utf8' && $modSettings['global_character_set'] === 'UTF-8';
$context['convert_utf8'] = ($db_type == 'mysql' || $db_type == 'mysqli') && (!isset($db_character_set) || $db_character_set !== 'utf8' || empty($modSettings['global_character_set']) || $modSettings['global_character_set'] !== 'UTF-8') && version_compare('4.1.2', preg_replace('~\-.+?$~', '', $smcFunc['db_server_info']()), '<=');
$context['convert_entities'] = ($db_type == 'mysql' || $db_type == 'mysqli') && isset($db_character_set, $modSettings['global_character_set']) && $db_character_set === 'utf8' && $modSettings['global_character_set'] === 'UTF-8';

if ($db_type == 'mysql')
if ($db_type == 'mysql' || $db_type == 'mysqli')
{
db_extend('packages');

Expand Down Expand Up @@ -722,7 +722,7 @@ function ConvertMsgBody()
// Show me your badge!
isAllowedTo('admin_forum');

if ($db_type != 'mysql')
if ($db_type != 'mysql' && $db_type != 'mysqli')
return;

db_extend('packages');
Expand Down
2 changes: 1 addition & 1 deletion Sources/ManagePosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function ModifyPostSettings($return_config = false)
checkSession();

// If we're changing the message length (and we are using MySQL) let's check the column is big enough.
if (isset($_POST['max_messageLength']) && $_POST['max_messageLength'] != $modSettings['max_messageLength'] && $db_type == 'mysql')
if (isset($_POST['max_messageLength']) && $_POST['max_messageLength'] != $modSettings['max_messageLength'] && ($db_type == 'mysql' || $db_type == 'mysqli'))
{
db_extend('packages');

Expand Down
2 changes: 1 addition & 1 deletion Sources/ManageSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ function EditSearchMethod()
);

// Get some info about the messages table, to show its size and index size.
if ($db_type == 'mysql')
if ($db_type == 'mysql' || $db_type == 'mysqli')
{
if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0)
$request = $smcFunc['db_query']('', '
Expand Down
2 changes: 1 addition & 1 deletion Sources/ScheduledTasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function scheduled_daily_maintenance()

// Check the database version - for some buggy MySQL version.
$server_version = $smcFunc['db_server_info']();
if ($db_type == 'mysql' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51')))
if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51')))
updateSettings(array('db_mysql_group_by_fix' => '1'));
elseif (!empty($modSettings['db_mysql_group_by_fix']))
$smcFunc['db_query']('', '
Expand Down
2 changes: 1 addition & 1 deletion Sources/SearchAPI-Custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class custom_search
* What databases support the custom index?
* @var type
*/
protected $supported_databases = array('mysql', 'postgresql', 'sqlite');
protected $supported_databases = array('mysql', 'mysqli', 'postgresql', 'sqlite');

/**
* constructor function
Expand Down
2 changes: 1 addition & 1 deletion Sources/SearchAPI-Fulltext.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class fulltext_search
* What databases support the fulltext index?
* @var type
*/
protected $supported_databases = array('mysql');
protected $supported_databases = array('mysql', 'mysqli');

/**
* fulltext_search::__construct()
Expand Down
Loading

0 comments on commit f5d3043

Please sign in to comment.