PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View 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;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Abstract base class for container aware database migrations.
*/
abstract class container_aware_migration extends migration implements ContainerAwareInterface
{
/**
* @var ContainerInterface
*/
protected $container;
/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
}

View File

@ -0,0 +1,33 @@
# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
# module mod_authz_host to a new module called mod_access_compat (which may be
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
# We could just conditionally provide both versions, but unfortunately Apache
# does not explicitly tell us its version if the module mod_version is not
# available. In this case, we check for the availability of module
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
<IfModule mod_version.c>
<IfVersion < 2.4>
<Files "*">
Order Allow,Deny
Deny from All
</Files>
</IfVersion>
<IfVersion >= 2.4>
<Files "*">
Require all denied
</Files>
</IfVersion>
</IfModule>
<IfModule !mod_version.c>
<IfModule !mod_authz_core.c>
<Files "*">
Order Allow,Deny
Deny from All
</Files>
</IfModule>
<IfModule mod_authz_core.c>
<Files "*">
Require all denied
</Files>
</IfModule>
</IfModule>

View File

@ -0,0 +1,70 @@
<?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\v30x;
class local_url_bbcode extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc1');
}
public function update_data()
{
return array(
array('custom', array(array($this, 'update_local_url_bbcode'))),
);
}
/**
* Update BBCodes that currently use the LOCAL_URL tag
*
* To fix http://tracker.phpbb.com/browse/PHPBB3-8319 we changed
* the second_pass_replace value, so that needs updating for existing ones
*/
public function update_local_url_bbcode()
{
$sql = 'SELECT *
FROM ' . BBCODES_TABLE . '
WHERE bbcode_match ' . $this->db->sql_like_expression($this->db->get_any_char() . 'LOCAL_URL' . $this->db->get_any_char());
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
if (!class_exists('acp_bbcodes'))
{
if (function_exists('phpbb_require_updated'))
{
phpbb_require_updated('includes/acp/acp_bbcodes.' . $this->php_ext);
}
else
{
require($this->phpbb_root_path . 'includes/acp/acp_bbcodes.' . $this->php_ext);
}
}
$bbcode_match = $row['bbcode_match'];
$bbcode_tpl = $row['bbcode_tpl'];
$acp_bbcodes = new \acp_bbcodes();
$sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl);
$sql = 'UPDATE ' . BBCODES_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
WHERE bbcode_id = ' . (int) $row['bbcode_id'];
$this->sql_query($sql);
}
$this->db->sql_freeresult($result);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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\v30x;
class release_3_0_1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_1_rc1');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.1')),
);
}
}

View File

@ -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\v30x;
class release_3_0_10 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.10', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc3');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.10')),
);
}
}

View 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\v30x;
class release_3_0_10_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.10-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_9');
}
public function update_data()
{
return array(
array('config.add', array('email_max_chunk_size', 50)),
array('config.update', array('version', '3.0.10-RC1')),
);
}
}

View File

@ -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\v30x;
class release_3_0_10_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.10-RC2', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc1');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.10-RC2')),
);
}
}

View File

@ -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\v30x;
class release_3_0_10_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.10-RC3', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc2');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.10-RC3')),
);
}
}

View File

@ -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\v30x;
class release_3_0_11 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.11', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11_rc2');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.11')),
);
}
}

View File

@ -0,0 +1,101 @@
<?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\v30x;
class release_3_0_11_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.11-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_10');
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'cleanup_deactivated_styles'))),
array('custom', array(array(&$this, 'delete_orphan_private_messages'))),
array('config.update', array('version', '3.0.11-RC1')),
);
}
public function cleanup_deactivated_styles()
{
// Updates users having current style a deactivated one
$sql = 'SELECT style_id
FROM ' . STYLES_TABLE . '
WHERE style_active = 0';
$result = $this->sql_query($sql);
$deactivated_style_ids = array();
while ($style_id = $this->db->sql_fetchfield('style_id', false, $result))
{
$deactivated_style_ids[] = (int) $style_id;
}
$this->db->sql_freeresult($result);
if (!empty($deactivated_style_ids))
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_style = ' . (int) $this->config['default_style'] .'
WHERE ' . $this->db->sql_in_set('user_style', $deactivated_style_ids);
$this->sql_query($sql);
}
}
public function delete_orphan_private_messages()
{
// Delete orphan private messages
$batch_size = 500;
$sql_array = array(
'SELECT' => 'p.msg_id',
'FROM' => array(
PRIVMSGS_TABLE => 'p',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(PRIVMSGS_TO_TABLE => 't'),
'ON' => 'p.msg_id = t.msg_id',
),
),
'WHERE' => 't.user_id IS NULL',
);
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query_limit($sql, $batch_size);
$delete_pms = array();
while ($row = $this->db->sql_fetchrow($result))
{
$delete_pms[] = (int) $row['msg_id'];
}
$this->db->sql_freeresult($result);
if (!empty($delete_pms))
{
$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
WHERE ' . $this->db->sql_in_set('msg_id', $delete_pms);
$this->sql_query($sql);
// Return false to have the Migrator call this function again
return false;
}
}
}

View File

@ -0,0 +1,56 @@
<?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\v30x;
class release_3_0_11_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.11-RC2', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11_rc1');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_show_novalue' => array('BOOL', 0),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_show_novalue',
),
),
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.11-RC2')),
);
}
}

View 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\v30x;
class release_3_0_12 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.12', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc3');
}
public function update_data()
{
return array(
array('if', array(
phpbb_version_compare($this->config['version'], '3.0.12', '<'),
array('config.update', array('version', '3.0.12')),
)),
);
}
}

View File

@ -0,0 +1,72 @@
<?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\v30x;
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 **/
class release_3_0_12_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.12-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'update_module_auth'))),
array('custom', array(array(&$this, 'disable_bots_from_receiving_pms'))),
array('config.update', array('version', '3.0.12-RC1')),
);
}
public function disable_bots_from_receiving_pms()
{
// Disable receiving pms for bots
$sql = 'SELECT user_id
FROM ' . BOTS_TABLE;
$result = $this->db->sql_query($sql);
$bot_user_ids = array();
while ($row = $this->db->sql_fetchrow($result))
{
$bot_user_ids[] = (int) $row['user_id'];
}
$this->db->sql_freeresult($result);
if (!empty($bot_user_ids))
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_allow_pm = 0
WHERE ' . $this->db->sql_in_set('user_id', $bot_user_ids);
$this->sql_query($sql);
}
}
public function update_module_auth()
{
$sql = 'UPDATE ' . MODULES_TABLE . '
SET module_auth = \'acl_u_sig\'
WHERE module_class = \'ucp\'
AND module_basename = \'profile\'
AND module_mode = \'signature\'';
$this->sql_query($sql);
}
}

View 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\v30x;
class release_3_0_12_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.12-RC2', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc1');
}
public function update_data()
{
return array(
array('if', array(
phpbb_version_compare($this->config['version'], '3.0.12-RC2', '<'),
array('config.update', array('version', '3.0.12-RC2')),
)),
);
}
}

View 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\v30x;
class release_3_0_12_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.12-RC3', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc2');
}
public function update_data()
{
return array(
array('if', array(
phpbb_version_compare($this->config['version'], '3.0.12-RC3', '<'),
array('config.update', array('version', '3.0.12-RC3')),
)),
);
}
}

View 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\v30x;
class release_3_0_13 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.13', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_13_rc1');
}
public function update_data()
{
return array(
array('if', array(
phpbb_version_compare($this->config['version'], '3.0.13', '<'),
array('config.update', array('version', '3.0.13')),
)),
);
}
}

View 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\v30x;
class release_3_0_13_pl1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.13-PL1', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_13');
}
public function update_data()
{
return array(
array('if', array(
phpbb_version_compare($this->config['version'], '3.0.13-PL1', '<'),
array('config.update', array('version', '3.0.13-PL1')),
)),
);
}
}

View 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\v30x;
class release_3_0_13_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.13-RC1', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_12');
}
public function update_data()
{
return array(
array('if', array(
phpbb_version_compare($this->config['version'], '3.0.13-RC1', '<'),
array('config.update', array('version', '3.0.13-RC1')),
)),
);
}
}

View 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\v30x;
class release_3_0_14 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.14', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_14_rc1');
}
public function update_data()
{
return array(
array('if', array(
phpbb_version_compare($this->config['version'], '3.0.14', '<'),
array('config.update', array('version', '3.0.14')),
)),
);
}
}

View 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\v30x;
class release_3_0_14_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.14-RC1', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_13');
}
public function update_data()
{
return array(
array('if', array(
phpbb_version_compare($this->config['version'], '3.0.14-RC1', '<'),
array('config.update', array('version', '3.0.14-RC1')),
)),
);
}
}

View File

@ -0,0 +1,119 @@
<?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\v30x;
class release_3_0_1_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.1-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_0');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'forums' => array(
'display_subforum_list' => array('BOOL', 1),
),
$this->table_prefix . 'sessions' => array(
'session_forum_id' => array('UINT', 0),
),
),
'drop_keys' => array(
$this->table_prefix . 'groups' => array(
'group_legend',
),
),
'add_index' => array(
$this->table_prefix . 'sessions' => array(
'session_forum_id' => array('session_forum_id'),
),
$this->table_prefix . 'groups' => array(
'group_legend_name' => array('group_legend', 'group_name'),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'forums' => array(
'display_subforum_list',
),
$this->table_prefix . 'sessions' => array(
'session_forum_id',
),
),
'add_index' => array(
$this->table_prefix . 'groups' => array(
'group_legend' => array('group_legend'),
),
),
'drop_keys' => array(
$this->table_prefix . 'sessions' => array(
'session_forum_id',
),
$this->table_prefix . 'groups' => array(
'group_legend_name',
),
),
);
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'fix_unset_last_view_time'))),
array('custom', array(array(&$this, 'reset_smiley_size'))),
array('config.update', array('version', '3.0.1-RC1')),
);
}
public function fix_unset_last_view_time()
{
$sql = 'UPDATE ' . $this->table_prefix . "topics
SET topic_last_view_time = topic_last_post_time
WHERE topic_last_view_time = 0";
$this->sql_query($sql);
}
public function reset_smiley_size()
{
// Update smiley sizes
$smileys = array('icon_e_surprised.gif', 'icon_eek.gif', 'icon_cool.gif', 'icon_lol.gif', 'icon_mad.gif', 'icon_razz.gif', 'icon_redface.gif', 'icon_cry.gif', 'icon_evil.gif', 'icon_twisted.gif', 'icon_rolleyes.gif', 'icon_exclaim.gif', 'icon_question.gif', 'icon_idea.gif', 'icon_arrow.gif', 'icon_neutral.gif', 'icon_mrgreen.gif', 'icon_e_ugeek.gif');
foreach ($smileys as $smiley)
{
if (file_exists($this->phpbb_root_path . 'images/smilies/' . $smiley))
{
list($width, $height) = getimagesize($this->phpbb_root_path . 'images/smilies/' . $smiley);
$sql = 'UPDATE ' . SMILIES_TABLE . '
SET smiley_width = ' . $width . ', smiley_height = ' . $height . "
WHERE smiley_url = '" . $this->db->sql_escape($smiley) . "'";
$this->sql_query($sql);
}
}
}
}

View File

@ -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\v30x;
class release_3_0_2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.2', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_2_rc2');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.2')),
);
}
}

View File

@ -0,0 +1,38 @@
<?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\v30x;
class release_3_0_2_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.2-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_1');
}
public function update_data()
{
return array(
array('config.add', array('referer_validation', '1')),
array('config.add', array('check_attachment_content', '1')),
array('config.add', array('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title')),
array('config.update', array('version', '3.0.2-RC1')),
);
}
}

