diff --git a/index.php b/index.php index 2530e3f..17fdf92 100644 --- a/index.php +++ b/index.php @@ -126,8 +126,6 @@ $mybb->settings['uploadspath'] = MYBB_ROOT.$mybb->settings['uploadspath']; } -require_once MYBB_ROOT."inc/class_xml.php"; - // Include the converter resources require_once MERGE_ROOT."resources/functions.php"; require_once MERGE_ROOT.'resources/output.php'; @@ -137,11 +135,11 @@ $mybb->config = $config; -if(file_exists(MYBB_ROOT."inc/db_base.php")) // MyBB 1.8.4+ -{ - require_once MYBB_ROOT."inc/db_base.php"; -} +require_once MYBB_ROOT."inc/db_base.php"; +require_once MYBB_ROOT.'inc/AbstractPdoDbDriver.php'; + require_once MYBB_ROOT."inc/db_{$config['database']['type']}.php"; + switch($config['database']['type']) { case "sqlite": @@ -150,9 +148,15 @@ case "pgsql": $db = new DB_PgSQL; break; + case "pgsql_pdo": + $db = new PostgresPdoDbDriver(); + break; case "mysqli": $db = new DB_MySQLi; break; + case "mysql_pdo": + $db = new MysqlPdoDbDriver(); + break; default: $db = new DB_MySQL; } @@ -595,11 +599,10 @@ $checks['version_check_status'] = ''.$lang->requirementspage_uptodate.''; // Check for a new version of the Merge System! - require_once MYBB_ROOT."inc/class_xml.php"; $contents = merge_fetch_remote_file("http://www.mybb.com/merge_version_check.php"); - if($contents) + if(!empty($contents)) { - $parser = new XMLParser($contents); + $parser = create_xml_parser($contents); $tree = $parser->get_tree(); $latest_code = (int)$tree['mybb_merge']['version_code']['value']; diff --git a/resources/class_converter.php b/resources/class_converter.php index 1c13385..ca0f881 100644 --- a/resources/class_converter.php +++ b/resources/class_converter.php @@ -26,7 +26,7 @@ abstract class Converter var $debug; /** - * @var DB_MySQL|DB_MySQLi|DB_PgSQL|DB_SQLite + * @var DB_MySQL|DB_MySQLi|DB_PgSQL|DB_SQLite|PostgresPdoDbDriver|MysqlPdoDbDriver */ var $old_db; @@ -168,9 +168,15 @@ function db_connect() case "pgsql": $this->old_db = new DB_PgSQL; break; + case "pgsql_pdo": + $this->old_db = new PostgresPdoDbDriver(); + break; case "mysqli": $this->old_db = new DB_MySQLi; break; + case "mysql_pdo": + $this->old_db = new MysqlPdoDbDriver(); + break; default: $this->old_db = new DB_MySQL; } @@ -211,9 +217,15 @@ function db_configuration() case "pgsql": $this->old_db = new DB_PgSQL; break; + case "pgsql_pdo": + $this->old_db = new PostgresPdoDbDriver(); + break; case "mysqli": $this->old_db = new DB_MySQLi; break; + case "mysql_pdo": + $this->old_db = new MysqlPdoDbDriver(); + break; default: $this->old_db = new DB_MySQL; } @@ -324,8 +336,10 @@ function db_configuration() { $mybb->input['config'][$dbs]['tableprefix'] = $tableprefix; } - // Handling mysqli seperatly as the array above doesn't make a difference between mysql and mysqli + // Handling mysqli, mysql_pdo and pgsql_pdo separately. $mybb->input['config']["mysqli"]['tableprefix'] = $tableprefix; + $mybb->input['config']["mysql_pdo"]['tableprefix'] = $tableprefix; + $mybb->input['config']["pgsql_pdo"]['tableprefix'] = $tableprefix; if($import_session['old_db_user']) { diff --git a/resources/class_converter_module.php b/resources/class_converter_module.php index 2949d8b..8db42f9 100644 --- a/resources/class_converter_module.php +++ b/resources/class_converter_module.php @@ -26,7 +26,7 @@ abstract class Converter_Module var $default_values = array(); /** - * @var DB_MySQL|DB_MySQLi|DB_PgSQL|DB_SQLite + * @var DB_MySQL|DB_MySQLi|DB_PgSQL|DB_SQLite|PostgresPdoDbDriver|MysqlPdoDbDriver */ var $old_db; diff --git a/resources/class_debug.php b/resources/class_debug.php index ff5999f..ec75fb4 100644 --- a/resources/class_debug.php +++ b/resources/class_debug.php @@ -226,6 +226,7 @@ private function create_debug_table() );"); break; case "pgsql": + case "pgsql_pdo": $db->write_query("CREATE TABLE ".TABLE_PREFIX."debuglogs ( dlid serial, type int NOT NULL default '0', diff --git a/resources/class_error.php b/resources/class_error.php index 2f3cd42..bf9d0d5 100644 --- a/resources/class_error.php +++ b/resources/class_error.php @@ -31,7 +31,7 @@ function __construct() * @param integer $line The error line * @return boolean True if parsing was a success, otherwise assume a error */ - function error($type, $message, $file=null, $line=0) + function error($type, $message, $file=null, $line=0, $allow_output=true) { // Error reporting turned off (either globally or by @ before erroring statement) if(error_reporting() == 0) @@ -57,7 +57,7 @@ function error($type, $message, $file=null, $line=0) $this->debug->log->warning("\$type: {$type} \$message: {$message} \$file: {$file} \$line: {$line}"); } - return parent::error($type, $message, $file, $line); + return parent::error($type, $message, $file, $line, $allow_output); } /** diff --git a/resources/modules/forums.php b/resources/modules/forums.php index bb39512..5520188 100644 --- a/resources/modules/forums.php +++ b/resources/modules/forums.php @@ -163,6 +163,7 @@ function cleanup() { case "sqlite": case "pgsql": + case "pgsql_pdo": $query_child = $db->simple_select("forums", "fid", "','||parentlist||',' LIKE '%,{$forum['fid']},%'"); break; default: diff --git a/resources/output.php b/resources/output.php index 75f4805..67e70f4 100644 --- a/resources/output.php +++ b/resources/output.php @@ -446,10 +446,10 @@ function print_database_details_table($name, $extra="") ); } - if(class_exists('PDO') && in_array("sqlite", $board->supported_databases)) + if(class_exists('PDO')) { $supported_dbs = PDO::getAvailableDrivers(); - if(in_array('sqlite', $supported_dbs)) + if(in_array('sqlite', $supported_dbs) && in_array("sqlite", $board->supported_databases)) { $dboptions['sqlite'] = array( 'class' => 'DB_SQLite', @@ -457,6 +457,24 @@ function print_database_details_table($name, $extra="") 'short_title' => 'SQLite', ); } + + if(in_array('pgsql', $supported_dbs) && in_array("pgsql", $board->supported_databases)) + { + $dboptions['pgsql_pdo'] = array( + 'class' => 'PostgresPdoDbDriver', + 'title' => 'PostgreSQL (PDO)', + 'short_title' => 'PostgreSQL (PDO)', + ); + } + + if(in_array('mysql', $supported_dbs) && in_array("mysql", $board->supported_databases)) + { + $dboptions['mysql_pdo'] = array( + 'class' => 'MysqlPdoDbDriver', + 'title' => 'MySQL (PDO)', + 'short_title' => 'MySQL (PDO)', + ); + } } if(empty($dboptions)) @@ -510,7 +528,7 @@ function updateDBSettings() continue; } - /** @var DB_MySQL|DB_MySQLi|DB_PgSQL|DB_SQLite $db */ + /** @var DB_MySQL|DB_MySQLi|DB_PgSQL|DB_SQLite|PostgresPdoDbDriver|MysqlPdoDbDriver $db */ $db = new $dbtype['class']; $encodings = $db->fetch_db_charsets();