Tentative de régler le bordel
This commit is contained in:
@@ -75,6 +75,16 @@ abstract class driver implements driver_interface
|
||||
const SUBQUERY_SELECT_TYPE = 4;
|
||||
const SUBQUERY_BUILD = 5;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $debug_load_time = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $debug_sql_explain = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -95,6 +105,22 @@ abstract class driver implements driver_interface
|
||||
$this->one_char = chr(0) . '_';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_debug_load_time($value)
|
||||
{
|
||||
$this->debug_load_time = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_debug_sql_explain($value)
|
||||
{
|
||||
$this->debug_sql_explain = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -955,7 +981,7 @@ abstract class driver implements driver_interface
|
||||
// Show complete SQL error and path to administrators only
|
||||
// Additionally show complete error on installation or if extended debug mode is enabled
|
||||
// The DEBUG constant is for development only!
|
||||
if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG'))
|
||||
if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || $this->debug_sql_explain)
|
||||
{
|
||||
$message .= ($sql) ? '<br /><br />SQL<br /><br />' . htmlspecialchars($sql) : '';
|
||||
}
|
||||
|
||||
@@ -15,6 +15,20 @@ namespace phpbb\db\driver;
|
||||
|
||||
interface driver_interface
|
||||
{
|
||||
/**
|
||||
* Set value for load_time debug parameter
|
||||
*
|
||||
* @param bool $value
|
||||
*/
|
||||
public function set_debug_load_time($value);
|
||||
|
||||
/**
|
||||
* Set value for sql_explain debug parameter
|
||||
*
|
||||
* @param bool $value
|
||||
*/
|
||||
public function set_debug_sql_explain($value);
|
||||
|
||||
/**
|
||||
* Gets the name of the sql layer.
|
||||
*
|
||||
|
||||
@@ -65,6 +65,22 @@ class factory implements driver_interface
|
||||
$this->driver = $driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_debug_load_time($value)
|
||||
{
|
||||
$this->get_driver()->set_debug_load_time($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_debug_sql_explain($value)
|
||||
{
|
||||
$this->get_driver()->set_debug_sql_explain($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -151,12 +151,11 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
|
||||
{
|
||||
global $cache;
|
||||
|
||||
// EXPLAIN only in extra debug mode
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
@@ -172,11 +171,11 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
|
||||
$this->sql_error($query);
|
||||
}
|
||||
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
@@ -196,7 +195,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
}
|
||||
else if (defined('DEBUG'))
|
||||
else if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('fromcache', $query);
|
||||
}
|
||||
|
||||
@@ -123,12 +123,11 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
|
||||
{
|
||||
global $cache;
|
||||
|
||||
// EXPLAIN only in extra debug mode
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
@@ -146,11 +145,11 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
|
||||
// reset options for next query
|
||||
$this->query_options = array();
|
||||
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
@@ -170,7 +169,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
}
|
||||
else if (defined('DEBUG'))
|
||||
else if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('fromcache', $query);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,9 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
||||
|
||||
if ($this->db_connect_id && $this->dbname != '')
|
||||
{
|
||||
// Disable loading local files on client side
|
||||
@mysqli_options($this->db_connect_id, MYSQLI_OPT_LOCAL_INFILE, false);
|
||||
|
||||
@mysqli_query($this->db_connect_id, "SET NAMES 'utf8'");
|
||||
|
||||
// enforce strict mode on databases that support it
|
||||
@@ -173,12 +176,11 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
||||
{
|
||||
global $cache;
|
||||
|
||||
// EXPLAIN only in extra debug mode
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
@@ -193,11 +195,11 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
||||
$this->sql_error($query);
|
||||
}
|
||||
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
@@ -212,7 +214,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
}
|
||||
else if (defined('DEBUG'))
|
||||
else if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('fromcache', $query);
|
||||
}
|
||||
@@ -373,7 +375,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
||||
{
|
||||
static $test_prof;
|
||||
|
||||
// current detection method, might just switch to see the existance of INFORMATION_SCHEMA.PROFILING
|
||||
// current detection method, might just switch to see the existence of INFORMATION_SCHEMA.PROFILING
|
||||
if ($test_prof === null)
|
||||
{
|
||||
$test_prof = false;
|
||||
|
||||
@@ -246,12 +246,11 @@ class oracle extends \phpbb\db\driver\driver
|
||||
{
|
||||
global $cache;
|
||||
|
||||
// EXPLAIN only in extra debug mode
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
@@ -428,11 +427,11 @@ class oracle extends \phpbb\db\driver\driver
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
@@ -452,7 +451,7 @@ class oracle extends \phpbb\db\driver\driver
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
}
|
||||
else if (defined('DEBUG'))
|
||||
else if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('fromcache', $query);
|
||||
}
|
||||
|
||||
@@ -173,12 +173,11 @@ class postgres extends \phpbb\db\driver\driver
|
||||
{
|
||||
global $cache;
|
||||
|
||||
// EXPLAIN only in extra debug mode
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
@@ -194,11 +193,11 @@ class postgres extends \phpbb\db\driver\driver
|
||||
$this->sql_error($query);
|
||||
}
|
||||
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
@@ -218,7 +217,7 @@ class postgres extends \phpbb\db\driver\driver
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
}
|
||||
else if (defined('DEBUG'))
|
||||
else if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('fromcache', $query);
|
||||
}
|
||||
|
||||
@@ -118,12 +118,11 @@ class sqlite3 extends \phpbb\db\driver\driver
|
||||
{
|
||||
global $cache;
|
||||
|
||||
// EXPLAIN only in extra debug mode
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
@@ -156,11 +155,11 @@ class sqlite3 extends \phpbb\db\driver\driver
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('DEBUG'))
|
||||
if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
else if ($this->debug_load_time)
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
@@ -175,7 +174,7 @@ class sqlite3 extends \phpbb\db\driver\driver
|
||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
}
|
||||
else if (defined('DEBUG'))
|
||||
else if ($this->debug_sql_explain)
|
||||
{
|
||||
$this->sql_report('fromcache', $query);
|
||||
}
|
||||
|
||||
@@ -79,14 +79,7 @@ class mysql_extractor extends base_extractor
|
||||
throw new extractor_not_initialized_exception();
|
||||
}
|
||||
|
||||
if ($this->db->get_sql_layer() === 'mysqli')
|
||||
{
|
||||
$this->write_data_mysqli($table_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->write_data_mysql($table_name);
|
||||
}
|
||||
$this->write_data_mysqli($table_name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,101 +172,6 @@ class mysql_extractor extends base_extractor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts data from database table (for MySQL driver)
|
||||
*
|
||||
* @param string $table_name name of the database table
|
||||
* @return null
|
||||
* @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor()
|
||||
*/
|
||||
protected function write_data_mysql($table_name)
|
||||
{
|
||||
if (!$this->is_initialized)
|
||||
{
|
||||
throw new extractor_not_initialized_exception();
|
||||
}
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM $table_name";
|
||||
$result = mysql_unbuffered_query($sql, $this->db->get_db_connect_id());
|
||||
|
||||
if ($result != false)
|
||||
{
|
||||
$fields_cnt = mysql_num_fields($result);
|
||||
|
||||
// Get field information
|
||||
$field = array();
|
||||
for ($i = 0; $i < $fields_cnt; $i++)
|
||||
{
|
||||
$field[] = mysql_fetch_field($result, $i);
|
||||
}
|
||||
$field_set = array();
|
||||
|
||||
for ($j = 0; $j < $fields_cnt; $j++)
|
||||
{
|
||||
$field_set[] = $field[$j]->name;
|
||||
}
|
||||
|
||||
$search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"');
|
||||
$replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"');
|
||||
$fields = implode(', ', $field_set);
|
||||
$sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES ';
|
||||
$first_set = true;
|
||||
$query_len = 0;
|
||||
$max_len = get_usable_memory();
|
||||
|
||||
while ($row = mysql_fetch_row($result))
|
||||
{
|
||||
$values = array();
|
||||
if ($first_set)
|
||||
{
|
||||
$query = $sql_data . '(';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= ',(';
|
||||
}
|
||||
|
||||
for ($j = 0; $j < $fields_cnt; $j++)
|
||||
{
|
||||
if (!isset($row[$j]) || is_null($row[$j]))
|
||||
{
|
||||
$values[$j] = 'NULL';
|
||||
}
|
||||
else if ($field[$j]->numeric && ($field[$j]->type !== 'timestamp'))
|
||||
{
|
||||
$values[$j] = $row[$j];
|
||||
}
|
||||
else
|
||||
{
|
||||
$values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'";
|
||||
}
|
||||
}
|
||||
$query .= implode(', ', $values) . ')';
|
||||
|
||||
$query_len += strlen($query);
|
||||
if ($query_len > $max_len)
|
||||
{
|
||||
$this->flush($query . ";\n\n");
|
||||
$query = '';
|
||||
$query_len = 0;
|
||||
$first_set = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$first_set = false;
|
||||
}
|
||||
}
|
||||
mysql_free_result($result);
|
||||
|
||||
// check to make sure we have nothing left to flush
|
||||
if (!$first_set && $query)
|
||||
{
|
||||
$this->flush($query . ";\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts database table structure (for MySQLi or MySQL 3.23.20+)
|
||||
*
|
||||
@@ -300,7 +198,7 @@ class mysql_extractor extends base_extractor
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts database table structure (for MySQL verisons older than 3.23.20)
|
||||
* Extracts database table structure (for MySQL versions older than 3.23.20)
|
||||
*
|
||||
* @param string $table_name name of the database table
|
||||
* @return null
|
||||
|
||||
@@ -117,7 +117,7 @@ class release_3_0_4_rc1 extends \phpbb\db\migration\migration
|
||||
}
|
||||
else
|
||||
{
|
||||
// equivelant to "none", which is the "Display in user control panel" option
|
||||
// equivalent to "none", which is the "Display in user control panel" option
|
||||
$sql_ary['field_show_profile'] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class softdelete_p1 extends \phpbb\db\migration\migration
|
||||
/*
|
||||
* Using sql_case here to avoid "BIGINT UNSIGNED value is out of range" errors.
|
||||
* As we update all topics in 2 queries, one broken topic would stop the conversion
|
||||
* for all topics and the surpressed error will cause the admin to not even notice it.
|
||||
* for all topics and the suppressed error will cause the admin to not even notice it.
|
||||
*/
|
||||
$sql = 'UPDATE ' . $this->table_prefix . 'topics
|
||||
SET topic_posts_approved = topic_replies + 1,
|
||||
|
||||
29
phpbb/db/migration/data/v32x/timezone_p3.php
Normal file
29
phpbb/db/migration/data/v32x/timezone_p3.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v32x;
|
||||
|
||||
class timezone_p3 extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array('\phpbb\db\migration\data\v310\timezone');
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.remove', array('board_dst')),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
phpbb/db/migration/data/v32x/user_emoji_permission.php
Normal file
44
phpbb/db/migration/data/v32x/user_emoji_permission.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v32x;
|
||||
|
||||
class user_emoji_permission extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
$sql = 'SELECT auth_option_id
|
||||
FROM ' . ACL_OPTIONS_TABLE . "
|
||||
WHERE auth_option = 'u_emoji'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$auth_option_id = $this->db->sql_fetchfield('auth_option_id');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $auth_option_id !== false;
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return [
|
||||
'\phpbb\db\migration\data\v32x\v329rc1',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return [
|
||||
['permission.add', ['u_emoji']],
|
||||
['permission.permission_set', ['REGISTERED', 'u_emoji', 'group']],
|
||||
];
|
||||
}
|
||||
}
|
||||
36
phpbb/db/migration/data/v32x/v328.php
Normal file
36
phpbb/db/migration/data/v32x/v328.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v32x;
|
||||
|
||||
class v328 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return phpbb_version_compare($this->config['version'], '3.2.8', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v32x\v328rc1',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.2.8')),
|
||||
);
|
||||
}
|
||||
}
|
||||
37
phpbb/db/migration/data/v32x/v328rc1.php
Normal file
37
phpbb/db/migration/data/v32x/v328rc1.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v32x;
|
||||
|
||||
class v328rc1 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return phpbb_version_compare($this->config['version'], '3.2.8-RC1', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v32x\timezone_p3',
|
||||
'\phpbb\db\migration\data\v32x\v327',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.2.8-RC1')),
|
||||
);
|
||||
}
|
||||
}
|
||||
37
phpbb/db/migration/data/v32x/v329.php
Normal file
37
phpbb/db/migration/data/v32x/v329.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v32x;
|
||||
|
||||
class v329 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return phpbb_version_compare($this->config['version'], '3.2.9', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v32x\v329rc1',
|
||||
'\phpbb\db\migration\data\v32x\user_emoji_permission',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.2.9')),
|
||||
);
|
||||
}
|
||||
}
|
||||
36
phpbb/db/migration/data/v32x/v329rc1.php
Normal file
36
phpbb/db/migration/data/v32x/v329rc1.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v32x;
|
||||
|
||||
class v329rc1 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return phpbb_version_compare($this->config['version'], '3.2.9-RC1', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v32x\v328',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.2.9-RC1')),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class add_display_unapproved_posts_config extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return $this->config->offsetExists('display_unapproved_posts');
|
||||
}
|
||||
|
||||
public static function depends_on()
|
||||
{
|
||||
return ['\phpbb\db\migration\data\v330\dev',];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return [
|
||||
['config.add', ['display_unapproved_posts', 1]],
|
||||
];
|
||||
}
|
||||
}
|
||||
36
phpbb/db/migration/data/v330/dev.php
Normal file
36
phpbb/db/migration/data/v330/dev.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class dev extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return version_compare($this->config['version'], '3.3.0-dev', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v32x\v327',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.3.0-dev')),
|
||||
);
|
||||
}
|
||||
}
|
||||
49
phpbb/db/migration/data/v330/forums_legend_limit.php
Normal file
49
phpbb/db/migration/data/v330/forums_legend_limit.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class forums_legend_limit extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return $this->db_tools->sql_column_exists($this->table_prefix . 'forums', 'display_subforum_limit');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return ['\phpbb\db\migration\data\v330\v330b1'];
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return [
|
||||
'add_columns' => [
|
||||
$this->table_prefix . 'forums' => [
|
||||
'display_subforum_limit' => ['BOOL', 0, 'after' => 'display_subforum_list'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return [
|
||||
'drop_columns' => [
|
||||
$this->table_prefix . 'forums' => [
|
||||
'display_subforum_limit',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
37
phpbb/db/migration/data/v330/jquery_update.php
Normal file
37
phpbb/db/migration/data/v330/jquery_update.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class jquery_update extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return $this->config['load_jquery_url'] === '//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js';
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v330\dev',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js')),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
89
phpbb/db/migration/data/v330/remove_attachment_flash.php
Normal file
89
phpbb/db/migration/data/v330/remove_attachment_flash.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class remove_attachment_flash extends \phpbb\db\migration\migration
|
||||
{
|
||||
// Following constants were deprecated in 3.3
|
||||
// and moved from constants.php to compatibility_globals.php,
|
||||
// thus define them as class constants
|
||||
const ATTACHMENT_CATEGORY_FLASH = 5;
|
||||
|
||||
protected $cat_id = array(
|
||||
self::ATTACHMENT_CATEGORY_FLASH,
|
||||
);
|
||||
|
||||
public static function depends_on()
|
||||
{
|
||||
return ['\phpbb\db\migration\data\v330\dev',];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('custom', array(array($this, 'remove_flash_group'))),
|
||||
);
|
||||
}
|
||||
|
||||
public function remove_flash_group()
|
||||
{
|
||||
// select group ids of outdated media
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . EXTENSION_GROUPS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('cat_id', $this->cat_id);
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
$group_ids = array();
|
||||
while ($group_id = (int) $this->db->sql_fetchfield('group_id'))
|
||||
{
|
||||
$group_ids[] = $group_id;
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
// nothing to do, admin has removed all the outdated media extension groups
|
||||
if (empty($group_ids))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// get the group id of downloadable files
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . EXTENSION_GROUPS_TABLE . "
|
||||
WHERE group_name = 'DOWNLOADABLE_FILES'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$download_id = (int) $this->db->sql_fetchfield('group_id');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (empty($download_id))
|
||||
{
|
||||
$sql = 'UPDATE ' . EXTENSIONS_TABLE . '
|
||||
SET group_id = 0
|
||||
WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
|
||||
}
|
||||
else
|
||||
{
|
||||
// move outdated media extensions to downloadable files
|
||||
$sql = 'UPDATE ' . EXTENSIONS_TABLE . "
|
||||
SET group_id = $download_id" . '
|
||||
WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
|
||||
}
|
||||
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
// delete the now empty, outdated media extension groups
|
||||
$sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('group_id', $group_ids);
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
62
phpbb/db/migration/data/v330/remove_email_hash.php
Normal file
62
phpbb/db/migration/data/v330/remove_email_hash.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class remove_email_hash extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return ['\phpbb\db\migration\data\v30x\release_3_0_0'];
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return [
|
||||
'add_index' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'user_email' => ['user_email'],
|
||||
],
|
||||
],
|
||||
'drop_keys' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'user_email_hash',
|
||||
],
|
||||
],
|
||||
'drop_columns' => [
|
||||
$this->table_prefix . 'users' => ['user_email_hash'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return [
|
||||
'add_columns' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'user_email_hash' => ['BINT', 0],
|
||||
],
|
||||
],
|
||||
'add_index' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'user_email_hash',
|
||||
],
|
||||
],
|
||||
'drop_keys' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'user_email' => ['user_email'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
43
phpbb/db/migration/data/v330/remove_max_pass_chars.php
Normal file
43
phpbb/db/migration/data/v330/remove_max_pass_chars.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class remove_max_pass_chars extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return !$this->config->offsetExists('max_pass_chars');
|
||||
}
|
||||
|
||||
public static function depends_on()
|
||||
{
|
||||
return [
|
||||
'\phpbb\db\migration\data\v330\dev',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return [
|
||||
['config.remove', ['max_pass_chars']],
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_data()
|
||||
{
|
||||
return [
|
||||
['config.add', ['max_pass_chars', 100]],
|
||||
];
|
||||
}
|
||||
}
|
||||
48
phpbb/db/migration/data/v330/reset_password.php
Normal file
48
phpbb/db/migration/data/v330/reset_password.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class reset_password extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return [
|
||||
'\phpbb\db\migration\data\v330\dev',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return [
|
||||
'add_columns' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'reset_token' => ['VCHAR:64', '', 'after' => 'user_actkey'],
|
||||
'reset_token_expiration' => ['TIMESTAMP', 0, 'after' => 'reset_token'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return [
|
||||
'drop_columns' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'reset_token',
|
||||
'reset_token_expiration',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
37
phpbb/db/migration/data/v330/v330.php
Normal file
37
phpbb/db/migration/data/v330/v330.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class v330 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return version_compare($this->config['version'], '3.3.0', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v32x\v329',
|
||||
'\phpbb\db\migration\data\v330\v330rc1',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.3.0')),
|
||||
);
|
||||
}
|
||||
}
|
||||
41
phpbb/db/migration/data/v330/v330b1.php
Normal file
41
phpbb/db/migration/data/v330/v330b1.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class v330b1 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return version_compare($this->config['version'], '3.3.0-b1', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v330\jquery_update',
|
||||
'\phpbb\db\migration\data\v330\reset_password',
|
||||
'\phpbb\db\migration\data\v330\remove_attachment_flash',
|
||||
'\phpbb\db\migration\data\v330\remove_max_pass_chars',
|
||||
'\phpbb\db\migration\data\v32x\v328',
|
||||
'\phpbb\db\migration\data\v330\dev',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.3.0-b1')),
|
||||
);
|
||||
}
|
||||
}
|
||||
39
phpbb/db/migration/data/v330/v330b2.php
Normal file
39
phpbb/db/migration/data/v330/v330b2.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class v330b2 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return version_compare($this->config['version'], '3.3.0-b2', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v330\add_display_unapproved_posts_config',
|
||||
'\phpbb\db\migration\data\v330\forums_legend_limit',
|
||||
'\phpbb\db\migration\data\v330\remove_email_hash',
|
||||
'\phpbb\db\migration\data\v330\v330b1',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.3.0-b2')),
|
||||
);
|
||||
}
|
||||
}
|
||||
36
phpbb/db/migration/data/v330/v330rc1.php
Normal file
36
phpbb/db/migration/data/v330/v330rc1.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v330;
|
||||
|
||||
class v330rc1 extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return version_compare($this->config['version'], '3.3.0-RC1', '>=');
|
||||
}
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\phpbb\db\migration\data\v330\v330b2',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('version', '3.3.0-RC1')),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -509,7 +509,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
|
||||
* Get parent module id
|
||||
*
|
||||
* @param string|int $parent_id The parent module_id|module_langname
|
||||
* @param int|string|array $data The module_id, module_langname for existance checking or module data array for adding
|
||||
* @param int|string|array $data The module_id, module_langname for existence checking or module data array for adding
|
||||
* @param bool $throw_exception The flag indicating if exception should be thrown on error
|
||||
* @return mixed The int parent module_id, an array of int parent module_id values or false
|
||||
* @throws \phpbb\db\migration\exception
|
||||
|
||||
@@ -784,7 +784,7 @@ class migrator
|
||||
{
|
||||
return array(
|
||||
$parameters[0],
|
||||
array($last_result),
|
||||
isset($parameters[1]) ? array_merge($parameters[1], array($last_result)) : array($last_result),
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -194,7 +194,7 @@ class mssql extends tools
|
||||
$primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set'];
|
||||
}
|
||||
|
||||
// create sequence DDL based off of the existance of auto incrementing columns
|
||||
// create sequence DDL based off of the existence of auto incrementing columns
|
||||
if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'])
|
||||
{
|
||||
$create_sequence = $column_name;
|
||||
|
||||
@@ -141,7 +141,7 @@ class postgres extends tools
|
||||
$primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set'];
|
||||
}
|
||||
|
||||
// create sequence DDL based off of the existance of auto incrementing columns
|
||||
// create sequence DDL based off of the existence of auto incrementing columns
|
||||
if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'])
|
||||
{
|
||||
$create_sequence = $column_name;
|
||||
|
||||
@@ -74,37 +74,6 @@ class tools implements tools_interface
|
||||
'VARBINARY' => 'varbinary(255)',
|
||||
),
|
||||
|
||||
'mysql_40' => array(
|
||||
'INT:' => 'int(%d)',
|
||||
'BINT' => 'bigint(20)',
|
||||
'ULINT' => 'INT(10) UNSIGNED',
|
||||
'UINT' => 'mediumint(8) UNSIGNED',
|
||||
'UINT:' => 'int(%d) UNSIGNED',
|
||||
'TINT:' => 'tinyint(%d)',
|
||||
'USINT' => 'smallint(4) UNSIGNED',
|
||||
'BOOL' => 'tinyint(1) UNSIGNED',
|
||||
'VCHAR' => 'varbinary(255)',
|
||||
'VCHAR:' => 'varbinary(%d)',
|
||||
'CHAR:' => 'binary(%d)',
|
||||
'XSTEXT' => 'blob',
|
||||
'XSTEXT_UNI'=> 'blob',
|
||||
'STEXT' => 'blob',
|
||||
'STEXT_UNI' => 'blob',
|
||||
'TEXT' => 'blob',
|
||||
'TEXT_UNI' => 'blob',
|
||||
'MTEXT' => 'mediumblob',
|
||||
'MTEXT_UNI' => 'mediumblob',
|
||||
'TIMESTAMP' => 'int(11) UNSIGNED',
|
||||
'DECIMAL' => 'decimal(5,2)',
|
||||
'DECIMAL:' => 'decimal(%d,2)',
|
||||
'PDECIMAL' => 'decimal(6,3)',
|
||||
'PDECIMAL:' => 'decimal(%d,3)',
|
||||
'VCHAR_UNI' => 'blob',
|
||||
'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')),
|
||||
'VCHAR_CI' => 'blob',
|
||||
'VARBINARY' => 'varbinary(255)',
|
||||
),
|
||||
|
||||
'oracle' => array(
|
||||
'INT:' => 'number(%d)',
|
||||
'BINT' => 'number(20)',
|
||||
@@ -197,21 +166,6 @@ class tools implements tools_interface
|
||||
// Determine mapping database type
|
||||
switch ($this->db->get_sql_layer())
|
||||
{
|
||||
case 'mysql':
|
||||
$this->sql_layer = 'mysql_40';
|
||||
break;
|
||||
|
||||
case 'mysql4':
|
||||
if (version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
|
||||
{
|
||||
$this->sql_layer = 'mysql_41';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sql_layer = 'mysql_40';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'mysqli':
|
||||
$this->sql_layer = 'mysql_41';
|
||||
break;
|
||||
@@ -240,8 +194,6 @@ class tools implements tools_interface
|
||||
{
|
||||
switch ($this->db->get_sql_layer())
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
$sql = 'SHOW TABLES';
|
||||
break;
|
||||
@@ -335,7 +287,7 @@ class tools implements tools_interface
|
||||
$primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set'];
|
||||
}
|
||||
|
||||
// create sequence DDL based off of the existance of auto incrementing columns
|
||||
// create sequence DDL based off of the existence of auto incrementing columns
|
||||
if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'])
|
||||
{
|
||||
$create_sequence = $column_name;
|
||||
@@ -359,7 +311,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'sqlite3':
|
||||
$table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')';
|
||||
@@ -381,7 +332,6 @@ class tools implements tools_interface
|
||||
$statements[] = $table_sql;
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'sqlite3':
|
||||
$table_sql .= "\n);";
|
||||
$statements[] = $table_sql;
|
||||
@@ -576,7 +526,7 @@ class tools implements tools_interface
|
||||
{
|
||||
foreach ($indexes as $index_name)
|
||||
{
|
||||
if (!$this->sql_index_exists($table, $index_name))
|
||||
if (!$this->sql_index_exists($table, $index_name) && !$this->sql_unique_index_exists($table, $index_name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -834,7 +784,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$sql = "SHOW COLUMNS FROM $table_name";
|
||||
break;
|
||||
@@ -911,7 +860,6 @@ class tools implements tools_interface
|
||||
{
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$sql = 'SHOW KEYS
|
||||
FROM ' . $table_name;
|
||||
@@ -936,7 +884,7 @@ class tools implements tools_interface
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique'])
|
||||
if ($this->sql_layer == 'mysql_41' && !$row['Non_unique'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -971,7 +919,6 @@ class tools implements tools_interface
|
||||
{
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$sql = 'SHOW KEYS
|
||||
FROM ' . $table_name;
|
||||
@@ -996,7 +943,7 @@ class tools implements tools_interface
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && ($row['Non_unique'] || $row[$col] == 'PRIMARY'))
|
||||
if ($this->sql_layer == 'mysql_41' && ($row['Non_unique'] || $row[$col] == 'PRIMARY'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1094,7 +1041,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$sql .= " {$column_type} ";
|
||||
|
||||
@@ -1248,7 +1194,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$after = (!empty($column_data['after'])) ? ' AFTER ' . $column_data['after'] : '';
|
||||
$statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'] . $after;
|
||||
@@ -1281,7 +1226,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`';
|
||||
break;
|
||||
@@ -1360,7 +1304,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$index_name = $this->check_index_name_length($table_name, $index_name, false);
|
||||
$statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name;
|
||||
@@ -1422,7 +1365,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')';
|
||||
break;
|
||||
@@ -1500,7 +1442,6 @@ class tools implements tools_interface
|
||||
$statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$index_name = $this->check_index_name_length($table_name, $index_name);
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX ' . $index_name . '(' . implode(', ', $column) . ')';
|
||||
@@ -1517,11 +1458,7 @@ class tools implements tools_interface
|
||||
{
|
||||
$statements = array();
|
||||
|
||||
// remove index length unless MySQL4
|
||||
if ('mysql_40' != $this->sql_layer)
|
||||
{
|
||||
$column = preg_replace('#:.*$#', '', $column);
|
||||
}
|
||||
$column = preg_replace('#:.*$#', '', $column);
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
@@ -1531,17 +1468,6 @@ class tools implements tools_interface
|
||||
$statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
// add index size to definition as required by MySQL4
|
||||
foreach ($column as $i => $col)
|
||||
{
|
||||
if (false !== strpos($col, ':'))
|
||||
{
|
||||
list($col, $index_size) = explode(':', $col);
|
||||
$column[$i] = "$col($index_size)";
|
||||
}
|
||||
}
|
||||
// no break
|
||||
case 'mysql_41':
|
||||
$index_name = $this->check_index_name_length($table_name, $index_name);
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . ' (' . implode(', ', $column) . ')';
|
||||
@@ -1609,7 +1535,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$sql = 'SHOW KEYS
|
||||
FROM ' . $table_name;
|
||||
@@ -1634,7 +1559,7 @@ class tools implements tools_interface
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique'])
|
||||
if ($this->sql_layer == 'mysql_41' && !$row['Non_unique'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1677,7 +1602,6 @@ class tools implements tools_interface
|
||||
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$statements[] = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql'];
|
||||
break;
|
||||
@@ -1826,7 +1750,6 @@ class tools implements tools_interface
|
||||
{
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'sqlite3':
|
||||
// Not supported
|
||||
|
||||
Reference in New Issue
Block a user