View File

@ -0,0 +1,86 @@
<?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\v30x;
class release_3_0_2_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.2-RC2', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_2_rc1');
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'drafts' => array(
'draft_subject' => array('STEXT_UNI', ''),
),
$this->table_prefix . 'forums' => array(
'forum_last_post_subject' => array('STEXT_UNI', ''),
),
$this->table_prefix . 'posts' => array(
'post_subject' => array('STEXT_UNI', '', 'true_sort'),
),
$this->table_prefix . 'privmsgs' => array(
'message_subject' => array('STEXT_UNI', ''),
),
$this->table_prefix . 'topics' => array(
'topic_title' => array('STEXT_UNI', '', 'true_sort'),
'topic_last_post_subject' => array('STEXT_UNI', ''),
),
),
'drop_keys' => array(
$this->table_prefix . 'sessions' => array(
'session_forum_id',
),
),
'add_index' => array(
$this->table_prefix . 'sessions' => array(
'session_fid' => array('session_forum_id'),
),
),
);
}
public function revert_schema()
{
return array(
'add_index' => array(
$this->table_prefix . 'sessions' => array(
'session_forum_id' => array(
'session_forum_id',
),
),
),
'drop_keys' => array(
$this->table_prefix . 'sessions' => array(
'session_fid',
),
),
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.2-RC2')),
);
}
}

View File

@ -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\v30x;
class release_3_0_3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.3', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_3_rc1');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.3')),
);
}
}

View 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\v30x;
class release_3_0_3_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.3-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_2');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'styles_template' => array(
'template_inherits_id' => array('UINT:4', 0),
'template_inherit_path' => array('VCHAR', ''),
),
$this->table_prefix . 'groups' => array(
'group_max_recipients' => array('UINT', 0),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'styles_template' => array(
'template_inherits_id',
'template_inherit_path',
),
$this->table_prefix . 'groups' => array(
'group_max_recipients',
),
),
);
}
public function update_data()
{
return array(
array('config.add', array('enable_queue_trigger', '0')),
array('config.add', array('queue_trigger_posts', '3')),
array('config.add', array('pm_max_recipients', '0')),
array('custom', array(array(&$this, 'set_group_default_max_recipients'))),
array('config.add', array('dbms_version', $this->db->sql_server_info(true))),
array('permission.add', array('u_masspm_group', true, 'u_masspm')),
array('custom', array(array(&$this, 'correct_acp_email_permissions'))),
array('config.update', array('version', '3.0.3-RC1')),
);
}
public function correct_acp_email_permissions()
{
$sql = 'UPDATE ' . $this->table_prefix . 'modules
SET module_auth = \'acl_a_email && cfg_email_enable\'
WHERE module_class = \'acp\'
AND module_basename = \'email\'';
$this->sql_query($sql);
}
public function set_group_default_max_recipients()
{
// Set maximum number of recipients for the registered users, bots, guests group
$sql = 'UPDATE ' . GROUPS_TABLE . ' SET group_max_recipients = 5
WHERE ' . $this->db->sql_in_set('group_name', array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA', 'BOTS'));
$this->sql_query($sql);
}
}

View File

@ -0,0 +1,55 @@
<?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\v30x;
class release_3_0_4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.4', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_4_rc1');
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'rename_log_delete_topic'))),
array('config.update', array('version', '3.0.4')),
);
}
public function rename_log_delete_topic()
{
if ($this->db->get_sql_layer() == 'oracle')
{
// log_operation is CLOB - but we can change this later
$sql = 'UPDATE ' . $this->table_prefix . "log
SET log_operation = 'LOG_DELETE_TOPIC'
WHERE log_operation LIKE 'LOG_TOPIC_DELETED'";
$this->sql_query($sql);
}
else
{
$sql = 'UPDATE ' . $this->table_prefix . "log
SET log_operation = 'LOG_DELETE_TOPIC'
WHERE log_operation = 'LOG_TOPIC_DELETED'";
$this->sql_query($sql);
}
}
}

View File

@ -0,0 +1,129 @@
<?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\v30x;
class release_3_0_4_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.4-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_3');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_show_profile' => array('BOOL', 0),
),
),
'change_columns' => array(
$this->table_prefix . 'styles' => array(
'style_id' => array('UINT', NULL, 'auto_increment'),
'template_id' => array('UINT', 0),
'theme_id' => array('UINT', 0),
'imageset_id' => array('UINT', 0),
),
$this->table_prefix . 'styles_imageset' => array(
'imageset_id' => array('UINT', NULL, 'auto_increment'),
),
$this->table_prefix . 'styles_imageset_data' => array(
'image_id' => array('UINT', NULL, 'auto_increment'),
'imageset_id' => array('UINT', 0),
),
$this->table_prefix . 'styles_theme' => array(
'theme_id' => array('UINT', NULL, 'auto_increment'),
),
$this->table_prefix . 'styles_template' => array(
'template_id' => array('UINT', NULL, 'auto_increment'),
),
$this->table_prefix . 'styles_template_data' => array(
'template_id' => array('UINT', 0),
),
$this->table_prefix . 'forums' => array(
'forum_style' => array('UINT', 0),
),
$this->table_prefix . 'users' => array(
'user_style' => array('UINT', 0),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_show_profile',
),
),
);
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'update_custom_profile_fields'))),
array('config.update', array('version', '3.0.4-RC1')),
);
}
public function update_custom_profile_fields()
{
// Update the Custom Profile Fields based on previous settings to the new \format
$sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide
FROM ' . PROFILE_FIELDS_TABLE;
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
$sql_ary = array(
'field_required' => 0,
'field_show_on_reg' => 0,
'field_hide' => 0,
'field_show_profile'=> 0,
);
if ($row['field_required'])
{
$sql_ary['field_required'] = $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1;
}
else if ($row['field_show_on_reg'])
{
$sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1;
}
else if ($row['field_hide'])
{
// Only administrators and moderators can see this CPF, if the view is enabled, they can see it, otherwise just admins in the acp_users module
$sql_ary['field_hide'] = 1;
}
else
{
// equivelant to "none", which is the "Display in user control panel" option
$sql_ary['field_show_profile'] = 1;
}
$this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary);
}
$this->db->sql_freeresult($result);
}
}

View File

@ -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\v30x;
class release_3_0_5 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.5', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_5_rc1part2');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.5')),
);
}
}

View File

@ -0,0 +1,135 @@
<?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\v30x;
use phpbb\db\migration\container_aware_migration;
class release_3_0_5_rc1 extends container_aware_migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_4');
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'forums' => array(
'forum_style' => array('UINT', 0),
),
),
);
}
public function update_data()
{
$search_indexing_state = $this->config['search_indexing_state'];
return array(
array('config.add', array('captcha_gd_wave', 0)),
array('config.add', array('captcha_gd_3d_noise', 1)),
array('config.add', array('captcha_gd_fonts', 1)),
array('config.add', array('confirm_refresh', 1)),
array('config.add', array('max_num_search_keywords', 10)),
array('config.remove', array('search_indexing_state')),
array('config.add', array('search_indexing_state', $search_indexing_state, true)),
array('custom', array(array(&$this, 'hash_old_passwords'))),
array('custom', array(array(&$this, 'update_ichiro_bot'))),
);
}
public function hash_old_passwords()
{
/* @var $passwords_manager \phpbb\passwords\manager */
$passwords_manager = $this->container->get('passwords.manager');
$sql = 'SELECT user_id, user_password
FROM ' . $this->table_prefix . 'users
WHERE user_pass_convert = 1';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
if (strlen($row['user_password']) == 32)
{
$sql_ary = array(
'user_password' => '$CP$' . $passwords_manager->hash($row['user_password'], 'passwords.driver.salted_md5'),
);
$this->sql_query('UPDATE ' . $this->table_prefix . 'users SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id']);
}
}
$this->db->sql_freeresult($result);
}
public function update_ichiro_bot()
{
// Adjust bot entry
$sql = 'UPDATE ' . $this->table_prefix . "bots
SET bot_agent = 'ichiro/'
WHERE bot_agent = 'ichiro/2'";
$this->sql_query($sql);
}
public function remove_duplicate_auth_options()
{
// Before we are able to add a unique key to auth_option, we need to remove duplicate entries
$sql = 'SELECT auth_option
FROM ' . $this->table_prefix . 'acl_options
GROUP BY auth_option
HAVING COUNT(*) >= 2';
$result = $this->db->sql_query($sql);
$auth_options = array();
while ($row = $this->db->sql_fetchrow($result))
{
$auth_options[] = $row['auth_option'];
}
$this->db->sql_freeresult($result);
// Remove specific auth options
if (!empty($auth_options))
{
foreach ($auth_options as $option)
{
// Select auth_option_ids... the largest id will be preserved
$sql = 'SELECT auth_option_id
FROM ' . ACL_OPTIONS_TABLE . "
WHERE auth_option = '" . $this->db->sql_escape($option) . "'
ORDER BY auth_option_id DESC";
// sql_query_limit not possible here, due to bug in postgresql layer
$result = $this->db->sql_query($sql);
// Skip first row, this is our original auth option we want to preserve
$this->db->sql_fetchrow($result);
while ($row = $this->db->sql_fetchrow($result))
{
// Ok, remove this auth option...
$this->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
$this->sql_query('DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
$this->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
$this->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
}
$this->db->sql_freeresult($result);
}
}
}
}

View 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\v30x;
class release_3_0_5_rc1part2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_5_rc1');
}
public function update_schema()
{
return array(
'drop_keys' => array(
$this->table_prefix . 'acl_options' => array('auth_option'),
),
'add_unique_index' => array(
$this->table_prefix . 'acl_options' => array(
'auth_option' => array('auth_option'),
),
),
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.5-RC1')),
);
}
}

View File

@ -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\v30x;
class release_3_0_6 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.6', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc4');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.6')),
);
}
}

View File

