1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/11842

Conflicts:
	phpBB/includes/acp/acp_groups.php
This commit is contained in:
Marc Alexander
2013-11-27 14:55:05 +01:00
422 changed files with 5792 additions and 4879 deletions

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Database Abstraction Layer
* @package dbal
@@ -824,7 +816,7 @@ class driver
*/
function sql_report($mode, $query = '')
{
global $cache, $starttime, $phpbb_root_path, $phpbb_admin_path, $user;
global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper, $user;
global $request;
if (is_object($request) && !$request->variable('explain', false))
@@ -854,7 +846,7 @@ class driver
<head>
<meta charset="utf-8">
<title>SQL Report</title>
<link href="' . htmlspecialchars($phpbb_admin_path) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" />
<link href="' . htmlspecialchars($phpbb_path_helper->update_web_root_path($phpbb_root_path) . $phpbb_path_helper->get_adm_relative_path()) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body id="errorpage">
<div id="wrap">

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Firebird/Interbase Database Abstraction Layer
* Minimum Requirement is Firebird 2.1

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* MSSQL Database Abstraction Layer
* Minimum Requirement is MSSQL 2000+
@@ -259,7 +251,7 @@ class mssql extends \phpbb\db\driver\driver
{
foreach ($row as $key => $value)
{
$row[$key] = ($value === ' ' || $value === NULL) ? '' : $value;
$row[$key] = ($value === ' ' || $value === null) ? '' : $value;
}
}

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* MSSQL Database Base Abstraction Layer
* @package dbal

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Unified ODBC functions
* Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere...

View File

@@ -13,189 +13,12 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* 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.
*/
class result_mssqlnative
{
public function result_mssqlnative($queryresult = false)
{
$this->m_cursor = 0;
$this->m_rows = array();
$this->m_num_fields = sqlsrv_num_fields($queryresult);
$this->m_field_meta = sqlsrv_field_metadata($queryresult);
while ($row = sqlsrv_fetch_array($queryresult, SQLSRV_FETCH_ASSOC))
{
if ($row !== null)
{
foreach($row as $k => $v)
{
if (is_object($v) && method_exists($v, 'format'))
{
$row[$k] = $v->format("Y-m-d\TH:i:s\Z");
}
}
$this->m_rows[] = $row;//read results into memory, cursors are not supported
}
}
$this->m_row_count = sizeof($this->m_rows);
}
private function array_to_obj($array, &$obj)
{
foreach ($array as $key => $value)
{
if (is_array($value))
{
$obj->$key = new \stdClass();
array_to_obj($value, $obj->$key);
}
else
{
$obj->$key = $value;
}
}
return $obj;
}
public function fetch($mode = SQLSRV_FETCH_BOTH, $object_class = 'stdClass')
{
if ($this->m_cursor >= $this->m_row_count || $this->m_row_count == 0)
{
return false;
}
$ret = false;
$arr_num = array();
if ($mode == SQLSRV_FETCH_NUMERIC || $mode == SQLSRV_FETCH_BOTH)
{
foreach($this->m_rows[$this->m_cursor] as $key => $value)
{
$arr_num[] = $value;
}
}
switch ($mode)
{
case SQLSRV_FETCH_ASSOC:
$ret = $this->m_rows[$this->m_cursor];
break;
case SQLSRV_FETCH_NUMERIC:
$ret = $arr_num;
break;
case 'OBJECT':
$ret = $this->array_to_obj($this->m_rows[$this->m_cursor], $o = new $object_class);
break;
case SQLSRV_FETCH_BOTH:
default:
$ret = $this->m_rows[$this->m_cursor] + $arr_num;
break;
}
$this->m_cursor++;
return $ret;
}
public function get($pos, $fld)
{
return $this->m_rows[$pos][$fld];
}
public function num_rows()
{
return $this->m_row_count;
}
public function seek($iRow)
{
$this->m_cursor = min($iRow, $this->m_row_count);
}
public function num_fields()
{
return $this->m_num_fields;
}
public function field_name($nr)
{
$arr_keys = array_keys($this->m_rows[0]);
return $arr_keys[$nr];
}
public function field_type($nr)
{
$i = 0;
$int_type = -1;
$str_type = '';
foreach ($this->m_field_meta as $meta)
{
if ($nr == $i)
{
$int_type = $meta['Type'];
break;
}
$i++;
}
//http://msdn.microsoft.com/en-us/library/cc296183.aspx contains type table
switch ($int_type)
{
case SQLSRV_SQLTYPE_BIGINT: $str_type = 'bigint'; break;
case SQLSRV_SQLTYPE_BINARY: $str_type = 'binary'; break;
case SQLSRV_SQLTYPE_BIT: $str_type = 'bit'; break;
case SQLSRV_SQLTYPE_CHAR: $str_type = 'char'; break;
case SQLSRV_SQLTYPE_DATETIME: $str_type = 'datetime'; break;
case SQLSRV_SQLTYPE_DECIMAL/*($precision, $scale)*/: $str_type = 'decimal'; break;
case SQLSRV_SQLTYPE_FLOAT: $str_type = 'float'; break;
case SQLSRV_SQLTYPE_IMAGE: $str_type = 'image'; break;
case SQLSRV_SQLTYPE_INT: $str_type = 'int'; break;
case SQLSRV_SQLTYPE_MONEY: $str_type = 'money'; break;
case SQLSRV_SQLTYPE_NCHAR/*($charCount)*/: $str_type = 'nchar'; break;
case SQLSRV_SQLTYPE_NUMERIC/*($precision, $scale)*/: $str_type = 'numeric'; break;
case SQLSRV_SQLTYPE_NVARCHAR/*($charCount)*/: $str_type = 'nvarchar'; break;
case SQLSRV_SQLTYPE_NTEXT: $str_type = 'ntext'; break;
case SQLSRV_SQLTYPE_REAL: $str_type = 'real'; break;
case SQLSRV_SQLTYPE_SMALLDATETIME: $str_type = 'smalldatetime'; break;
case SQLSRV_SQLTYPE_SMALLINT: $str_type = 'smallint'; break;
case SQLSRV_SQLTYPE_SMALLMONEY: $str_type = 'smallmoney'; break;
case SQLSRV_SQLTYPE_TEXT: $str_type = 'text'; break;
case SQLSRV_SQLTYPE_TIMESTAMP: $str_type = 'timestamp'; break;
case SQLSRV_SQLTYPE_TINYINT: $str_type = 'tinyint'; break;
case SQLSRV_SQLTYPE_UNIQUEIDENTIFIER: $str_type = 'uniqueidentifier'; break;
case SQLSRV_SQLTYPE_UDT: $str_type = 'UDT'; break;
case SQLSRV_SQLTYPE_VARBINARY/*($byteCount)*/: $str_type = 'varbinary'; break;
case SQLSRV_SQLTYPE_VARCHAR/*($charCount)*/: $str_type = 'varchar'; break;
case SQLSRV_SQLTYPE_XML: $str_type = 'xml'; break;
default: $str_type = $int_type;
}
return $str_type;
}
public function free()
{
unset($this->m_rows);
return;
}
}
/**
* @package dbal
*/
class mssqlnative extends \phpbb\db\driver\mssql_base
{
var $m_insert_id = NULL;
var $m_insert_id = null;
var $last_query_text = '';
var $query_options = array();
var $connect_error = '';
@@ -427,7 +250,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
{
foreach ($row as $key => $value)
{
$row[$key] = ($value === ' ' || $value === NULL) ? '' : $value;
$row[$key] = ($value === ' ' || $value === null) ? '' : $value;
}
// remove helper values from LIMIT queries

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* MySQL4 Database Abstraction Layer
* Compatible with:

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Abstract MySQL Database Base Abstraction Layer
* @package dbal

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* MySQLi Database Abstraction Layer
* mysqli-extension has to be compiled with:
@@ -31,7 +23,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
/**
* Connect to server
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
if (!function_exists('mysqli_connect'))
{
@@ -47,11 +39,11 @@ class mysqli extends \phpbb\db\driver\mysql_base
$this->server = ($this->persistency) ? 'p:' . (($sqlserver) ? $sqlserver : 'localhost') : $sqlserver;
$this->dbname = $database;
$port = (!$port) ? NULL : $port;
$port = (!$port) ? null : $port;
// If port is set and it is not numeric, most likely mysqli socket is set.
// Try to map it to the $socket parameter.
$socket = NULL;
$socket = null;
if ($port)
{
if (is_numeric($port))
@@ -61,7 +53,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
else
{
$socket = $port;
$port = NULL;
$port = null;
}
}

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Oracle Database Abstraction Layer
* @package dbal

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* PostgreSQL Database Abstraction Layer
* Minimum Requirement is Version 7.3+
@@ -328,7 +320,7 @@ class postgres extends \phpbb\db\driver\driver
return false;
}
$temp_result = @pg_fetch_assoc($temp_q_id, NULL);
$temp_result = @pg_fetch_assoc($temp_q_id, null);
@pg_free_result($query_id);
return ($temp_result) ? $temp_result['last_value'] : false;
@@ -456,7 +448,7 @@ class postgres extends \phpbb\db\driver\driver
if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query"))
{
while ($row = @pg_fetch_assoc($result, NULL))
while ($row = @pg_fetch_assoc($result, null))
{
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
@@ -476,7 +468,7 @@ class postgres extends \phpbb\db\driver\driver
$endtime = $endtime[0] + $endtime[1];
$result = @pg_query($this->db_connect_id, $query);
while ($void = @pg_fetch_assoc($result, NULL))
while ($void = @pg_fetch_assoc($result, null))
{
// Take the time spent on parsing rows into account
}

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Sqlite Database Abstraction Layer
* Minimum Requirement: 2.8.2+

View File

@@ -0,0 +1,28 @@
<?php
/**
*
* @package migration
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2
*
*/
namespace phpbb\db\migration\data\v310;
class alpha2 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\alpha1',
'\phpbb\db\migration\data\v310\notifications_cron_p2',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-a2')),
);
}
}

