aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/db')
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php1
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/add_smtp_ssl_context_config_options.php32
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php46
-rw-r--r--phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php50
-rw-r--r--phpBB/phpbb/db/migration/data/v320/cookie_notice.php31
-rw-r--r--phpBB/phpbb/db/migration/data/v320/v320.php40
-rw-r--r--phpBB/phpbb/db/migration/data/v320/v320rc2.php40
-rw-r--r--phpBB/phpbb/db/migration/data/v32x/cookie_notice_p2.php36
-rw-r--r--phpBB/phpbb/db/migration/profilefield_base_migration.php1
-rw-r--r--phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php2
-rw-r--r--phpBB/phpbb/db/tools.php21
-rw-r--r--phpBB/phpbb/db/tools/mssql.php46
12 files changed, 341 insertions, 5 deletions
diff --git a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
index 2d4d26ae61..d43d432dd9 100644
--- a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
+++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
@@ -52,6 +52,7 @@ class notification_options_reconvert extends \phpbb\db\migration\migration
{
$limit = 250;
$converted_users = 0;
+ $start = $start ?: 0;
$sql = 'SELECT user_id, user_notify_type, user_notify_pm
FROM ' . $this->table_prefix . 'users
diff --git a/phpBB/phpbb/db/migration/data/v31x/add_smtp_ssl_context_config_options.php b/phpBB/phpbb/db/migration/data/v31x/add_smtp_ssl_context_config_options.php
new file mode 100644
index 0000000000..92051dc3ca
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/add_smtp_ssl_context_config_options.php
@@ -0,0 +1,32 @@
+<?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\v31x;
+
+class add_smtp_ssl_context_config_options extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v31x\v3110');
+ }
+
+ public function update_data()
+ {
+ return array(
+ // See http://php.net/manual/en/context.ssl.php
+ array('config.add', array('smtp_verify_peer', 1)),
+ array('config.add', array('smtp_verify_peer_name', 1)),
+ array('config.add', array('smtp_allow_self_signed', 0)),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php
new file mode 100644
index 0000000000..7e486aca7c
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php
@@ -0,0 +1,46 @@
+<?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\v31x;
+
+class increase_size_of_emotion extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v3110',
+ );
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'change_columns' => array(
+ $this->table_prefix . 'smilies' => array(
+ 'emotion' => array('VCHAR_UNI', ''),
+ ),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'change_columns' => array(
+ $this->table_prefix . 'smilies' => array(
+ 'emotion' => array('VCHAR_UNI:50', ''),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php b/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php
new file mode 100644
index 0000000000..afa67fbc58
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php
@@ -0,0 +1,50 @@
+<?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\v320;
+
+class add_help_phpbb extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\v320rc1',
+ );
+ }
+
+ public function effectively_installed()
+ {
+ return isset($this->config['help_send_statistics']);
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('help_send_statistics', true)),
+ array('config.add', array('help_send_statistics_time', 0)),
+ array('module.remove', array(
+ 'acp',
+ false,
+ 'ACP_SEND_STATISTICS',
+ )),
+ array('module.add', array(
+ 'acp',
+ 'ACP_SERVER_CONFIGURATION',
+ array(
+ 'module_basename' => 'acp_help_phpbb',
+ 'modes' => array('help_phpbb'),
+ ),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/cookie_notice.php b/phpBB/phpbb/db/migration/data/v320/cookie_notice.php
new file mode 100644
index 0000000000..75cb03b3ef
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/cookie_notice.php
@@ -0,0 +1,31 @@
+<?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\v320;
+
+class cookie_notice extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\v320rc2',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('cookie_notice', false)),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/v320.php b/phpBB/phpbb/db/migration/data/v320/v320.php
new file mode 100644
index 0000000000..20e741cb8b
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/v320.php
@@ -0,0 +1,40 @@
+<?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\v320;
+
+use phpbb\db\migration\migration;
+
+class v320 extends migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.2.0', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\increase_size_of_emotion',
+ '\phpbb\db\migration\data\v320\cookie_notice',
+ );
+
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.2.0')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/v320rc2.php b/phpBB/phpbb/db/migration/data/v320/v320rc2.php
new file mode 100644
index 0000000000..ec9bb62732
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/v320rc2.php
@@ -0,0 +1,40 @@
+<?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\v320;
+
+use phpbb\db\migration\migration;
+
+class v320rc2 extends migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.2.0-RC2', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\remove_duplicate_migrations',
+ '\phpbb\db\migration\data\v31x\add_log_time_index',
+ '\phpbb\db\migration\data\v320\add_help_phpbb',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.2.0-RC2')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v32x/cookie_notice_p2.php b/phpBB/phpbb/db/migration/data/v32x/cookie_notice_p2.php
new file mode 100644
index 0000000000..1a83175705
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v32x/cookie_notice_p2.php
@@ -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 cookie_notice_p2 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\v320',
+ );
+ }
+
+ public function effectively_installed()
+ {
+ return isset($this->config['cookie_notice']);
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('cookie_notice', '0')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php
index 3f26a4998c..bc542a8fed 100644
--- a/phpBB/phpbb/db/migration/profilefield_base_migration.php
+++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php
@@ -191,6 +191,7 @@ abstract class profilefield_base_migration extends container_aware_migration
$insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->table_prefix . 'profile_fields_data');
$limit = 250;
$converted_users = 0;
+ $start = $start ?: 0;
$sql = 'SELECT user_id, ' . $this->user_column_name . '
FROM ' . $this->table_prefix . 'users
diff --git a/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php
index 20991746ac..e4bd3ac8e0 100644
--- a/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php
+++ b/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php
@@ -94,7 +94,7 @@ class log_wrapper_migrator_output_handler implements migrator_output_handler_int
$translated_message = '[DEBUG] ' . $translated_message;
}
- fwrite($this->file_handle, $translated_message);
+ fwrite($this->file_handle, $translated_message . "\n");
fflush($this->file_handle);
}
}
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
new file mode 100644
index 0000000000..4d1b91f7b4
--- /dev/null
+++ b/phpBB/phpbb/db/tools.php
@@ -0,0 +1,21 @@
+<?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;
+
+/**
+ * @deprecated 3.2.0-dev (To be removed 3.3.0) use \phpbb\db\tools\tools instead
+ */
+class tools extends \phpbb\db\tools\tools
+{
+}
diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php
index a132832005..d31aa2ba0b 100644
--- a/phpBB/phpbb/db/tools/mssql.php
+++ b/phpBB/phpbb/db/tools/mssql.php
@@ -477,7 +477,7 @@ class mssql extends tools
{
$statements = array();
- $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name;
+ $statements[] = 'DROP INDEX [' . $table_name . '].[' . $index_name . ']';
return $this->_sql_run_sql($statements);
}
@@ -524,7 +524,10 @@ class mssql extends tools
{
$statements = array();
- $this->check_index_name_length($table_name, $index_name);
+ if ($this->is_sql_server_2000())
+ {
+ $this->check_index_name_length($table_name, $index_name);
+ }
$statements[] = 'CREATE UNIQUE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])';
@@ -538,7 +541,10 @@ class mssql extends tools
{
$statements = array();
- $this->check_index_name_length($table_name, $index_name);
+ if ($this->is_sql_server_2000())
+ {
+ $this->check_index_name_length($table_name, $index_name);
+ }
// remove index length
$column = preg_replace('#:.*$#', '', $column);
@@ -601,7 +607,7 @@ class mssql extends tools
// Change the column
$statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql'];
- if (!empty($column_data['default']))
+ if (!empty($column_data['default']) && !$this->mssql_is_column_identity($table_name, $column_name))
{
// Add new default value constraint
$statements[] = 'ALTER TABLE [' . $table_name . '] ADD CONSTRAINT [DF_' . $table_name . '_' . $column_name . '_1] ' . $column_data['default'] . ' FOR [' . $column_name . ']';
@@ -679,6 +685,37 @@ class mssql extends tools
}
/**
+ * Checks to see if column is an identity column
+ *
+ * Identity columns cannot have defaults set for them.
+ *
+ * @param string $table_name
+ * @param string $column_name
+ * @return bool true if identity, false if not
+ */
+ protected function mssql_is_column_identity($table_name, $column_name)
+ {
+ if ($this->mssql_is_sql_server_2000())
+ {
+ // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx
+ // Deprecated in SQL Server 2005
+ $sql = "SELECT COLUMNPROPERTY(object_id('{$table_name}'), '{$column_name}', 'IsIdentity') AS is_identity";
+ }
+ else
+ {
+ $sql = "SELECT is_identity FROM sys.columns
+ WHERE object_id = object_id('{$table_name}')
+ AND name = '{$column_name}'";
+ }
+
+ $result = $this->db->sql_query($sql);
+ $is_identity = $this->db->sql_fetchfield('is_identity');
+ $this->db->sql_freeresult($result);
+
+ return (bool) $is_identity;
+ }
+
+ /**
* Get a list with existing indexes for the column
*
* @param string $table_name
@@ -717,6 +754,7 @@ class mssql extends tools
AND cols.object_id = ix.object_id
WHERE ix.object_id = object_id('{$table_name}')
AND cols.name = '{$column_name}'
+ AND ix.is_primary_key = 0
AND ix.is_unique = " . ($unique ? '1' : '0');
}