@ -0,0 +1,364 @@
<?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\v30x;
class release_3_0_6_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.6-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_5');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'confirm' => array(
'attempts' => array('UINT', 0),
),
$this->table_prefix . 'users' => array(
'user_new' => array('BOOL', 1),
'user_reminded' => array('TINT:4', 0),
'user_reminded_time' => array('TIMESTAMP', 0),
),
$this->table_prefix . 'groups' => array(
'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'),
),
$this->table_prefix . 'privmsgs' => array(
'message_reported' => array('BOOL', 0),
),
$this->table_prefix . 'reports' => array(
'pm_id' => array('UINT', 0),
),
$this->table_prefix . 'profile_fields' => array(
'field_show_on_vt' => array('BOOL', 0),
),
$this->table_prefix . 'forums' => array(
'forum_options' => array('UINT:20', 0),
),
),
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_options' => array('UINT:11', 230271),
),
),
'add_index' => array(
$this->table_prefix . 'reports' => array(
'post_id' => array('post_id'),
'pm_id' => array('pm_id'),
),
$this->table_prefix . 'posts' => array(
'post_username' => array('post_username:255'),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'confirm' => array(
'attempts',
),
$this->table_prefix . 'users' => array(
'user_new',
'user_reminded',
'user_reminded_time',
),
$this->table_prefix . 'groups' => array(
'group_skip_auth',
),
$this->table_prefix . 'privmsgs' => array(
'message_reported',
),
$this->table_prefix . 'reports' => array(
'pm_id',
),
$this->table_prefix . 'profile_fields' => array(
'field_show_on_vt',
),
$this->table_prefix . 'forums' => array(
'forum_options',
),
),
'drop_keys' => array(
$this->table_prefix . 'reports' => array(
'post_id',
'pm_id',
),
$this->table_prefix . 'posts' => array(
'post_username',
),
),
);
}
public function update_data()
{
return array(
array('config.add', array('captcha_plugin', 'phpbb_captcha_nogd')),
array('if', array(
($this->config['captcha_gd']),
array('config.update', array('captcha_plugin', 'phpbb_captcha_gd')),
)),
array('config.add', array('feed_enable', 0)),
array('config.add', array('feed_limit', 10)),
array('config.add', array('feed_overall_forums', 1)),
array('config.add', array('feed_overall_forums_limit', 15)),
array('config.add', array('feed_overall_topics', 0)),
array('config.add', array('feed_overall_topics_limit', 15)),
array('config.add', array('feed_forum', 1)),
array('config.add', array('feed_topic', 1)),
array('config.add', array('feed_item_statistics', 1)),
array('config.add', array('smilies_per_page', 50)),
array('config.add', array('allow_pm_report', 1)),
array('config.add', array('min_post_chars', 1)),
array('config.add', array('allow_quick_reply', 1)),
array('config.add', array('new_member_post_limit', 0)),
array('config.add', array('new_member_group_default', 0)),
array('config.add', array('delete_time', $this->config['edit_time'])),
array('config.add', array('allow_avatar', 0)),
array('if', array(
($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']),
array('config.update', array('allow_avatar', 1)),
)),
array('config.add', array('allow_avatar_remote_upload', 0)),
array('if', array(
($this->config['allow_avatar_remote'] && $this->config['allow_avatar_upload']),
array('config.update', array('allow_avatar_remote_upload', 1)),
)),
array('module.add', array(
'acp',
'ACP_BOARD_CONFIGURATION',
array(
'module_basename' => 'acp_board',
'module_langname' => 'ACP_FEED_SETTINGS',
'module_mode' => 'feed',
'module_auth' => 'acl_a_board',
'after' => array('signature', 'ACP_SIGNATURE_SETTINGS'),
),
)),
array('module.add', array(
'acp',
'ACP_CAT_USERS',
array(
'module_basename' => 'acp_users',
'module_langname' => 'ACP_USER_WARNINGS',
'module_mode' => 'warnings',
'module_auth' => 'acl_a_user',
'module_display' => false,
'after' => array('feedback', 'ACP_USER_FEEDBACK'),
),
)),
array('module.add', array(
'acp',
'ACP_SERVER_CONFIGURATION',
array(
'module_basename' => 'acp_send_statistics',
'module_langname' => 'ACP_SEND_STATISTICS',
'module_mode' => 'send_statistics',
'module_auth' => 'acl_a_server',
),
)),
array('module.add', array(
'acp',
'ACP_FORUM_BASED_PERMISSIONS',
array(
'module_basename' => 'acp_permissions',
'module_langname' => 'ACP_FORUM_PERMISSIONS_COPY',
'module_mode' => 'setting_forum_copy',
'module_auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth',
'after' => array('setting_forum_local', 'ACP_FORUM_PERMISSIONS'),
),
)),
array('module.add', array(
'mcp',
'MCP_REPORTS',
array(
'module_basename' => 'mcp_pm_reports',
'module_langname' => 'MCP_PM_REPORTS_OPEN',
'module_mode' => 'pm_reports',
'module_auth' => 'acl_m_pm_report',
),
)),
array('module.add', array(
'mcp',
'MCP_REPORTS',
array(
'module_basename' => 'mcp_pm_reports',
'module_langname' => 'MCP_PM_REPORTS_CLOSED',
'module_mode' => 'pm_reports_closed',
'module_auth' => 'acl_m_pm_report',
),
)),
array('module.add', array(
'mcp',
'MCP_REPORTS',
array(
'module_basename' => 'mcp_pm_reports',
'module_langname' => 'MCP_PM_REPORT_DETAILS',
'module_mode' => 'pm_report_details',
'module_auth' => 'acl_m_pm_report',
),
)),
array('custom', array(array(&$this, 'add_newly_registered_group'))),
array('custom', array(array(&$this, 'set_user_options_default'))),
array('config.update', array('version', '3.0.6-RC1')),
);
}
public function set_user_options_default()
{
// 229376 is the added value to enable all three signature options
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376';
$this->sql_query($sql);
}
public function add_newly_registered_group()
{
// Add newly_registered group... but check if it already exists (we always supported running the updater on any schema)
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'NEWLY_REGISTERED'";
$result = $this->db->sql_query($sql);
$group_id = (int) $this->db->sql_fetchfield('group_id');
$this->db->sql_freeresult($result);
if (!$group_id)
{
$sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)";
$this->sql_query($sql);
$group_id = $this->db->sql_nextid();
}
// Insert new user role... at the end of the chain
$sql = 'SELECT role_id
FROM ' . ACL_ROLES_TABLE . "
WHERE role_name = 'ROLE_USER_NEW_MEMBER'
AND role_type = 'u_'";
$result = $this->db->sql_query($sql);
$u_role = (int) $this->db->sql_fetchfield('role_id');
$this->db->sql_freeresult($result);
if (!$u_role)
{
$sql = 'SELECT MAX(role_order) as max_order_id
FROM ' . ACL_ROLES_TABLE . "
WHERE role_type = 'u_'";
$result = $this->db->sql_query($sql);
$next_order_id = (int) $this->db->sql_fetchfield('max_order_id');
$this->db->sql_freeresult($result);
$next_order_id++;
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)";
$this->sql_query($sql);
$u_role = $this->db->sql_nextid();
// Now add the correct data to the roles...
// The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups
$sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')";
$this->sql_query($sql);
// Add user role to group
$sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)";
$this->sql_query($sql);
}
// Insert new forum role
$sql = 'SELECT role_id
FROM ' . ACL_ROLES_TABLE . "
WHERE role_name = 'ROLE_FORUM_NEW_MEMBER'
AND role_type = 'f_'";
$result = $this->db->sql_query($sql);
$f_role = (int) $this->db->sql_fetchfield('role_id');
$this->db->sql_freeresult($result);
if (!$f_role)
{
$sql = 'SELECT MAX(role_order) as max_order_id
FROM ' . ACL_ROLES_TABLE . "
WHERE role_type = 'f_'";
$result = $this->db->sql_query($sql);
$next_order_id = (int) $this->db->sql_fetchfield('max_order_id');
$this->db->sql_freeresult($result);
$next_order_id++;
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)";
$this->sql_query($sql);
$f_role = $this->db->sql_nextid();
$sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')";
$this->sql_query($sql);
}
// Set every members user_new column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once)
$sql = 'SELECT 1
FROM ' . USERS_TABLE . '
WHERE user_new = 0';
$result = $this->db->sql_query_limit($sql, 1);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (!$row)
{
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0';
$this->sql_query($sql);
}
// To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts...
// Check if the role is already assigned...
$sql = 'SELECT forum_id
FROM ' . ACL_GROUPS_TABLE . '
WHERE group_id = ' . $group_id . '
AND auth_role_id = ' . $f_role;
$result = $this->db->sql_query($sql);
$is_options = (int) $this->db->sql_fetchfield('forum_id');
$this->db->sql_freeresult($result);
// Not assigned at all... :/
if (!$is_options)
{
// Get postable forums
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type != ' . FORUM_LINK;
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
$this->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)');
}
$this->db->sql_freeresult($result);
}
// Clear permissions...
include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext);
$auth_admin = new \auth_admin();
$auth_admin->acl_clear_prefetch();
}
}

View File

@ -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\v30x;
class release_3_0_6_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.6-RC2', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc1');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.6-RC2')),
);
}
}

View File

@ -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\v30x;
class release_3_0_6_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.6-RC3', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc2');
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'update_cp_fields'))),
array('config.update', array('version', '3.0.6-RC3')),
);
}
public function update_cp_fields()
{
// Update the Custom Profile Fields based on previous settings to the new \format
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . '
SET field_show_on_vt = 1
WHERE field_hide = 0
AND (field_required = 1 OR field_show_on_reg = 1 OR field_show_profile = 1)';
$this->sql_query($sql);
}
}

View File

@ -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\v30x;
class release_3_0_6_rc4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.6-RC4', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc3');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.6-RC4')),
);
}
}

View File

@ -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\v30x;
class release_3_0_7 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.7', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_7_rc2');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.7')),
);
}
}

View File

@ -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\v30x;
class release_3_0_7_pl1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.7-pl1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_7');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.7-pl1')),
);
}
}

View File

@ -0,0 +1,82 @@
<?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\v30x;
class release_3_0_7_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.7-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_6');
}
public function update_schema()
{
return array(
'drop_keys' => array(
$this->table_prefix . 'log' => array(
'log_time',
),
),
'add_index' => array(
$this->table_prefix . 'topics_track' => array(
'topic_id' => array('topic_id'),
),
),
);
}
public function revert_schema()
{
return array(
'add_index' => array(
$this->table_prefix . 'log' => array(
'log_time' => array('log_time'),
),
),
'drop_keys' => array(
$this->table_prefix . 'topics_track' => array(
'topic_id',
),
),
);
}
public function update_data()
{
return array(
array('config.add', array('feed_overall', 1)),
array('config.add', array('feed_http_auth', 0)),
array('config.add', array('feed_limit_post', $this->config['feed_limit'])),
array('config.add', array('feed_limit_topic', $this->config['feed_overall_topics_limit'])),
array('config.add', array('feed_topics_new', $this->config['feed_overall_topics'])),
array('config.add', array('feed_topics_active', $this->config['feed_overall_topics'])),
array('custom', array(array(&$this, 'delete_text_templates'))),
array('config.update', array('version', '3.0.7-RC1')),
);
}
public function delete_text_templates()
{
// Delete all text-templates from the template_data
$sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
WHERE template_filename ' . $this->db->sql_like_expression($this->db->get_any_char() . '.txt');
$this->sql_query($sql);
}
}

View File

@ -0,0 +1,79 @@
<?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\v30x;
class release_3_0_7_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.7-RC2', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_7_rc1');
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'update_email_hash'))),
array('config.update', array('version', '3.0.7-RC2')),
);
}
public function update_email_hash($start = 0)
{
$limit = 1000;
$sql = 'SELECT user_id, user_email, user_email_hash
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . "
AND user_email <> ''";
$result = $this->db->sql_query_limit($sql, $limit, $start);
$i = 0;
while ($row = $this->db->sql_fetchrow($result))
{
$i++;
// Snapshot of the phpbb_email_hash() function
// We cannot call it directly because the auto updater updates the DB first. :/
$user_email_hash = sprintf('%u', crc32(strtolower($row['user_email']))) . strlen($row['user_email']);
if ($user_email_hash != $row['user_email_hash'])
{
$sql_ary = array(
'user_email_hash' => $user_email_hash,
);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . (int) $row['user_id'];
$this->sql_query($sql);
}
}
$this->db->sql_freeresult($result);
if ($i < $limit)
{
// Completed
return;
}
// Return the next start, will be sent to $start when this function is called again
return $start + $limit;
}
}

View File

@ -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\v30x;
class release_3_0_8 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.8', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_8_rc1');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.8')),
);
}
}

View File