View File

@@ -34,7 +34,7 @@ class notifications extends \phpbb\db\migration\migration
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT', NULL, 'auto_increment'),
'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),

View File

@@ -0,0 +1,27 @@
<?php
/**
*
* @package migration
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace phpbb\db\migration\data\v310;
class notifications_cron_p2 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\notifications_cron');
}
public function update_data()
{
return array(
// Make read_notification_last_gc dynamic.
array('config.remove', array('read_notification_last_gc')),
array('config.add', array('read_notification_last_gc', 0, 1)),
);
}
}

View File

@@ -26,7 +26,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration
'add_tables' => array(
$this->table_prefix . 'notification_types' => array(
'COLUMNS' => array(
'notification_type_id' => array('USINT', NULL, 'auto_increment'),
'notification_type_id' => array('USINT', null, 'auto_increment'),
'notification_type_name' => array('VCHAR:255', ''),
'notification_type_enabled' => array('BOOL', 1),
),
@@ -37,7 +37,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT:10', NULL, 'auto_increment'),
'notification_id' => array('UINT:10', null, 'auto_increment'),
'notification_type_id' => array('USINT', 0),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
@@ -73,7 +73,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT', NULL, 'auto_increment'),
'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),

View File

@@ -34,7 +34,10 @@ class softdelete_p2 extends \phpbb\db\migration\migration
),
'drop_keys' => array(
$this->table_prefix . 'posts' => array('post_approved'),
$this->table_prefix . 'topics' => array('forum_appr_last'),
$this->table_prefix . 'topics' => array(
'forum_appr_last',
'topic_approved',
),
),
);
}
@@ -63,6 +66,7 @@ class softdelete_p2 extends \phpbb\db\migration\migration
),
$this->table_prefix . 'topics' => array(
'forum_appr_last' => array('forum_id', 'topic_approved', 'topic_last_post_id'),
'topic_approved' => array('topic_approved'),
),
),
);

View File

@@ -24,6 +24,14 @@ class style_update_p2 extends \phpbb\db\migration\migration
public function update_schema()
{
return array(
'drop_keys' => array(
$this->table_prefix . 'styles' => array(
'imageset_id',
'template_id',
'theme_id',
),
),
'drop_columns' => array(
$this->table_prefix . 'styles' => array(
'imageset_id',
@@ -53,10 +61,18 @@ class style_update_p2 extends \phpbb\db\migration\migration
),
),
'add_index' => array(
$this->table_prefix . 'styles' => array(
'imageset_id' => array('imageset_id'),
'template_id' => array('template_id'),
'theme_id' => array('theme_id'),
),
),
'add_tables' => array(
$this->table_prefix . 'styles_imageset' => array(
'COLUMNS' => array(
'imageset_id' => array('UINT', NULL, 'auto_increment'),
'imageset_id' => array('UINT', null, 'auto_increment'),
'imageset_name' => array('VCHAR_UNI:255', ''),
'imageset_copyright' => array('VCHAR_UNI', ''),
'imageset_path' => array('VCHAR:100', ''),
@@ -68,7 +84,7 @@ class style_update_p2 extends \phpbb\db\migration\migration
),
$this->table_prefix . 'styles_imageset_data' => array(
'COLUMNS' => array(
'image_id' => array('UINT', NULL, 'auto_increment'),
'image_id' => array('UINT', null, 'auto_increment'),
'image_name' => array('VCHAR:200', ''),
'image_filename' => array('VCHAR:200', ''),
'image_lang' => array('VCHAR:30', ''),
@@ -83,7 +99,7 @@ class style_update_p2 extends \phpbb\db\migration\migration
),
$this->table_prefix . 'styles_template' => array(
'COLUMNS' => array(
'template_id' => array('UINT', NULL, 'auto_increment'),
'template_id' => array('UINT', null, 'auto_increment'),
'template_name' => array('VCHAR_UNI:255', ''),
'template_copyright' => array('VCHAR_UNI', ''),
'template_path' => array('VCHAR:100', ''),
@@ -112,7 +128,7 @@ class style_update_p2 extends \phpbb\db\migration\migration
),
$this->table_prefix . 'styles_theme' => array(
'COLUMNS' => array(
'theme_id' => array('UINT', NULL, 'auto_increment'),
'theme_id' => array('UINT', null, 'auto_increment'),
'theme_name' => array('VCHAR_UNI:255', ''),
'theme_copyright' => array('VCHAR_UNI', ''),
'theme_path' => array('VCHAR:100', ''),

View File

@@ -27,7 +27,7 @@ class teampage extends \phpbb\db\migration\migration
'add_tables' => array(
$this->table_prefix . 'teampage' => array(
'COLUMNS' => array(
'teampage_id' => array('UINT', NULL, 'auto_increment'),
'teampage_id' => array('UINT', null, 'auto_increment'),
'group_id' => array('UINT', 0),
'teampage_name' => array('VCHAR_UNI:255', ''),
'teampage_position' => array('UINT', 0),

View File

@@ -0,0 +1,42 @@
<?php
/**
*
* @package migration
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace phpbb\db\migration\data\v310;
class ucp_popuppm_module extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
$sql = 'SELECT module_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'ucp'
AND module_langname = 'UCP_PM_POPUP_TITLE'";
$result = $this->db->sql_query($sql);
$module_id = $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result);
return $module_id == false;
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_data()
{
return array(
array('module.remove', array(
'ucp',
'UCP_PM',
'UCP_PM_POPUP_TITLE',
)),
);
}
}

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\migration;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* The migrator is responsible for applying new migrations in the correct order.
*

View File

@@ -9,14 +9,6 @@
namespace phpbb\db\migration;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Abstract base class for database migrations
*

View File

@@ -130,6 +130,10 @@ class config implements \phpbb\db\migration\tool\tool_interface
case 'remove':
$call = 'add';
if (sizeof($arguments) == 1)
{
$arguments[] = '';
}
break;
case 'update_if_equals':

View File

@@ -9,14 +9,6 @@
namespace phpbb\db;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* The migrator is responsible for applying new migrations in the correct order.
*
@@ -383,7 +375,7 @@ class migrator
foreach ($steps as $step_identifier => $step)
{
$last_result = false;
$last_result = 0;
if ($state)
{
// Continue until we reach the step that matches the last step called
@@ -444,7 +436,7 @@ class migrator
* @param bool $reverse False to install, True to attempt uninstallation by reversing the call
* @return null
*/
protected function run_step($step, $last_result = false, $reverse = false)
protected function run_step($step, $last_result = 0, $reverse = false)
{
$callable_and_parameters = $this->get_callable_from_step($step, $last_result, $reverse);
@@ -467,7 +459,7 @@ class migrator
* @param bool $reverse False to install, True to attempt uninstallation by reversing the call
* @return array Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters
*/
protected function get_callable_from_step(array $step, $last_result = false, $reverse = false)
protected function get_callable_from_step(array $step, $last_result = 0, $reverse = false)
{
$type = $step[0];
$parameters = $step[1];

View File

@@ -9,14 +9,6 @@
namespace phpbb\db;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Collects rows for insert into a database until the buffer size is reached.
* Then flushes the buffer to the database and starts over again.

View File

@@ -9,14 +9,6 @@
namespace phpbb\db;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Database Tools for handling cross-db actions such as altering columns, etc.
* Currently not supported is returning SQL for creating tables.
@@ -33,7 +25,7 @@ class tools
/**
* @var object DB object
*/
var $db = NULL;
var $db = null;
/**
* The Column types for every database we support