@ -0,0 +1,170 @@
<?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\v30x;
class release_3_0_8_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.8-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_7_pl1');
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'update_file_extension_group_names'))),
array('custom', array(array(&$this, 'update_module_auth'))),
array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))),
array('module.add', array(
'acp',
'ACP_MESSAGES',
array(
'module_basename' => 'acp_board',
'module_langname' => 'ACP_POST_SETTINGS',
'module_mode' => 'post',
'module_auth' => 'acl_a_board',
'after' => array('message', 'ACP_MESSAGE_SETTINGS'),
),
)),
array('config.add', array('load_unreads_search', 1)),
array('config.update_if_equals', array(600, 'queue_interval', 60)),
array('config.update_if_equals', array(50, 'email_package_size', 20)),
array('config.update', array('version', '3.0.8-RC1')),
);
}
public function update_file_extension_group_names()
{
// Update file extension group names to use language strings.
$sql = 'SELECT lang_dir
FROM ' . LANG_TABLE;
$result = $this->db->sql_query($sql);
$extension_groups_updated = array();
while ($row = $this->db->sql_fetchrow($result))
{
if (empty($row['lang_dir']))
{
continue;
}
$lang_dir = basename($row['lang_dir']);
// The language strings we need are either in language/.../acp/attachments.php
// in the update package if we're updating to 3.0.8-RC1 or later,
// or they are in language/.../install.php when we're updating from 3.0.7-PL1 or earlier.
// On an already updated board, they can also already be in language/.../acp/attachments.php
// in the board root.
$lang_files = array(
"{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.{$this->php_ext}",
"{$this->phpbb_root_path}language/$lang_dir/install.{$this->php_ext}",
"{$this->phpbb_root_path}language/$lang_dir/acp/attachments.{$this->php_ext}",
);
foreach ($lang_files as $lang_file)
{
if (!file_exists($lang_file))
{
continue;
}
$lang = array();
include($lang_file);
foreach($lang as $lang_key => $lang_val)
{
if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0)
{
continue;
}
$sql_ary = array(
'group_name' => substr($lang_key, 10), // Strip off 'EXT_GROUP_'
);
$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "
WHERE group_name = '" . $this->db->sql_escape($lang_val) . "'";
$this->sql_query($sql);
$extension_groups_updated[$lang_key] = true;
}
}
}
$this->db->sql_freeresult($result);
}
public function update_module_auth()
{
$sql = 'UPDATE ' . MODULES_TABLE . '
SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)\'
WHERE module_class = \'ucp\'
AND module_basename = \'profile\'
AND module_mode = \'avatar\'';
$this->sql_query($sql);
}
public function delete_orphan_shadow_topics()
{
// Delete shadow topics pointing to not existing topics
$batch_size = 500;
// Set of affected forums we have to resync
$sync_forum_ids = array();
$sql_array = array(
'SELECT' => 't1.topic_id, t1.forum_id',
'FROM' => array(
TOPICS_TABLE => 't1',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(TOPICS_TABLE => 't2'),
'ON' => 't1.topic_moved_id = t2.topic_id',
),
),
'WHERE' => 't1.topic_moved_id <> 0
AND t2.topic_id IS NULL',
);
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query_limit($sql, $batch_size);
$topic_ids = array();
while ($row = $this->db->sql_fetchrow($result))
{
$topic_ids[] = (int) $row['topic_id'];
$sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id'];
}
$this->db->sql_freeresult($result);
if (!empty($topic_ids))
{
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids);
$this->db->sql_query($sql);
// Sync the forums we have deleted shadow topics from.
sync('forum', 'forum_id', $sync_forum_ids, true, true);
return false;
}
}
}

View File

@ -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\v30x;
class release_3_0_9 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.9', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc4');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.9')),
);
}
}

View File

@ -0,0 +1,130 @@
<?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\v30x;
class release_3_0_9_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.9-RC1', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_8');
}
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'login_attempts' => array(
'COLUMNS' => array(
// this column was removed from the database updater
// after 3.0.9-RC3 was released. It might still exist
// in 3.0.9-RCX installations and has to be dropped as
// soon as the \phpbb\db\tools\tools class is capable of properly
// removing a primary key.
// 'attempt_id' => array('UINT', NULL, 'auto_increment'),
'attempt_ip' => array('VCHAR:40', ''),
'attempt_browser' => array('VCHAR:150', ''),
'attempt_forwarded_for' => array('VCHAR:255', ''),
'attempt_time' => array('TIMESTAMP', 0),
'user_id' => array('UINT', 0),
'username' => array('VCHAR_UNI:255', 0),
'username_clean' => array('VCHAR_CI', 0),
),
//'PRIMARY_KEY' => 'attempt_id',
'KEYS' => array(
'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')),
'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')),
'att_time' => array('INDEX', array('attempt_time')),
'user_id' => array('INDEX', 'user_id'),
),
),
),
'change_columns' => array(
$this->table_prefix . 'bbcodes' => array(
'bbcode_id' => array('USINT', 0),
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'login_attempts',
),
);
}
public function update_data()
{
return array(
array('config.add', array('ip_login_limit_max', 50)),
array('config.add', array('ip_login_limit_time', 21600)),
array('config.add', array('ip_login_limit_use_forwarded', 0)),
array('custom', array(array(&$this, 'update_file_extension_group_names'))),
array('custom', array(array(&$this, 'fix_firebird_qa_captcha'))),
array('config.update', array('version', '3.0.9-RC1')),
);
}
public function update_file_extension_group_names()
{
// Update file extension group names to use language strings, again.
$sql = 'SELECT group_id, group_name
FROM ' . EXTENSION_GROUPS_TABLE . '
WHERE group_name ' . $this->db->sql_like_expression('EXT_GROUP_' . $this->db->get_any_char());
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
$sql_ary = array(
'group_name' => substr($row['group_name'], 10), // Strip off 'EXT_GROUP_'
);
$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
WHERE group_id = ' . $row['group_id'];
$this->sql_query($sql);
}
$this->db->sql_freeresult($result);
}
public function fix_firebird_qa_captcha()
{
// Recover from potentially broken Q&A CAPTCHA table on firebird
// Q&A CAPTCHA was uninstallable, so it's safe to remove these
// without data loss
if ($this->db_tools->sql_layer == 'firebird')
{
$tables = array(
$this->table_prefix . 'captcha_questions',
$this->table_prefix . 'captcha_answers',
$this->table_prefix . 'qa_confirm',
);
foreach ($tables as $table)
{
if ($this->db_tools->sql_table_exists($table))
{
$this->db_tools->sql_table_drop($table);
}
}
}
}
}

View File

@ -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\v30x;
class release_3_0_9_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.9-RC2', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc1');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.9-RC2')),
);
}
}

View File

@ -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\v30x;
class release_3_0_9_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.9-RC3', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc2');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.9-RC3')),
);
}
}

View File

@ -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\v30x;
class release_3_0_9_rc4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.9-RC4', '>=');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc3');
}
public function update_data()
{
return array(
array('config.update', array('version', '3.0.9-RC4')),
);
}
}

View File

@ -0,0 +1,33 @@
# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
# module mod_authz_host to a new module called mod_access_compat (which may be
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
# We could just conditionally provide both versions, but unfortunately Apache
# does not explicitly tell us its version if the module mod_version is not
# available. In this case, we check for the availability of module
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
<IfModule mod_version.c>
<IfVersion < 2.4>
<Files "*">
Order Allow,Deny
Deny from All
</Files>
</IfVersion>
<IfVersion >= 2.4>
<Files "*">
Require all denied
</Files>
</IfVersion>
</IfModule>
<IfModule !mod_version.c>
<IfModule !mod_authz_core.c>
<Files "*">
Order Allow,Deny
Deny from All
</Files>
</IfModule>
<IfModule mod_authz_core.c>
<Files "*">
Require all denied
</Files>
</IfModule>
</IfModule>

View File

@ -0,0 +1,76 @@
<?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\v310;
class acp_prune_users_module extends \phpbb\db\migration\container_aware_migration
{
public function effectively_installed()
{
$sql = 'SELECT module_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'acp'
AND module_langname = 'ACP_CAT_USERS'";
$result = $this->db->sql_query($sql);
$acp_cat_users_id = (int) $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result);
$sql = 'SELECT parent_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'acp'
AND module_basename = 'acp_prune'
AND module_mode = 'users'";
$result = $this->db->sql_query($sql);
$acp_prune_users_parent = (int) $this->db->sql_fetchfield('parent_id');
$this->db->sql_freeresult($result);
// Skip migration if "Users" category has been deleted
// or the module has already been moved to that category
return !$acp_cat_users_id || $acp_cat_users_id === $acp_prune_users_parent;
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\beta1');
}
public function update_data()
{
return array(
array('custom', array(array($this, 'move_prune_users_module'))),
);
}
public function move_prune_users_module()
{
$sql = 'SELECT module_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'acp'
AND module_basename = 'acp_prune'
AND module_mode = 'users'";
$result = $this->db->sql_query($sql);
$acp_prune_users_id = (int) $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result);
$sql = 'SELECT module_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'acp'
AND module_langname = 'ACP_CAT_USERS'";
$result = $this->db->sql_query($sql);
$acp_cat_users_id = (int) $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result);
$module_manager = $this->container->get('module.manager');
$module_manager->move_module($acp_prune_users_id, $acp_cat_users_id, 'acp');
}
}

View File

@ -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\v310;
class acp_style_components_module extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
$sql = 'SELECT module_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'acp'
AND module_langname = 'ACP_STYLE_COMPONENTS'";
$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(
'acp',
false,
'ACP_STYLE_COMPONENTS',
)),
);
}
}

View 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\v310;
class allow_cdn extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['allow_cdn']);
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\jquery_update',
);
}
public function update_data()
{
return array(
array('config.add', array('allow_cdn', (int) $this->config['load_jquery_cdn'])),
array('config.remove', array('load_jquery_cdn')),
);
}
}

View File

@ -0,0 +1,53 @@
<?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\v310;
class alpha1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-a1', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v30x\local_url_bbcode',
'\phpbb\db\migration\data\v30x\release_3_0_12',
'\phpbb\db\migration\data\v310\acp_style_components_module',
'\phpbb\db\migration\data\v310\allow_cdn',
'\phpbb\db\migration\data\v310\auth_provider_oauth',
'\phpbb\db\migration\data\v310\avatars',
'\phpbb\db\migration\data\v310\boardindex',
'\phpbb\db\migration\data\v310\config_db_text',
'\phpbb\db\migration\data\v310\forgot_password',
'\phpbb\db\migration\data\v310\mod_rewrite',
'\phpbb\db\migration\data\v310\mysql_fulltext_drop',
'\phpbb\db\migration\data\v310\namespaces',
'\phpbb\db\migration\data\v310\notifications_cron',
'\phpbb\db\migration\data\v310\notification_options_reconvert',
'\phpbb\db\migration\data\v310\plupload',
'\phpbb\db\migration\data\v310\signature_module_auth',
'\phpbb\db\migration\data\v310\softdelete_mcp_modules',
'\phpbb\db\migration\data\v310\teampage',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-a1')),
);
}
}

View 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\v310;
class alpha2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-a2', '>=');
}
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

@ -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\v310;
class alpha3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-a3', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\alpha2',
'\phpbb\db\migration\data\v310\avatar_types',
'\phpbb\db\migration\data\v310\passwords',
'\phpbb\db\migration\data\v310\profilefield_types',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-a3')),
);
}
}

View File

@ -0,0 +1,84 @@
<?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\v310;
class auth_provider_oauth extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_table_exists($this->table_prefix . 'oauth_tokens');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_0');
}
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'oauth_tokens' => array(
'COLUMNS' => array(
'user_id' => array('UINT', 0), // phpbb_users.user_id
'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set
'provider' => array('VCHAR', ''), // Name of the OAuth provider
'oauth_token' => array('MTEXT', ''), // Serialized token
),
'KEYS' => array(
'user_id' => array('INDEX', 'user_id'),
'provider' => array('INDEX', 'provider'),
),
),
$this->table_prefix . 'oauth_accounts' => array(
'COLUMNS' => array(
'user_id' => array('UINT', 0),
'provider' => array('VCHAR', ''),
'oauth_provider_id' => array('TEXT_UNI', ''),
),
'PRIMARY_KEY' => array(
'user_id',
'provider',
),
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'oauth_tokens',
$this->table_prefix . 'oauth_accounts',
),
);
}
public function update_data()
{
return array(
array('module.add', array(
'ucp',
'UCP_PROFILE',
array(
'module_basename' => 'ucp_auth_link',
'module_langname' => 'UCP_AUTH_LINK_MANAGE',
'module_mode' => 'auth_link',
'module_auth' => 'authmethod_oauth',
),
)),
);
}
}

View 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\v310;
class auth_provider_oauth2 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\auth_provider_oauth',
);
}
public function update_data()
{
return array(
array('custom', array(
array($this, 'update_auth_link_module_auth'),
)),
);
}
public function update_auth_link_module_auth()
{
$sql = 'UPDATE ' . MODULES_TABLE . "
SET module_auth = 'authmethod_oauth'
WHERE module_class = 'ucp'
AND module_basename = 'ucp_auth_link'
AND module_mode = 'auth_link'
AND module_auth = ''";
$this->db->sql_query($sql);
}
}

View File

@ -0,0 +1,64 @@
<?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\v310;
class avatar_types extends \phpbb\db\migration\migration
{
/**
* @var avatar type map
*/
protected $avatar_type_map = array(
AVATAR_UPLOAD => 'avatar.driver.upload',
AVATAR_REMOTE => 'avatar.driver.remote',
AVATAR_GALLERY => 'avatar.driver.local',
);
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\dev',
'\phpbb\db\migration\data\v310\avatars',
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'update_user_avatar_type'))),
array('custom', array(array($this, 'update_group_avatar_type'))),
);
}
public function update_user_avatar_type()
{
foreach ($this->avatar_type_map as $old => $new)
{
$sql = 'UPDATE ' . $this->table_prefix . "users
SET user_avatar_type = '$new'
WHERE user_avatar_type = '$old'";
$this->db->sql_query($sql);
}
}
public function update_group_avatar_type()
{
foreach ($this->avatar_type_map as $old => $new)
{
$sql = 'UPDATE ' . $this->table_prefix . "groups
SET group_avatar_type = '$new'
WHERE group_avatar_type = '$old'";
$this->db->sql_query($sql);
}
}
}

View File

@ -0,0 +1,95 @@
<?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\v310;
class avatars extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
// Get current avatar type of guest user
$sql = 'SELECT user_avatar_type
FROM ' . $this->table_prefix . 'users
WHERE user_id = ' . ANONYMOUS;
$result = $this->db->sql_query($sql);
$backup_type = $this->db->sql_fetchfield('user_avatar_type');
$this->db->sql_freeresult($result);
// Try to set avatar type to string
$sql = 'UPDATE ' . $this->table_prefix . "users
SET user_avatar_type = 'avatar.driver.upload'
WHERE user_id = " . ANONYMOUS;
$this->db->sql_return_on_error(true);
$effectively_installed = $this->db->sql_query($sql);
$this->db->sql_return_on_error();
// Restore avatar type of guest user to previous state
$sql = 'UPDATE ' . $this->table_prefix . "users
SET user_avatar_type = '{$backup_type}'
WHERE user_id = " . ANONYMOUS;
$this->db->sql_query($sql);
return $effectively_installed !== false;
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_avatar_type' => array('VCHAR:255', ''),
),
$this->table_prefix . 'groups' => array(
'group_avatar_type' => array('VCHAR:255', ''),
),
),
);
}
public function revert_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_avatar_type' => array('TINT:2', ''),
),
$this->table_prefix . 'groups' => array(
'group_avatar_type' => array('TINT:2', ''),
),
),
);
}
public function update_data()
{
return array(
array('config.add', array('allow_avatar_gravatar', 0)),
array('custom', array(array($this, 'update_module_auth'))),
);
}
public function update_module_auth()
{
$sql = 'UPDATE ' . $this->table_prefix . "modules
SET module_auth = 'cfg_allow_avatar'
WHERE module_class = 'ucp'
AND module_basename = 'ucp_profile'
AND module_mode = 'avatar'";
$this->db->sql_query($sql);
}
}

View File

@ -0,0 +1,42 @@
<?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\v310;
class beta1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-b1', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\alpha3',
'\phpbb\db\migration\data\v310\passwords_p2',
'\phpbb\db\migration\data\v310\postgres_fulltext_drop',
'\phpbb\db\migration\data\v310\profilefield_change_load_settings',
'\phpbb\db\migration\data\v310\profilefield_location',
'\phpbb\db\migration\data\v310\soft_delete_mod_convert2',
'\phpbb\db\migration\data\v310\ucp_popuppm_module',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-b1')),
);
}
}

View File

@ -0,0 +1,38 @@
<?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\v310;
class beta2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-b2', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\beta1',
'\phpbb\db\migration\data\v310\acp_prune_users_module',
'\phpbb\db\migration\data\v310\profilefield_location_cleanup',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-b2')),
);
}
}

View 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\v310;
class beta3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-b3', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\beta2',
'\phpbb\db\migration\data\v310\auth_provider_oauth2',
'\phpbb\db\migration\data\v310\board_contact_name',
'\phpbb\db\migration\data\v310\jquery_update2',
'\phpbb\db\migration\data\v310\live_searches_config',
'\phpbb\db\migration\data\v310\prune_shadow_topics',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-b3')),
);
}
}

View File

@ -0,0 +1,38 @@
<?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\v310;
class beta4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-b4', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\beta3',
'\phpbb\db\migration\data\v310\extensions_version_check_force_unstable',
'\phpbb\db\migration\data\v310\reset_missing_captcha_plugin',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-b4')),
);
}
}

View File

@ -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\v310;
class board_contact_name extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['board_contact_name']);
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\beta2');
}
public function update_data()
{
return array(
array('config.add', array('board_contact_name', '')),
);
}
}

View 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\v310;
class boardindex extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['board_index_text']);
}
public function update_data()
{
return array(
array('config.add', array('board_index_text', '')),
);
}
}

View File

@ -0,0 +1,150 @@
<?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\v310;
class bot_update extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\rc6');
}
public function update_data()
{
return array(
array('custom', array(array(&$this, 'update_bing_bot'))),
array('custom', array(array(&$this, 'update_bots'))),
);
}
public function update_bing_bot()
{
$bot_name = 'Bing [Bot]';
$bot_name_clean = utf8_clean_string($bot_name);
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . "
WHERE username_clean = '" . $this->db->sql_escape($bot_name_clean) . "'";
$result = $this->db->sql_query($sql);
$bing_already_added = (bool) $this->db->sql_fetchfield('user_id');
$this->db->sql_freeresult($result);
if (!$bing_already_added)
{
$bot_agent = 'bingbot/';
$bot_ip = '';
$sql = 'SELECT group_id, group_colour
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'BOTS'";
$result = $this->db->sql_query($sql);
$group_row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (!$group_row)
{
// default fallback, should never get here
$group_row['group_id'] = 6;
$group_row['group_colour'] = '9E8DA7';
}
if (!function_exists('user_add'))
{
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
}
$user_row = array(
'user_type' => USER_IGNORE,
'group_id' => $group_row['group_id'],
'username' => $bot_name,
'user_regdate' => time(),
'user_password' => '',
'user_colour' => $group_row['group_colour'],
'user_email' => '',
'user_lang' => $this->config['default_lang'],
'user_style' => $this->config['default_style'],
'user_timezone' => 0,
'user_dateformat' => $this->config['default_dateformat'],
'user_allow_massemail' => 0,
);
$user_id = user_add($user_row);
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
'bot_active' => 1,
'bot_name' => (string) $bot_name,
'user_id' => (int) $user_id,
'bot_agent' => (string) $bot_agent,
'bot_ip' => (string) $bot_ip,
));
$this->sql_query($sql);
}
}
public function update_bots()
{
// Update bots
if (!function_exists('user_delete'))
{
include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
}
$bots_updates = array(
// Bot Deletions
'NG-Search [Bot]' => false,
'Nutch/CVS [Bot]' => false,
'OmniExplorer [Bot]' => false,
'Seekport [Bot]' => false,
'Synoo [Bot]' => false,
'WiseNut [Bot]' => false,
// Bot Updates
// Bot name to bot user agent map
'Baidu [Spider]' => 'Baiduspider',
'Exabot [Bot]' => 'Exabot',
'Voyager [Bot]' => 'voyager/',
'W3C [Validator]' => 'W3C_Validator',
);
foreach ($bots_updates as $bot_name => $bot_agent)
{
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_IGNORE . "
AND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'";
$result = $this->db->sql_query($sql);
$bot_user_id = (int) $this->db->sql_fetchfield('user_id');
$this->db->sql_freeresult($result);
if ($bot_user_id)
{
if ($bot_agent === false)
{
$sql = 'DELETE FROM ' . BOTS_TABLE . "
WHERE user_id = $bot_user_id";
$this->sql_query($sql);
user_delete('retain', $bot_user_id);
}
else
{
$sql = 'UPDATE ' . BOTS_TABLE . "
SET bot_agent = '" . $this->db->sql_escape($bot_agent) . "'
WHERE user_id = $bot_user_id";
$this->sql_query($sql);
}
}
}
}
}

View 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\v310;
class captcha_plugins extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\rc2',
);
}
public function update_data()
{
$captcha_plugin = $this->config['captcha_plugin'];
if (strpos($captcha_plugin, 'phpbb_captcha_') === 0)
{
$captcha_plugin = substr($captcha_plugin, strlen('phpbb_captcha_'));
}
else if (strpos($captcha_plugin, 'phpbb_') === 0)
{
$captcha_plugin = substr($captcha_plugin, strlen('phpbb_'));
}
return array(
array('if', array(
(is_file($this->phpbb_root_path . 'phpbb/captcha/plugins/' . $captcha_plugin . '.' . $this->php_ext)),
array('config.update', array('captcha_plugin', 'core.captcha.plugins.' . $captcha_plugin)),
)),
array('if', array(
(!is_file($this->phpbb_root_path . 'phpbb/captcha/plugins/' . $captcha_plugin . '.' . $this->php_ext)),
array('config.update', array('captcha_plugin', 'core.captcha.plugins.nogd')),
)),
);
}
}

View File

@ -0,0 +1,51 @@
<?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\v310;
class config_db_text extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_table_exists($this->table_prefix . 'config_text');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'config_text' => array(
'COLUMNS' => array(
'config_name' => array('VCHAR', ''),
'config_value' => array('MTEXT', ''),
),
'PRIMARY_KEY' => 'config_name',
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'config_text',
),
);
}
}

View File

@ -0,0 +1,33 @@
<?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\v310;
class contact_admin_acp_module extends \phpbb\db\migration\migration
{
public function update_data()
{
return array(
array('module.add', array(
'acp',
'ACP_BOARD_CONFIGURATION',
array(
'module_basename' => 'acp_contact',
'module_langname' => 'ACP_CONTACT_SETTINGS',
'module_mode' => 'contact',
'module_auth' => 'acl_a_board',
),
)),
);
}
}

View File

@ -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\v310;
class contact_admin_form extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['contact_admin_form_enable']);
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\config_db_text');
}
public function update_data()
{
return array(
array('config.add', array('contact_admin_form_enable', 1)),
array('custom', array(array($this, 'contact_admin_info'))),
);
}
public function contact_admin_info()
{
$text_config = new \phpbb\config\db_text($this->db, $this->table_prefix . 'config_text');
$text_config->set_array(array(
'contact_admin_info' => '',
'contact_admin_info_uid' => '',
'contact_admin_info_bitfield' => '',
'contact_admin_info_flags' => OPTION_FLAG_BBCODE + OPTION_FLAG_SMILIES + OPTION_FLAG_LINKS,
));
}
}

View File

@ -0,0 +1,427 @@
<?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\v310;
class dev extends \phpbb\db\migration\container_aware_migration
{
public function effectively_installed()
{
return version_compare($this->config['version'], '3.1.0-dev', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\extensions',
'\phpbb\db\migration\data\v310\style_update_p2',
'\phpbb\db\migration\data\v310\timezone_p2',
'\phpbb\db\migration\data\v310\reported_posts_display',
'\phpbb\db\migration\data\v310\migrations_table',
);
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'groups' => array(
'group_teampage' => array('UINT', 0, 'after' => 'group_legend'),
),
$this->table_prefix . 'profile_fields' => array(
'field_show_on_pm' => array('BOOL', 0),
),
$this->table_prefix . 'styles' => array(
'style_path' => array('VCHAR:100', ''),
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
'style_parent_id' => array('UINT:4', 0),
'style_parent_tree' => array('TEXT', ''),
),
$this->table_prefix . 'reports' => array(
'reported_post_text' => array('MTEXT_UNI', ''),
'reported_post_uid' => array('VCHAR:8', ''),
'reported_post_bitfield' => array('VCHAR:255', ''),
),
),
'change_columns' => array(
$this->table_prefix . 'groups' => array(
'group_legend' => array('UINT', 0),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'groups' => array(
'group_teampage',
),
$this->table_prefix . 'profile_fields' => array(
'field_show_on_pm',
),
$this->table_prefix . 'styles' => array(
'style_path',
'bbcode_bitfield',
'style_parent_id',
'style_parent_tree',
),
$this->table_prefix . 'reports' => array(
'reported_post_text',
'reported_post_uid',
'reported_post_bitfield',
),
),
);
}
public function update_data()
{
return array(
array('if', array(
(strpos('phpbb_search_', $this->config['search_type']) !== 0),
array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])),
)),
array('config.add', array('fulltext_postgres_ts_name', 'simple')),
array('config.add', array('fulltext_postgres_min_word_len', 4)),
array('config.add', array('fulltext_postgres_max_word_len', 254)),
array('config.add', array('fulltext_sphinx_stopwords', 0)),
array('config.add', array('fulltext_sphinx_indexer_mem_limit', 512)),
array('config.add', array('load_jquery_cdn', 0)),
array('config.add', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js')),
array('config.add', array('use_system_cron', 0)),
array('config.add', array('legend_sort_groupname', 0)),
array('config.add', array('teampage_forums', 1)),
array('config.add', array('teampage_memberships', 1)),
array('config.add', array('load_cpf_pm', 0)),
array('config.add', array('display_last_subject', 1)),
array('config.add', array('assets_version', 1)),
array('config.add', array('site_home_url', '')),
array('config.add', array('site_home_text', '')),
array('permission.add', array('u_chgprofileinfo', true, 'u_sig')),
array('module.add', array(
'acp',
'ACP_GROUPS',
array(
'module_basename' => 'acp_groups',
'module_langname' => 'ACP_GROUPS_POSITION',
'module_mode' => 'position',
'module_auth' => 'acl_a_group',
),
)),
array('module.add', array(
'acp',
'ACP_ATTACHMENTS',
array(
'module_basename' => 'acp_attachments',
'module_langname' => 'ACP_MANAGE_ATTACHMENTS',
'module_mode' => 'manage',
'module_auth' => 'acl_a_attach',
),
)),
array('module.add', array(
'acp',
'ACP_STYLE_MANAGEMENT',
array(
'module_basename' => 'acp_styles',
'module_langname' => 'ACP_STYLES_INSTALL',
'module_mode' => 'install',
'module_auth' => 'acl_a_styles',
),
)),
array('module.add', array(
'acp',
'ACP_STYLE_MANAGEMENT',
array(
'module_basename' => 'acp_styles',
'module_langname' => 'ACP_STYLES_CACHE',
'module_mode' => 'cache',
'module_auth' => 'acl_a_styles',
),
)),
array('module.add', array(
'ucp',
'UCP_PROFILE',
array(
'module_basename' => 'ucp_profile',
'module_langname' => 'UCP_PROFILE_AUTOLOGIN_KEYS',
'module_mode' => 'autologin_keys',
),
)),
// Module will be renamed later
array('module.add', array(
'acp',
'ACP_CAT_STYLES',
'ACP_LANGUAGE'
)),
array('module.remove', array(
'acp',
false,
'ACP_TEMPLATES',
)),
array('module.remove', array(
'acp',
false,
'ACP_THEMES',
)),
array('module.remove', array(
'acp',
false,
'ACP_IMAGESETS',
)),
array('custom', array(array($this, 'rename_module_basenames'))),
array('custom', array(array($this, 'rename_styles_module'))),
array('custom', array(array($this, 'add_group_teampage'))),
array('custom', array(array($this, 'update_group_legend'))),
array('custom', array(array($this, 'localise_global_announcements'))),
array('custom', array(array($this, 'update_ucp_pm_basename'))),
array('custom', array(array($this, 'update_ucp_profile_auth'))),
array('custom', array(array($this, 'move_customise_modules'))),
array('config.update', array('version', '3.1.0-dev')),
);
}
public function move_customise_modules()
{
// Move language management to new location in the Customise tab
// First get language module id
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
WHERE module_basename = 'acp_language'";
$result = $this->db->sql_query($sql);
$language_module_id = $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result);
// Next get language management module id of the one just created
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
WHERE module_langname = 'ACP_LANGUAGE'";
$result = $this->db->sql_query($sql);
$language_management_module_id = $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result);
// acp_modules calls adm_back_link, which is undefined at this point
if (!function_exists('adm_back_link'))
{
include($this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext);
}
$module_manager = $this->container->get('module.manager');
$module_manager->move_module($language_module_id, $language_management_module_id, 'acp');
}
public function update_ucp_pm_basename()
{
$sql = 'SELECT module_id, module_basename
FROM ' . MODULES_TABLE . "
WHERE module_basename <> 'ucp_pm' AND
module_langname='UCP_PM'";
$result = $this->db->sql_query_limit($sql, 1);
if ($row = $this->db->sql_fetchrow($result))
{
// This update is still not applied. Applying it
$sql = 'UPDATE ' . MODULES_TABLE . "
SET module_basename = 'ucp_pm'
WHERE module_id = " . (int) $row['module_id'];
$this->sql_query($sql);
}
$this->db->sql_freeresult($result);
}
public function update_ucp_profile_auth()
{
// Update the auth setting for the module
$sql = 'UPDATE ' . MODULES_TABLE . "
SET module_auth = 'acl_u_chgprofileinfo'
WHERE module_class = 'ucp'
AND module_basename = 'ucp_profile'
AND module_mode = 'profile_info'";
$this->sql_query($sql);
}
public function rename_styles_module()
{
// Rename styles module to Customise
$sql = 'UPDATE ' . MODULES_TABLE . "
SET module_langname = 'ACP_CAT_CUSTOMISE'
WHERE module_langname = 'ACP_CAT_STYLES'";
$this->sql_query($sql);
}
public function rename_module_basenames()
{
// rename all module basenames to full classname
$sql = 'SELECT module_id, module_basename, module_class
FROM ' . MODULES_TABLE;
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
$module_id = (int) $row['module_id'];
unset($row['module_id']);
if (!empty($row['module_basename']) && !empty($row['module_class']))
{
// all the class names start with class name or with phpbb_ for auto loading
if (strpos($row['module_basename'], $row['module_class'] . '_') !== 0 &&
strpos($row['module_basename'], 'phpbb_') !== 0)
{
$row['module_basename'] = $row['module_class'] . '_' . $row['module_basename'];
$sql_update = $this->db->sql_build_array('UPDATE', $row);
$sql = 'UPDATE ' . MODULES_TABLE . '
SET ' . $sql_update . '
WHERE module_id = ' . $module_id;
$this->sql_query($sql);
}
}
}
$this->db->sql_freeresult($result);
}
public function add_group_teampage()
{
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_teampage = 1
WHERE group_type = ' . GROUP_SPECIAL . "
AND group_name = 'ADMINISTRATORS'";
$this->sql_query($sql);
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_teampage = 2
WHERE group_type = ' . GROUP_SPECIAL . "
AND group_name = 'GLOBAL_MODERATORS'";
$this->sql_query($sql);
}
public function update_group_legend()
{
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . '
WHERE group_legend = 1
ORDER BY group_name ASC';
$result = $this->db->sql_query($sql);
$next_legend = 1;
while ($row = $this->db->sql_fetchrow($result))
{
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_legend = ' . $next_legend . '
WHERE group_id = ' . (int) $row['group_id'];
$this->sql_query($sql);
$next_legend++;
}
$this->db->sql_freeresult($result);
}
public function localise_global_announcements()
{
// Localise Global Announcements
$sql = 'SELECT topic_id, topic_approved, (topic_replies + 1) AS topic_posts, topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour
FROM ' . TOPICS_TABLE . '
WHERE forum_id = 0
AND topic_type = ' . POST_GLOBAL;
$result = $this->db->sql_query($sql);
$global_announcements = $update_lastpost_data = array();
$update_lastpost_data['forum_last_post_time'] = 0;
$update_forum_data = array(
'forum_posts' => 0,
'forum_topics' => 0,
'forum_topics_real' => 0,
);
while ($row = $this->db->sql_fetchrow($result))
{
$global_announcements[] = (int) $row['topic_id'];
$update_forum_data['forum_posts'] += (int) $row['topic_posts'];
$update_forum_data['forum_topics_real']++;
if ($row['topic_approved'])
{
$update_forum_data['forum_topics']++;
}
if ($update_lastpost_data['forum_last_post_time'] < $row['topic_last_post_time'])
{
$update_lastpost_data = array(
'forum_last_post_id' => (int) $row['topic_last_post_id'],
'forum_last_post_subject' => $row['topic_last_post_subject'],
'forum_last_post_time' => (int) $row['topic_last_post_time'],
'forum_last_poster_id' => (int) $row['topic_last_poster_id'],
'forum_last_poster_name' => $row['topic_last_poster_name'],
'forum_last_poster_colour' => $row['topic_last_poster_colour'],
);
}
}
$this->db->sql_freeresult($result);
if (!empty($global_announcements))
{
// Update the post/topic-count for the forum and the last-post if needed
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST;
$result = $this->db->sql_query_limit($sql, 1);
$ga_forum_id = $this->db->sql_fetchfield('forum_id');
$this->db->sql_freeresult($result);
$sql = 'SELECT forum_last_post_time
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $ga_forum_id;
$result = $this->db->sql_query($sql);
$lastpost = (int) $this->db->sql_fetchfield('forum_last_post_time');
$this->db->sql_freeresult($result);
$sql_update = 'forum_posts = forum_posts + ' . $update_forum_data['forum_posts'] . ', ';
$sql_update .= 'forum_topics_real = forum_topics_real + ' . $update_forum_data['forum_topics_real'] . ', ';
$sql_update .= 'forum_topics = forum_topics + ' . $update_forum_data['forum_topics'];
if ($lastpost < $update_lastpost_data['forum_last_post_time'])
{
$sql_update .= ', ' . $this->db->sql_build_array('UPDATE', $update_lastpost_data);
}
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET ' . $sql_update . '
WHERE forum_id = ' . $ga_forum_id;
$this->sql_query($sql);
// Update some forum_ids
$table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);
foreach ($table_ary as $table)
{
$sql = "UPDATE $table
SET forum_id = $ga_forum_id
WHERE " . $this->db->sql_in_set('topic_id', $global_announcements);
$this->sql_query($sql);
}
unset($table_ary);
}
}
}

View File

@ -0,0 +1,77 @@
<?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\v310;
class extensions extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_table_exists($this->table_prefix . 'ext');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'ext' => array(
'COLUMNS' => array(
'ext_name' => array('VCHAR', ''),
'ext_active' => array('BOOL', 0),
'ext_state' => array('TEXT', ''),
),
'KEYS' => array(
'ext_name' => array('UNIQUE', 'ext_name'),
),
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'ext',
),
);
}
public function update_data()
{
return array(
// Module will be renamed later
array('module.add', array(
'acp',
'ACP_CAT_STYLES',
'ACP_EXTENSION_MANAGEMENT'
)),
array('module.add', array(
'acp',
'ACP_EXTENSION_MANAGEMENT',
array(
'module_basename' => 'acp_extensions',
'module_langname' => 'ACP_EXTENSIONS',
'module_mode' => 'main',
'module_auth' => 'acl_a_extensions',
),
)),
array('permission.add', array('a_extensions', true, 'a_styles')),
);
}
}

View 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\v310;
class extensions_version_check_force_unstable extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_data()
{
return array(
array('config.add', array('extension_force_unstable', false)),
);
}
}

View File

@ -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\v310;
class forgot_password extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['allow_password_reset']);
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_data()
{
return array(
array('config.add', array('allow_password_reset', 1)),
);
}
}

View 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\v310;
class gold extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\rc6',
'\phpbb\db\migration\data\v310\bot_update',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0')),
);
}
}

View 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\v310;
class jquery_update extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->config['load_jquery_url'] !== '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js';
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\dev',
);
}
public function update_data()
{
return array(
array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js')),
);
}
}

View 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\v310;
class jquery_update2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->config['load_jquery_url'] !== '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js';
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\jquery_update',
);
}
public function update_data()
{
return array(
array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js')),
);
}
}

View 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\v310;
class live_searches_config extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['allow_live_searches']);
}
public function update_data()
{
return array(
array('config.add', array('allow_live_searches', '1')),
);
}
}

View File

@ -0,0 +1,51 @@
<?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\v310;
class migrations_table extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_table_exists($this->table_prefix . 'migrations');
}
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'migrations' => array(
'COLUMNS' => array(
'migration_name' => array('VCHAR', ''),
'migration_depends_on' => array('TEXT', ''),
'migration_schema_done' => array('BOOL', 0),
'migration_data_done' => array('BOOL', 0),
'migration_data_state' => array('TEXT', ''),
'migration_start_time' => array('TIMESTAMP', 0),
'migration_end_time' => array('TIMESTAMP', 0),
),
'PRIMARY_KEY' => 'migration_name',
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'migrations',
),
);
}
}

View File

@ -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\v310;
class mod_rewrite extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\dev',
);
}
public function update_data()
{
return array(
array('config.add', array('enable_mod_rewrite', '0')),
);
}
}

View File

@ -0,0 +1,80 @@
<?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\v310;
class mysql_fulltext_drop extends \phpbb\db\migration\migration
{
protected $indexes;
public function effectively_installed()
{
// This migration is irrelevant for all non-MySQL DBMSes.
if (strpos($this->db->get_sql_layer(), 'mysql') === false)
{
return true;
}
$this->find_indexes_to_drop();
return empty($this->indexes);
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\dev',
);
}
public function update_schema()
{
if (empty($this->indexes))
{
return array();
}
/*
* Drop FULLTEXT indexes related to MySQL fulltext search.
* Doing so is equivalent to dropping the search index from the ACP.
* Possibly time-consuming recreation of the search index (i.e.
* FULLTEXT indexes) is left as a task to the admin to not
* unnecessarily stall the upgrade process. The new search index will
* then require about 40% less table space (also see PHPBB3-11621).
*/
return array(
'drop_keys' => array(
$this->table_prefix . 'posts' => $this->indexes,
),
);
}
public function find_indexes_to_drop()
{
if ($this->indexes !== null)
{
return $this->indexes;
}
$this->indexes = array();
$potential_keys = array('post_subject', 'post_text', 'post_content');
foreach ($potential_keys as $key)
{
if ($this->db_tools->sql_index_exists($this->table_prefix . 'posts', $key))
{
$this->indexes[] = $key;
}
}
return $this->indexes;
}
}

View File

@ -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\v310;
class namespaces extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\dev',
);
}
public function update_data()
{
return array(
array('if', array(
(preg_match('#^phpbb_search_#', $this->config['search_type'])),
array('config.update', array('search_type', str_replace('phpbb_search_', '\\phpbb\\search\\', $this->config['search_type']))),
)),
);
}
}

View File

@ -0,0 +1,142 @@
<?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\v310;
class notification_options_reconvert extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\notifications_schema_fix');
}
public function update_data()
{
return array(
array('custom', array(array($this, 'purge_notifications'))),
array('custom', array(array($this, 'convert_notifications'))),
);
}
public function purge_notifications()
{
$sql = 'DELETE FROM ' . $this->table_prefix . 'user_notifications';
$this->sql_query($sql);
}
public function convert_notifications($start)
{
$insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->table_prefix . 'user_notifications');
return $this->perform_conversion($insert_buffer, $start);
}
/**
* Perform the conversion (separate for testability)
*
* @param \phpbb\db\sql_insert_buffer $insert_buffer
* @param int $start Start of staggering step
* @return mixed int start of the next step, null if the end was reached
*/
public function perform_conversion(\phpbb\db\sql_insert_buffer $insert_buffer, $start)
{
$limit = 250;
$converted_users = 0;
$start = $start ?: 0;
$sql = 'SELECT user_id, user_notify_type, user_notify_pm
FROM ' . $this->table_prefix . 'users
ORDER BY user_id';
$result = $this->db->sql_query_limit($sql, $limit, $start);
while ($row = $this->db->sql_fetchrow($result))
{
$converted_users++;
$notification_methods = array();
// In-board notification
$notification_methods[] = '';
if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH)
{
$notification_methods[] = 'email';
}
if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH)
{
$notification_methods[] = 'jabber';
}
// Notifications for posts
foreach (array('post', 'topic') as $item_type)
{
$this->add_method_rows(
$insert_buffer,
$item_type,
0,
$row['user_id'],
$notification_methods
);
}
if ($row['user_notify_pm'])
{
// Notifications for private messages
// User either gets all methods or no method
$this->add_method_rows(
$insert_buffer,
'pm',
0,
$row['user_id'],
$notification_methods
);
}
}
$this->db->sql_freeresult($result);
$insert_buffer->flush();
if ($converted_users < $limit)
{
// No more users left, we are done...
return;
}
return $start + $limit;
}
/**
* Insert method rows to DB
*
* @param \phpbb\db\sql_insert_buffer $insert_buffer
* @param string $item_type
* @param int $item_id
* @param int $user_id
* @param string $methods
*/
protected function add_method_rows(\phpbb\db\sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods)
{
$row_base = array(
'item_type' => $item_type,
'item_id' => (int) $item_id,
'user_id' => (int) $user_id,
'notify' => 1
);
foreach ($methods as $method)
{
$row_base['method'] = $method;
$insert_buffer->insert($row_base);
}
}
}

View File

@ -0,0 +1,105 @@
<?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\v310;
class notifications extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_table_exists($this->table_prefix . 'notifications');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'notification_types' => array(
'COLUMNS' => array(
'notification_type' => array('VCHAR:255', ''),
'notification_type_enabled' => array('BOOL', 1),
),
'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'),
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'notification_read' => array('BOOL', 0),
'notification_time' => array('TIMESTAMP', 1),
'notification_data' => array('TEXT_UNI', ''),
),
'PRIMARY_KEY' => 'notification_id',
'KEYS' => array(
'item_ident' => array('INDEX', array('item_type', 'item_id')),
'user' => array('INDEX', array('user_id', 'notification_read')),
),
),
$this->table_prefix . 'user_notifications' => array(
'COLUMNS' => array(
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'method' => array('VCHAR:255', ''),
'notify' => array('BOOL', 1),
),
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'notification_types',
$this->table_prefix . 'notifications',
$this->table_prefix . 'user_notifications',
),
);
}
public function update_data()
{
return array(
array('module.add', array(
'ucp',
'UCP_MAIN',
array(
'module_basename' => 'ucp_notifications',
'module_langname' => 'UCP_NOTIFICATION_LIST',
'module_mode' => 'notification_list',
'module_auth' => 'cfg_allow_board_notifications',
),
)),
array('module.add', array(
'ucp',
'UCP_PREFS',
array(
'module_basename' => 'ucp_notifications',
'module_langname' => 'UCP_NOTIFICATION_OPTIONS',
'module_mode' => 'notification_options',
),
)),
array('config.add', array('load_notifications', 1)),
);
}
}

View File

@ -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\v310;
class notifications_cron extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\notifications');
}
public function update_data()
{
return array(
array('config.add', array('read_notification_expire_days', 30)),
array('config.add', array('read_notification_last_gc', 0)), // last run
array('config.add', array('read_notification_gc', (60 * 60 * 24))), // seconds between run; 1 day
);
}
}

View File

@ -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\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

@ -0,0 +1,98 @@
<?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\v310;
class notifications_schema_fix extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\notifications');
}
public function update_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'notification_types',
$this->table_prefix . 'notifications',
),
'add_tables' => array(
$this->table_prefix . 'notification_types' => array(
'COLUMNS' => array(
'notification_type_id' => array('USINT', null, 'auto_increment'),
'notification_type_name' => array('VCHAR:255', ''),
'notification_type_enabled' => array('BOOL', 1),
),
'PRIMARY_KEY' => array('notification_type_id'),
'KEYS' => array(
'type' => array('UNIQUE', array('notification_type_name')),
),
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'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),
'user_id' => array('UINT', 0),
'notification_read' => array('BOOL', 0),
'notification_time' => array('TIMESTAMP', 1),
'notification_data' => array('TEXT_UNI', ''),
),
'PRIMARY_KEY' => 'notification_id',
'KEYS' => array(
'item_ident' => array('INDEX', array('notification_type_id', 'item_id')),
'user' => array('INDEX', array('user_id', 'notification_read')),
),
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'notification_types',
$this->table_prefix . 'notifications',
),
'add_tables' => array(
$this->table_prefix . 'notification_types' => array(
'COLUMNS' => array(
'notification_type' => array('VCHAR:255', ''),
'notification_type_enabled' => array('BOOL', 1),
),
'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'),
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'notification_read' => array('BOOL', 0),
'notification_time' => array('TIMESTAMP', 1),
'notification_data' => array('TEXT_UNI', ''),
),
'PRIMARY_KEY' => 'notification_id',
'KEYS' => array(
'item_ident' => array('INDEX', array('item_type', 'item_id')),
'user' => array('INDEX', array('user_id', 'notification_read')),
),
),
),
);
}
}

View File

@ -0,0 +1,184 @@
<?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\v310;
class notifications_use_full_name extends \phpbb\db\migration\migration
{
protected $notification_types = array(
'admin_activate_user',
'approve_post',
'approve_topic',
'bookmark',
'disapprove_post',
'disapprove_topic',
'group_request',
'group_request_approved',
'pm',
'post',
'post_in_queue',
'quote',
'report_pm',
'report_pm_closed',
'report_post',
'report_post_closed',
'topic',
'topic_in_queue');
protected $notification_methods = array(
'email',
'jabber',
);
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\rc3');
}
public function update_data()
{
return array(
array('custom', array(array($this, 'update_notifications_name'))),
array('custom', array(array($this, 'update_notifications_method_name'))),
);
}
public function revert_data()
{
return array(
array('custom', array(array($this, 'revert_notifications_name'))),
array('custom', array(array($this, 'revert_notifications_method_name'))),
);
}
public function update_notifications_method_name()
{
foreach ($this->notification_methods as $notification_method)
{
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
SET method = 'notification.method.{$notification_method}'
WHERE method = '{$notification_method}'";
$this->db->sql_query($sql);
}
}
public function revert_notifications_method_name()
{
foreach ($this->notification_methods as $notification_method)
{
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
SET method = '{$notification_method}'
WHERE method = 'notification.method.{$notification_method}'";
$this->db->sql_query($sql);
}
}
public function update_notifications_name()
{
$sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . '
SET notification_type_enabled = 0
WHERE ' . $this->db->sql_in_set('notification_type_name', $this->notification_types, true);
$this->db->sql_query($sql);
foreach ($this->notification_types as $notification_type)
{
$sql = 'SELECT notification_type_id
FROM ' . NOTIFICATION_TYPES_TABLE . "
WHERE notification_type_name = 'notification.type.{$notification_type}'";
$result = $this->db->sql_query($sql);
$new_type_id = (int) $this->db->sql_fetchfield('notification_type_id');
$this->db->sql_freeresult($result);
if ($new_type_id)
{
// New type name already exists,
// so we delete the old type and update the type id of existing entries.
$sql = 'SELECT notification_type_id
FROM ' . NOTIFICATION_TYPES_TABLE . "
WHERE notification_type_name = '{$notification_type}'";
$result = $this->db->sql_query($sql);
$old_type_id = (int) $this->db->sql_fetchfield('notification_type_id');
$this->db->sql_freeresult($result);
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . '
SET notification_type_id = ' . (int) $new_type_id . '
WHERE notification_type_id = ' . (int) $old_type_id;
$this->db->sql_query($sql);
$sql = 'DELETE FROM ' . NOTIFICATION_TYPES_TABLE . "
WHERE notification_type_name = '{$notification_type}'";
$this->db->sql_query($sql);
}
else
{
// Otherwise we just update the name
$sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
SET notification_type_name = 'notification.type.{$notification_type}'
WHERE notification_type_name = '{$notification_type}'";
$this->db->sql_query($sql);
}
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
SET item_type = 'notification.type.{$notification_type}'
WHERE item_type = '{$notification_type}'";
$this->db->sql_query($sql);
}
}
public function revert_notifications_name()
{
foreach ($this->notification_types as $notification_type)
{
$sql = 'SELECT notification_type_id
FROM ' . NOTIFICATION_TYPES_TABLE . "
WHERE notification_type_name = '{$notification_type}'";
$result = $this->db->sql_query($sql);
$new_type_id = (int) $this->db->sql_fetchfield('notification_type_id');
$this->db->sql_freeresult($result);
if ($new_type_id)
{
// New type name already exists,
// so we delete the old type and update the type id of existing entries.
$sql = 'SELECT notification_type_id
FROM ' . NOTIFICATION_TYPES_TABLE . "
WHERE notification_type_name = 'notification.type.{$notification_type}'";
$result = $this->db->sql_query($sql);
$old_type_id = (int) $this->db->sql_fetchfield('notification_type_id');
$this->db->sql_freeresult($result);
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . '
SET notification_type_id = ' . (int) $new_type_id . '
WHERE notification_type_id = ' . (int) $old_type_id;
$this->db->sql_query($sql);
$sql = 'DELETE FROM ' . NOTIFICATION_TYPES_TABLE . "
WHERE notification_type_name = 'notification.type.{$notification_type}'";
$this->db->sql_query($sql);
}
else
{
// Otherwise we just update the name
$sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
SET notification_type_name = '{$notification_type}'
WHERE notification_type_name = 'notification.type.{$notification_type}'";
$this->db->sql_query($sql);
}
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
SET item_type = '{$notification_type}'
WHERE item_type = 'notification.type.{$notification_type}'";
$this->db->sql_query($sql);
}
}
}

View File

@ -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\v310;
class passwords extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_password' => array('VCHAR:255', ''),
),
$this->table_prefix . 'forums' => array(
'forum_password' => array('VCHAR:255', ''),
),
),
);
}
public function revert_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_password' => array('VCHAR:40', ''),
),
$this->table_prefix . 'forums' => array(
'forum_password' => array('VCHAR:40', ''),
),
),
);
}
}

View File

@ -0,0 +1,81 @@
<?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\v310;
class passwords_convert_p1 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\passwords_p2');
}
public function update_data()
{
return array(
array('custom', array(array($this, 'update_passwords'))),
);
}
public function update_passwords($start)
{
// Nothing to do if user_pass_convert column doesn't exist
if (!$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_pass_convert'))
{
return;
}
$start = (int) $start;
$limit = 1000;
$converted_users = 0;
$sql = 'SELECT user_password, user_id
FROM ' . $this->table_prefix . 'users
WHERE user_pass_convert = 1
ORDER BY user_id';
$result = $this->db->sql_query_limit($sql, $limit, $start);
$update_users = array();
while ($row = $this->db->sql_fetchrow($result))
{
$converted_users++;
$user_id = (int) $row['user_id'];
// Only prefix passwords without proper prefix
if (!isset($update_users[$user_id]) && !preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $row['user_password']))
{
// Use $CP$ prefix for passwords that need to
// be converted and set pass convert to false.
$update_users[$user_id] = '$CP$' . $row['user_password'];
}
}
$this->db->sql_freeresult($result);
foreach ($update_users as $user_id => $user_password)
{
$sql = 'UPDATE ' . $this->table_prefix . "users
SET user_password = '" . $this->db->sql_escape($user_password) . "'
WHERE user_id = $user_id";
$this->sql_query($sql);
}
if ($converted_users < $limit)
{
// There are no more users to be converted
return;
}
// There are still more users to query, return the next start value
return $start + $limit;
}
}

View 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\v310;
class passwords_convert_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_pass_convert');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\passwords_convert_p1');
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'user_pass_convert',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'user_pass_convert' => array('BOOL', 0, 'after' => 'user_passchg'),
),
),
);
}
}

View 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\v310;
class passwords_p2 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\passwords');
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_newpasswd' => array('VCHAR:255', ''),
),
),
);
}
public function revert_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_newpasswd' => array('VCHAR:40', ''),
),
),
);
}
}

View 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\v310;
class plupload extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['plupload_last_gc']) &&
isset($this->config['plupload_salt']);
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_data()
{
return array(
array('config.add', array('plupload_last_gc', 0)),
array('config.add', array('plupload_salt', unique_id())),
);
}
}

View File

@ -0,0 +1,80 @@
<?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\v310;
class postgres_fulltext_drop extends \phpbb\db\migration\migration
{
protected $indexes;
public function effectively_installed()
{
// This migration is irrelevant for all non-PostgreSQL DBMSes.
if (strpos($this->db->get_sql_layer(), 'postgres') === false)
{
return true;
}
$this->find_indexes_to_drop();
return empty($this->indexes);
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\dev',
);
}
public function update_schema()
{
if (empty($this->indexes))
{
return array();
}
/*
* Drop FULLTEXT indexes related to PostgreSQL fulltext search.
* Doing so is equivalent to dropping the search index from the ACP.
* Possibly time-consuming recreation of the search index (i.e.
* FULLTEXT indexes) is left as a task to the admin to not
* unnecessarily stall the upgrade process. The new search index will
* then require about 40% less table space (also see PHPBB3-11040).
*/
return array(
'drop_keys' => array(
$this->table_prefix . 'posts' => $this->indexes,
),
);
}
public function find_indexes_to_drop()
{
if ($this->indexes !== null)
{
return $this->indexes;
}
$this->indexes = array();
$potential_keys = array('post_subject', 'post_text', 'post_content');
foreach ($potential_keys as $key)
{
if ($this->db_tools->sql_index_exists($this->table_prefix . 'posts', $key))
{
$this->indexes[] = $key;
}
}
return $this->indexes;
}
}

View File

@ -0,0 +1,55 @@
<?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\v310;
class profilefield_aol extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_yahoo_cleanup',
);
}
protected $profilefield_name = 'phpbb_aol';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_aol',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_aol',
'field_length' => '40',
'field_minlen' => '5',
'field_maxlen' => '255',
'field_novalue' => '',
'field_default_value' => '',
'field_validation' => '.*',
'field_required' => 0,
'field_show_novalue' => 0,
'field_show_on_reg' => 0,
'field_show_on_pm' => 1,
'field_show_on_vt' => 1,
'field_show_on_ml' => 0,
'field_show_profile' => 1,
'field_hide' => 0,
'field_no_view' => 0,
'field_active' => 1,
'field_is_contact' => 1,
'field_contact_desc' => '',
'field_contact_url' => '',
);
protected $user_column_name = 'user_aim';
}

View File

@ -0,0 +1,51 @@
<?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\v310;
class profilefield_aol_cleanup extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_aim');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_aol',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'user_aim',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'user_aim' => array('VCHAR_UNI', ''),
),
),
);
}
}

View File

@ -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\v310;
class profilefield_change_load_settings extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_aol_cleanup',
);
}
public function update_data()
{
return array(
array('config.update', array('load_cpf_memberlist', '1')),
array('config.update', array('load_cpf_pm', '1')),
array('config.update', array('load_cpf_viewprofile', '1')),
array('config.update', array('load_cpf_viewtopic', '1')),
);
}
}

View File

@ -0,0 +1,55 @@
<?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\v310;
class profilefield_cleanup extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_occ') &&
!$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_interests');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_interests',
'\phpbb\db\migration\data\v310\profilefield_occupation',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'user_occ',
'user_interests',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'user_occ' => array('MTEXT', ''),
'user_interests' => array('MTEXT', ''),
),
),
);
}
}

View File

@ -0,0 +1,55 @@
<?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\v310;
class profilefield_contact_field extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_is_contact');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_on_memberlist',
);
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_is_contact' => array('BOOL', 0),
'field_contact_desc' => array('VCHAR', ''),
'field_contact_url' => array('VCHAR', ''),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_is_contact',
'field_contact_desc',
'field_contact_url',
),
),
);
}
}

View File

@ -0,0 +1,61 @@
<?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\v310;
class profilefield_facebook extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_contact_field',
'\phpbb\db\migration\data\v310\profilefield_show_novalue',
'\phpbb\db\migration\data\v310\profilefield_types',
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'create_custom_field'))),
);
}
protected $profilefield_name = 'phpbb_facebook';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_facebook',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_facebook',
'field_length' => '20',
'field_minlen' => '5',
'field_maxlen' => '50',
'field_novalue' => '',
'field_default_value' => '',
'field_validation' => '[\w.]+',
'field_required' => 0,
'field_show_novalue' => 0,
'field_show_on_reg' => 0,
'field_show_on_pm' => 1,
'field_show_on_vt' => 1,
'field_show_profile' => 1,
'field_hide' => 0,
'field_no_view' => 0,
'field_active' => 1,
'field_is_contact' => 1,
'field_contact_desc' => 'VIEW_FACEBOOK_PROFILE',
'field_contact_url' => 'http://facebook.com/%s/',
);
}

Some files were not shown because too many files have changed in this diff Show More