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,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/',
);
}

View File

@ -0,0 +1,90 @@
<?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_field_validation_length extends \phpbb\db\migration\migration
{
protected $validation_options_old = array(
'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+',
);
protected $validation_options_new = array(
'ALPHA_SPACERS' => '[\w\x20_+\-\[\]]+',
);
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\rc3',
);
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_validation' => array('VCHAR_UNI:64', ''),
),
),
);
}
public function revert_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_validation' => array('VCHAR_UNI:20', ''),
),
),
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'update_profile_fields_validation'))),
);
}
public function revert_data()
{
return array(
array('custom', array(array($this, 'revert_profile_fields_validation'))),
);
}
public function update_profile_fields_validation()
{
foreach ($this->validation_options_new as $validation_type => $regex)
{
$sql = 'UPDATE ' . $this->table_prefix . "profile_fields
SET field_validation = '" . $this->db->sql_escape($this->validation_options_new[$validation_type]) . "'
WHERE field_validation = '" . $this->db->sql_escape($this->validation_options_old[$validation_type]) . "'";
$this->sql_query($sql);
}
}
public function revert_profile_fields_validation()
{
foreach ($this->validation_options_new as $validation_type => $regex)
{
$sql = 'UPDATE ' . $this->table_prefix . "profile_fields
SET field_validation = '" . $this->db->sql_escape($this->validation_options_old[$validation_type]) . "'
WHERE field_validation = '" . $this->db->sql_escape($this->validation_options_new[$validation_type]) . "'";
$this->sql_query($sql);
}
}
}

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_googleplus 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_googleplus';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_googleplus',
'field_type' => 'profilefields.type.googleplus',
'field_ident' => 'phpbb_googleplus',
'field_length' => '20',
'field_minlen' => '3',
'field_maxlen' => '255',
'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_GOOGLEPLUS_PROFILE',
'field_contact_url' => 'http://plus.google.com/%s',
);
}

View File

@ -0,0 +1,54 @@
<?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_icq extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_contact_field',
);
}
protected $profilefield_name = 'phpbb_icq';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_icq',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_icq',
'field_length' => '20',
'field_minlen' => '3',
'field_maxlen' => '15',
'field_novalue' => '',
'field_default_value' => '',
'field_validation' => '[0-9]+',
'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' => 'SEND_ICQ_MESSAGE',
'field_contact_url' => 'https://www.icq.com/people/%s/',
);
protected $user_column_name = 'user_icq';
}

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_icq_cleanup extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_icq');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_icq',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'user_icq',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'user_icq' => array('VCHAR:20', ''),
),
),
);
}
}

View File

@ -0,0 +1,52 @@
<?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_interests extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_types',
'\phpbb\db\migration\data\v310\profilefield_show_novalue',
);
}
protected $profilefield_name = 'phpbb_interests';
protected $profilefield_database_type = array('MTEXT', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_interests',
'field_type' => 'profilefields.type.text',
'field_ident' => 'phpbb_interests',
'field_length' => '3|30',
'field_minlen' => '2',
'field_maxlen' => '500',
'field_novalue' => '',
'field_default_value' => '',
'field_validation' => '.*',
'field_required' => 0,
'field_show_novalue' => 0,
'field_show_on_reg' => 0,
'field_show_on_pm' => 0,
'field_show_on_vt' => 0,
'field_show_profile' => 1,
'field_hide' => 0,
'field_no_view' => 0,
'field_active' => 1,
);
protected $user_column_name = 'user_interests';
}

View File

@ -0,0 +1,52 @@
<?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_location extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_types',
'\phpbb\db\migration\data\v310\profilefield_on_memberlist',
);
}
protected $profilefield_name = 'phpbb_location';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_location',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_location',
'field_length' => '20',
'field_minlen' => '2',
'field_maxlen' => '100',
'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_profile' => 1,
'field_hide' => 0,
'field_no_view' => 0,
'field_active' => 1,
);
protected $user_column_name = 'user_from';
}

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_location_cleanup extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_from');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_location',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'user_from',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'user_from' => array('VCHAR_UNI:100', ''),
),
),
);
}
}

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_occupation extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_interests',
);
}
protected $profilefield_name = 'phpbb_occupation';
protected $profilefield_database_type = array('MTEXT', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_occupation',
'field_type' => 'profilefields.type.text',
'field_ident' => 'phpbb_occupation',
'field_length' => '3|30',
'field_minlen' => '2',
'field_maxlen' => '500',
'field_novalue' => '',
'field_default_value' => '',
'field_validation' => '.*',
'field_required' => 0,
'field_show_novalue' => 0,
'field_show_on_reg' => 0,
'field_show_on_pm' => 0,
'field_show_on_vt' => 0,
'field_show_profile' => 1,
'field_hide' => 0,
'field_no_view' => 0,
'field_active' => 1,
);
protected $user_column_name = 'user_occ';
}

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_on_memberlist extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_show_on_ml');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_cleanup',
);
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_show_on_ml' => array('BOOL', 0),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_show_on_ml',
),
),
);
}
}

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 profilefield_show_novalue extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_show_novalue');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\profilefield_types');
}
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',
),
),
);
}
}

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_skype 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_skype';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_skype',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_skype',
'field_length' => '20',
'field_minlen' => '6',
'field_maxlen' => '32',
'field_novalue' => '',
'field_default_value' => '',
'field_validation' => '[a-zA-Z][\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_SKYPE_PROFILE',
'field_contact_url' => 'skype:%s?userinfo',
);
}

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_twitter 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_twitter';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_twitter',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_twitter',
'field_length' => '20',
'field_minlen' => '1',
'field_maxlen' => '15',
'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_TWITTER_PROFILE',
'field_contact_url' => 'http://twitter.com/%s',
);
}

View File

@ -0,0 +1,110 @@
<?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_types extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\alpha2',
);
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'profile_fields' => array(
'field_type' => array('VCHAR:100', ''),
),
$this->table_prefix . 'profile_fields_lang' => array(
'field_type' => array('VCHAR:100', ''),
),
),
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'update_profile_fields_type'))),
array('custom', array(array($this, 'update_profile_fields_lang_type'))),
);
}
public function update_profile_fields_type()
{
// Update profile field types
$sql = 'SELECT field_type
FROM ' . $this->table_prefix . 'profile_fields
GROUP BY field_type';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
$sql = 'UPDATE ' . $this->table_prefix . "profile_fields
SET field_type = '" . $this->db->sql_escape($this->convert_phpbb30_field_type($row['field_type'])) . "'
WHERE field_type = '" . $this->db->sql_escape($row['field_type']) . "'";
$this->sql_query($sql);
}
$this->db->sql_freeresult($result);
}
public function update_profile_fields_lang_type()
{
// Update profile field language types
$sql = 'SELECT field_type
FROM ' . $this->table_prefix . 'profile_fields_lang
GROUP BY field_type';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
$sql = 'UPDATE ' . $this->table_prefix . "profile_fields_lang
SET field_type = '" . $this->db->sql_escape($this->convert_phpbb30_field_type($row['field_type'])) . "'
WHERE field_type = '" . $this->db->sql_escape($row['field_type']) . "'";
$this->sql_query($sql);
}
$this->db->sql_freeresult($result);
}
/**
* Determine the new field type for a given phpBB 3.0 field type
*
* @param $field_type string Field type in 3.0
* @return string Field new type which is used since 3.1
*/
public function convert_phpbb30_field_type($field_type)
{
switch ($field_type)
{
case FIELD_INT:
return 'profilefields.type.int';
case FIELD_STRING:
return 'profilefields.type.string';
case FIELD_TEXT:
return 'profilefields.type.text';
case FIELD_BOOL:
return 'profilefields.type.bool';
case FIELD_DROPDOWN:
return 'profilefields.type.dropdown';
case FIELD_DATE:
return 'profilefields.type.date';
default:
return $field_type;
}
}
}

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\v310;
class profilefield_website extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_on_memberlist',
'\phpbb\db\migration\data\v310\profilefield_icq_cleanup',
);
}
protected $profilefield_name = 'phpbb_website';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_website',
'field_type' => 'profilefields.type.url',
'field_ident' => 'phpbb_website',
'field_length' => '40',
'field_minlen' => '12',
'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' => 1,
'field_show_profile' => 1,
'field_hide' => 0,
'field_no_view' => 0,
'field_active' => 1,
'field_is_contact' => 1,
'field_contact_desc' => 'VISIT_WEBSITE',
'field_contact_url' => '%s',
);
protected $user_column_name = 'user_website';
}

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_website_cleanup extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_website');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_website',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'user_website',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'user_website' => array('VCHAR_UNI:200', ''),
),
),
);
}
}

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_wlm extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_website_cleanup',
);
}
protected $profilefield_name = 'phpbb_wlm';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_wlm',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_wlm',
'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_msnm';
}

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_wlm_cleanup extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_msnm');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_wlm',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'user_msnm',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'user_msnm' => array('VCHAR_UNI', ''),
),
),
);
}
}

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_yahoo extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_wlm_cleanup',
);
}
protected $profilefield_name = 'phpbb_yahoo';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_yahoo',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_yahoo',
'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' => 'SEND_YIM_MESSAGE',
'field_contact_url' => 'http://edit.yahoo.com/config/send_webmesg?.target=%s&amp;.src=pg',
);
protected $user_column_name = 'user_yim';
}

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_yahoo_cleanup extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_yim');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_yahoo',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'users' => array(
'user_yim',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'users' => array(
'user_yim' => array('VCHAR_UNI', ''),
),
),
);
}
}

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_youtube 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_youtube';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_youtube',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_youtube',
'field_length' => '20',
'field_minlen' => '3',
'field_maxlen' => '60',
'field_novalue' => '',
'field_default_value' => '',
'field_validation' => '[a-zA-Z][\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_YOUTUBE_CHANNEL',
'field_contact_url' => 'http://youtube.com/user/%s',
);
}

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 prune_shadow_topics extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'forums' => array(
'enable_shadow_prune' => array('BOOL', 0),
'prune_shadow_days' => array('UINT', 7),
'prune_shadow_freq' => array('UINT', 1),
'prune_shadow_next' => array('INT:11', 0),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'forums' => array(
'enable_shadow_prune',
'prune_shadow_days',
'prune_shadow_freq',
'prune_shadow_next',
),
),
);
}
}

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 rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-RC1', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\beta4',
'\phpbb\db\migration\data\v310\contact_admin_acp_module',
'\phpbb\db\migration\data\v310\contact_admin_form',
'\phpbb\db\migration\data\v310\passwords_convert_p2',
'\phpbb\db\migration\data\v310\profilefield_facebook',
'\phpbb\db\migration\data\v310\profilefield_googleplus',
'\phpbb\db\migration\data\v310\profilefield_skype',
'\phpbb\db\migration\data\v310\profilefield_twitter',
'\phpbb\db\migration\data\v310\profilefield_youtube',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-RC1')),
);
}
}

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

View File

@ -0,0 +1,40 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\migration\data\v310;
class rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-RC3', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\rc2',
'\phpbb\db\migration\data\v310\captcha_plugins',
'\phpbb\db\migration\data\v310\rename_too_long_indexes',
'\phpbb\db\migration\data\v310\search_type',
'\phpbb\db\migration\data\v310\topic_sort_username',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-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\v310;
class rc4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.1.0-RC4', '>=');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\rc3',
'\phpbb\db\migration\data\v310\notifications_use_full_name',
);
}
public function update_data()
{
return array(
array('config.update', array('version', '3.1.0-RC4')),
);
}
}

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

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

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 remove_acp_styles_cache extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
$sql = 'SELECT module_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'acp'
AND module_langname = 'ACP_STYLES_CACHE'";
$result = $this->db->sql_query($sql);
$module_id = $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result);
return !$module_id;
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\rc4');
}
public function update_data()
{
return array(
array('module.remove', array(
'acp',
'ACP_STYLE_MANAGEMENT',
array(
'module_basename' => 'acp_styles',
'module_langname' => 'ACP_STYLES_CACHE',
'module_mode' => 'cache',
'module_auth' => 'acl_a_styles',
),
)),
);
}
}

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 rename_too_long_indexes extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_0');
}
public function update_schema()
{
return array(
'drop_keys' => array(
$this->table_prefix . 'search_wordmatch' => array(
'unq_mtch',
),
),
'add_unique_index' => array(
$this->table_prefix . 'search_wordmatch' => array(
'un_mtch' => array('word_id', 'post_id', 'title_match'),
),
),
);
}
}

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 reported_posts_display extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_column_exists($this->table_prefix . 'reports', 'reported_post_enable_bbcode');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'reports' => array(
'reported_post_enable_bbcode' => array('BOOL', 1),
'reported_post_enable_smilies' => array('BOOL', 1),
'reported_post_enable_magic_url' => array('BOOL', 1),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'reports' => array(
'reported_post_enable_bbcode',
'reported_post_enable_smilies',
'reported_post_enable_magic_url',
),
),
);
}
}

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 captcha_plugin
*
* Reset the captcha setting to the default plugin if the defined 'captcha_plugin' is missing.
*/
class reset_missing_captcha_plugin 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(
(is_dir($this->phpbb_root_path . 'includes/captcha/plugins/') &&
!is_file($this->phpbb_root_path . "includes/captcha/plugins/{$this->config['captcha_plugin']}_plugin." . $this->php_ext)),
array('config.update', array('captcha_plugin', 'phpbb_captcha_nogd')),
)),
);
}
}

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 search_type 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(
(is_file($this->phpbb_root_path . 'phpbb/search/' . $this->config['search_type'] . $this->php_ext)),
array('config.update', array('search_type', '\\phpbb\\search\\' . $this->config['search_type'])),
)),
);
}
}

View File

@ -0,0 +1,57 @@
<?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 signature_module_auth extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
$sql = 'SELECT module_auth
FROM ' . MODULES_TABLE . "
WHERE module_class = 'ucp'
AND module_basename = 'ucp_profile'
AND module_mode = 'signature'";
$result = $this->db->sql_query($sql);
$module_auth = $this->db->sql_fetchfield('module_auth');
$this->db->sql_freeresult($result);
return $module_auth === 'acl_u_sig' || $module_auth === false;
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_data()
{
return array(
array('custom', array(
array($this, 'update_signature_module_auth'),
),
),
);
}
public function update_signature_module_auth()
{
$sql = 'UPDATE ' . MODULES_TABLE . "
SET module_auth = 'acl_u_sig'
WHERE module_class = 'ucp'
AND module_basename = 'ucp_profile'
AND module_mode = 'signature'
AND module_auth = ''";
$this->db->sql_query($sql);
}
}

View File

@ -0,0 +1,127 @@
<?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;
use phpbb\db\migration\container_aware_migration;
/**
* Migration to convert the Soft Delete MOD for 3.0
*
* https://www.phpbb.com/customise/db/mod/soft_delete/
*/
class soft_delete_mod_convert extends container_aware_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\alpha3',
);
}
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_deleted');
}
public function update_data()
{
return array(
array('permission.remove', array('m_harddelete', true)),
array('permission.remove', array('m_harddelete', false)),
array('custom', array(array($this, 'convert_posts'))),
array('custom', array(array($this, 'convert_topics'))),
);
}
public function convert_posts($start)
{
$content_visibility = $this->get_content_visibility();
$limit = 250;
$i = 0;
$sql = 'SELECT p.*, t.topic_first_post_id, t.topic_last_post_id
FROM ' . $this->table_prefix . 'posts p, ' . $this->table_prefix . 'topics t
WHERE p.post_deleted > 0
AND t.topic_id = p.topic_id';
$result = $this->db->sql_query_limit($sql, $limit, $start);
while ($row = $this->db->sql_fetchrow($result))
{
$content_visibility->set_post_visibility(
ITEM_DELETED,
$row['post_id'],
$row['topic_id'],
$row['forum_id'],
$row['post_deleted'],
$row['post_deleted_time'],
'',
($row['post_id'] == $row['topic_first_post_id']) ? true : false,
($row['post_id'] == $row['topic_last_post_id']) ? true : false
);
$i++;
}
$this->db->sql_freeresult($result);
if ($i == $limit)
{
return $start + $i;
}
}
public function convert_topics($start)
{
$content_visibility = $this->get_content_visibility();
$limit = 100;
$i = 0;
$sql = 'SELECT *
FROM ' . $this->table_prefix . 'topics
WHERE topic_deleted > 0';
$result = $this->db->sql_query_limit($sql, $limit, $start);
while ($row = $this->db->sql_fetchrow($result))
{
$content_visibility->set_topic_visibility(
ITEM_DELETED,
$row['topic_id'],
$row['forum_id'],
$row['topic_deleted'],
$row['topic_deleted_time'],
''
);
$i++;
}
$this->db->sql_freeresult($result);
if ($i == $limit)
{
return $start + $i;
}
}
/**
* @return \phpbb\content_visibility
*/
protected function get_content_visibility()
{
return $this->container->get('content.visibility');
}
}

View File

@ -0,0 +1,66 @@
<?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;
/**
* Migration to convert the Soft Delete MOD for 3.0
*
* https://www.phpbb.com/customise/db/mod/soft_delete/
*/
class soft_delete_mod_convert2 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\soft_delete_mod_convert',
);
}
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_deleted');
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'forums' => array('forum_deleted_topic_count', 'forum_deleted_reply_count'),
$this->table_prefix . 'posts' => array('post_deleted', 'post_deleted_time'),
$this->table_prefix . 'topics' => array('topic_deleted', 'topic_deleted_time', 'topic_deleted_reply_count'),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'forums' => array(
'forum_deleted_topic_count' => array('UINT', 0),
'forum_deleted_reply_count' => array('UINT', 0),
),
$this->table_prefix . 'posts' => array(
'post_deleted' => array('UINT', 0),
'post_deleted_time' => array('TIMESTAMP', 0),
),
$this->table_prefix . 'topics' => array(
'topic_deleted' => array('UINT', 0),
'topic_deleted_time' => array('TIMESTAMP', 0),
'topic_deleted_reply_count' => array('UINT', 0),
),
),
);
}
}

View File

@ -0,0 +1,65 @@
<?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 softdelete_mcp_modules extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
$sql = 'SELECT module_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'mcp'
AND module_basename = 'mcp_queue'
AND module_mode = 'deleted_topics'";
$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',
'\phpbb\db\migration\data\v310\softdelete_p2',
);
}
public function update_data()
{
return array(
array('module.add', array(
'mcp',
'MCP_QUEUE',
array(
'module_basename' => 'mcp_queue',
'module_langname' => 'MCP_QUEUE_DELETED_TOPICS',
'module_mode' => 'deleted_topics',
'module_auth' => 'aclf_m_approve',
),
)),
array('module.add', array(
'mcp',
'MCP_QUEUE',
array(
'module_basename' => 'mcp_queue',
'module_langname' => 'MCP_QUEUE_DELETED_POSTS',
'module_mode' => 'deleted_posts',
'module_auth' => 'aclf_m_approve',
),
)),
);
}
}

View File

@ -0,0 +1,211 @@
<?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 softdelete_p1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_visibility');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'forums' => array(
'forum_posts_approved' => array('UINT', 0),
'forum_posts_unapproved' => array('UINT', 0),
'forum_posts_softdeleted' => array('UINT', 0),
'forum_topics_approved' => array('UINT', 0),
'forum_topics_unapproved' => array('UINT', 0),
'forum_topics_softdeleted' => array('UINT', 0),
),
$this->table_prefix . 'posts' => array(
'post_visibility' => array('TINT:3', 0),
'post_delete_time' => array('TIMESTAMP', 0),
'post_delete_reason' => array('STEXT_UNI', ''),
'post_delete_user' => array('UINT', 0),
),
$this->table_prefix . 'topics' => array(
'topic_visibility' => array('TINT:3', 0),
'topic_delete_time' => array('TIMESTAMP', 0),
'topic_delete_reason' => array('STEXT_UNI', ''),
'topic_delete_user' => array('UINT', 0),
'topic_posts_approved' => array('UINT', 0),
'topic_posts_unapproved' => array('UINT', 0),
'topic_posts_softdeleted' => array('UINT', 0),
),
),
'add_index' => array(
$this->table_prefix . 'posts' => array(
'post_visibility' => array('post_visibility'),
),
$this->table_prefix . 'topics' => array(
'topic_visibility' => array('topic_visibility'),
'forum_vis_last' => array('forum_id', 'topic_visibility', 'topic_last_post_id'),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'forums' => array(
'forum_posts_approved',
'forum_posts_unapproved',
'forum_posts_softdeleted',
'forum_topics_approved',
'forum_topics_unapproved',
'forum_topics_softdeleted',
),
$this->table_prefix . 'posts' => array(
'post_visibility',
'post_delete_time',
'post_delete_reason',
'post_delete_user',
),
$this->table_prefix . 'topics' => array(
'topic_visibility',
'topic_delete_time',
'topic_delete_reason',
'topic_delete_user',
'topic_posts_approved',
'topic_posts_unapproved',
'topic_posts_softdeleted',
),
),
'drop_keys' => array(
$this->table_prefix . 'posts' => array('post_visibility'),
$this->table_prefix . 'topics' => array('topic_visibility', 'forum_vis_last'),
),
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'update_post_visibility'))),
array('custom', array(array($this, 'update_topic_visibility'))),
array('custom', array(array($this, 'update_topics_post_counts'))),
array('custom', array(array($this, 'update_forums_topic_and_post_counts'))),
array('permission.add', array('f_softdelete', false)),
array('permission.add', array('m_softdelete', false)),
);
}
public function update_post_visibility()
{
$sql = 'UPDATE ' . $this->table_prefix . 'posts
SET post_visibility = post_approved';
$this->sql_query($sql);
}
public function update_topic_visibility()
{
$sql = 'UPDATE ' . $this->table_prefix . 'topics
SET topic_visibility = topic_approved';
$this->sql_query($sql);
}
public function update_topics_post_counts()
{
/*
* Using sql_case here to avoid "BIGINT UNSIGNED value is out of range" errors.
* As we update all topics in 2 queries, one broken topic would stop the conversion
* for all topics and the surpressed error will cause the admin to not even notice it.
*/
$sql = 'UPDATE ' . $this->table_prefix . 'topics
SET topic_posts_approved = topic_replies + 1,
topic_posts_unapproved = ' . $this->db->sql_case('topic_replies_real > topic_replies', 'topic_replies_real - topic_replies', '0') . '
WHERE topic_visibility = ' . ITEM_APPROVED;
$this->sql_query($sql);
$sql = 'UPDATE ' . $this->table_prefix . 'topics
SET topic_posts_approved = 0,
topic_posts_unapproved = (' . $this->db->sql_case('topic_replies_real > topic_replies', 'topic_replies_real - topic_replies', '0') . ') + 1
WHERE topic_visibility = ' . ITEM_UNAPPROVED;
$this->sql_query($sql);
}
public function update_forums_topic_and_post_counts($start)
{
$start = (int) $start;
$limit = 10;
$converted_forums = 0;
if (!$start)
{
// Preserve the forum_posts value for link forums as it represents redirects.
$sql = 'UPDATE ' . $this->table_prefix . 'forums
SET forum_posts_approved = forum_posts
WHERE forum_type = ' . FORUM_LINK;
$this->db->sql_query($sql);
}
$sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved
FROM ' . $this->table_prefix . 'topics
GROUP BY forum_id, topic_visibility
ORDER BY forum_id, topic_visibility';
$result = $this->db->sql_query_limit($sql, $limit, $start);
$update_forums = array();
while ($row = $this->db->sql_fetchrow($result))
{
$converted_forums++;
$forum_id = (int) $row['forum_id'];
if (!isset($update_forums[$forum_id]))
{
$update_forums[$forum_id] = array(
'forum_posts_approved' => 0,
'forum_posts_unapproved' => 0,
'forum_topics_approved' => 0,
'forum_topics_unapproved' => 0,
);
}
$update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts_approved'];
$update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved'];
$update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics'];
}
$this->db->sql_freeresult($result);
foreach ($update_forums as $forum_id => $forum_data)
{
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $forum_data) . '
WHERE forum_id = ' . $forum_id;
$this->sql_query($sql);
}
if ($converted_forums < $limit)
{
// There are no more topics, we are done
return;
}
// There are still more topics to query, return the next start value
return $start + $limit;
}
}

View File

@ -0,0 +1,78 @@
<?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 softdelete_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_approved');
}
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\dev',
'\phpbb\db\migration\data\v310\softdelete_p1',
);
}
public function update_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'forums' => array('forum_posts', 'forum_topics', 'forum_topics_real'),
$this->table_prefix . 'posts' => array('post_approved'),
$this->table_prefix . 'topics' => array('topic_approved', 'topic_replies', 'topic_replies_real'),
),
'drop_keys' => array(
$this->table_prefix . 'posts' => array('post_approved'),
$this->table_prefix . 'topics' => array(
'forum_appr_last',
'topic_approved',
),
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'forums' => array(
'forum_posts' => array('UINT', 0),
'forum_topics' => array('UINT', 0),
'forum_topics_real' => array('UINT', 0),
),
$this->table_prefix . 'posts' => array(
'post_approved' => array('BOOL', 1),
),
$this->table_prefix . 'topics' => array(
'topic_approved' => array('BOOL', 1),
'topic_replies' => array('UINT', 0),
'topic_replies_real' => array('UINT', 0),
),
),
'add_index' => array(
$this->table_prefix . 'posts' => array(
'post_approved' => array('post_approved'),
),
$this->table_prefix . 'topics' => array(
'forum_appr_last' => array('forum_id', 'topic_approved', 'topic_last_post_id'),
'topic_approved' => array('topic_approved'),
),
),
);
}
}

View File

@ -0,0 +1,191 @@
<?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 style_update_p1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_table_exists($this->table_prefix . 'styles_imageset');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'styles' => array(
'style_path' => array('VCHAR:100', ''),
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
'style_parent_id' => array('UINT', 0),
'style_parent_tree' => array('TEXT', ''),
),
),
);
}
public function revert_schema()
{
return array(
'drop_columns' => array(
$this->table_prefix . 'styles' => array(
'style_path',
'bbcode_bitfield',
'style_parent_id',
'style_parent_tree',
),
),
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'styles_update'))),
);
}
public function styles_update()
{
// Get list of valid 3.1 styles
$available_styles = array('prosilver');
$iterator = new \DirectoryIterator($this->phpbb_root_path . 'styles');
$skip_dirs = array('.', '..', 'prosilver');
foreach ($iterator as $fileinfo)
{
if ($fileinfo->isDir() && !in_array($fileinfo->getFilename(), $skip_dirs) && file_exists($fileinfo->getPathname() . '/style.cfg'))
{
$style_cfg = parse_cfg_file($fileinfo->getPathname() . '/style.cfg');
if (isset($style_cfg['phpbb_version']) && version_compare($style_cfg['phpbb_version'], '3.1.0-dev', '>='))
{
// 3.1 style
$available_styles[] = $fileinfo->getFilename();
}
}
}
// Get all installed styles
if ($this->db_tools->sql_table_exists($this->table_prefix . 'styles_imageset'))
{
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id, i.imageset_path
FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . 'styles_theme c, ' . $this->table_prefix . "styles_imageset i
WHERE t.template_id = s.template_id
AND c.theme_id = s.theme_id
AND i.imageset_id = s.imageset_id";
}
else
{
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id
FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . "styles_theme c
WHERE t.template_id = s.template_id
AND c.theme_id = s.theme_id";
}
$result = $this->db->sql_query($sql);
$styles = array();
while ($row = $this->db->sql_fetchrow($result))
{
$styles[] = $row;
}
$this->db->sql_freeresult($result);
// Decide which styles to keep, all others will be deleted
$valid_styles = array();
foreach ($styles as $style_row)
{
if (
// Delete styles with parent style (not supported yet)
$style_row['template_inherits_id'] == 0 &&
// Check if components match
$style_row['template_path'] == $style_row['theme_path'] && (!isset($style_row['imageset_path']) || $style_row['template_path'] == $style_row['imageset_path']) &&
// Check if components are valid
in_array($style_row['template_path'], $available_styles)
)
{
// Valid style. Keep it
$sql_ary = array(
'style_path' => $style_row['template_path'],
'bbcode_bitfield' => $style_row['bbcode_bitfield'],
'style_parent_id' => 0,
'style_parent_tree' => '',
);
$this->sql_query('UPDATE ' . STYLES_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
WHERE style_id = ' . $style_row['style_id']);
$valid_styles[] = (int) $style_row['style_id'];
}
}
// Remove old entries from styles table
if (!count($valid_styles))
{
// No valid styles: remove everything and add prosilver
$this->sql_query('DELETE FROM ' . STYLES_TABLE);
$sql_ary = array(
'style_name' => 'prosilver',
'style_copyright' => '&copy; phpBB Limited',
'style_active' => 1,
'style_path' => 'prosilver',
'bbcode_bitfield' => 'lNg=',
'style_parent_id' => 0,
'style_parent_tree' => '',
// Will be removed in the next step
'imageset_id' => 0,
'template_id' => 0,
'theme_id' => 0,
);
$sql = 'INSERT INTO ' . STYLES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
$this->sql_query($sql);
$sql = 'SELECT style_id
FROM ' . STYLES_TABLE . "
WHERE style_name = 'prosilver'";
$result = $this->sql_query($sql);
$default_style = (int) $this->db->sql_fetchfield('style_id');
$this->db->sql_freeresult($result);
$this->config->set('default_style', $default_style);
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = ' . (int) $default_style;
$this->sql_query($sql);
}
else
{
// There are valid styles in styles table. Remove styles that are outdated
$this->sql_query('DELETE FROM ' . STYLES_TABLE . '
WHERE ' . $this->db->sql_in_set('style_id', $valid_styles, true));
// Change default style
if (!in_array($this->config['default_style'], $valid_styles))
{
$this->sql_query('UPDATE ' . CONFIG_TABLE . "
SET config_value = '" . $valid_styles[0] . "'
WHERE config_name = 'default_style'");
}
// Reset styles for users
$this->sql_query('UPDATE ' . USERS_TABLE . "
SET user_style = '" . (int) $valid_styles[0] . "'
WHERE " . $this->db->sql_in_set('user_style', $valid_styles, true));
}
}
}

View File

@ -0,0 +1,151 @@
<?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 style_update_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_table_exists($this->table_prefix . 'styles_imageset');
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\style_update_p1');
}
public function update_schema()
{
return array(
'drop_keys' => array(
$this->table_prefix . 'styles' => array(
'imageset_id',
'template_id',
'theme_id',
),
),
'drop_columns' => array(
$this->table_prefix . 'styles' => array(
'imageset_id',
'template_id',
'theme_id',
),
),
'drop_tables' => array(
$this->table_prefix . 'styles_imageset',
$this->table_prefix . 'styles_imageset_data',
$this->table_prefix . 'styles_template',
$this->table_prefix . 'styles_template_data',
$this->table_prefix . 'styles_theme',
),
);
}
public function revert_schema()
{
return array(
'add_columns' => array(
$this->table_prefix . 'styles' => array(
'imageset_id' => array('UINT', 0),
'template_id' => array('UINT', 0),
'theme_id' => array('UINT', 0),
),
),
'add_index' => array(
$this->table_prefix . 'styles' => array(
'imageset_id' => array('imageset_id'),
'template_id' => array('template_id'),
'theme_id' => array('theme_id'),
),
),
'add_tables' => array(
$this->table_prefix . 'styles_imageset' => array(
'COLUMNS' => array(
'imageset_id' => array('UINT', null, 'auto_increment'),
'imageset_name' => array('VCHAR_UNI:255', ''),
'imageset_copyright' => array('VCHAR_UNI', ''),
'imageset_path' => array('VCHAR:100', ''),
),
'PRIMARY_KEY' => 'imageset_id',
'KEYS' => array(
'imgset_nm' => array('UNIQUE', 'imageset_name'),
),
),
$this->table_prefix . 'styles_imageset_data' => array(
'COLUMNS' => array(
'image_id' => array('UINT', null, 'auto_increment'),
'image_name' => array('VCHAR:200', ''),
'image_filename' => array('VCHAR:200', ''),
'image_lang' => array('VCHAR:30', ''),
'image_height' => array('USINT', 0),
'image_width' => array('USINT', 0),
'imageset_id' => array('UINT', 0),
),
'PRIMARY_KEY' => 'image_id',
'KEYS' => array(
'i_d' => array('INDEX', 'imageset_id'),
),
),
$this->table_prefix . 'styles_template' => array(
'COLUMNS' => array(
'template_id' => array('UINT', null, 'auto_increment'),
'template_name' => array('VCHAR_UNI:255', ''),
'template_copyright' => array('VCHAR_UNI', ''),
'template_path' => array('VCHAR:100', ''),
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
'template_storedb' => array('BOOL', 0),
'template_inherits_id' => array('UINT:4', 0),
'template_inherit_path' => array('VCHAR', ''),
),
'PRIMARY_KEY' => 'template_id',
'KEYS' => array(
'tmplte_nm' => array('UNIQUE', 'template_name'),
),
),
$this->table_prefix . 'styles_template_data' => array(
'COLUMNS' => array(
'template_id' => array('UINT', 0),
'template_filename' => array('VCHAR:100', ''),
'template_included' => array('TEXT', ''),
'template_mtime' => array('TIMESTAMP', 0),
'template_data' => array('MTEXT_UNI', ''),
),
'KEYS' => array(
'tid' => array('INDEX', 'template_id'),
'tfn' => array('INDEX', 'template_filename'),
),
),
$this->table_prefix . 'styles_theme' => array(
'COLUMNS' => array(
'theme_id' => array('UINT', null, 'auto_increment'),
'theme_name' => array('VCHAR_UNI:255', ''),
'theme_copyright' => array('VCHAR_UNI', ''),
'theme_path' => array('VCHAR:100', ''),
'theme_storedb' => array('BOOL', 0),
'theme_mtime' => array('TIMESTAMP', 0),
'theme_data' => array('MTEXT_UNI', ''),
),
'PRIMARY_KEY' => 'theme_id',
'KEYS' => array(
'theme_name' => array('UNIQUE', 'theme_name'),
),
),
),
);
}
}

View File

@ -0,0 +1,110 @@
<?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 teampage extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return $this->db_tools->sql_table_exists($this->table_prefix . 'teampage');
}
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 . 'teampage' => array(
'COLUMNS' => array(
'teampage_id' => array('UINT', null, 'auto_increment'),
'group_id' => array('UINT', 0),
'teampage_name' => array('VCHAR_UNI:255', ''),
'teampage_position' => array('UINT', 0),
'teampage_parent' => array('UINT', 0),
),
'PRIMARY_KEY' => 'teampage_id',
),
),
'drop_columns' => array(
$this->table_prefix . 'groups' => array(
'group_teampage',
),
),
);
}
public function revert_schema()
{
return array(
'drop_tables' => array(
$this->table_prefix . 'teampage',
),
'add_columns' => array(
$this->table_prefix . 'groups' => array(
'group_teampage' => array('UINT', 0, 'after' => 'group_legend'),
),
),
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'add_groups_teampage'))),
);
}
public function add_groups_teampage()
{
$sql = 'SELECT teampage_id
FROM ' . TEAMPAGE_TABLE;
$result = $this->db->sql_query_limit($sql, 1);
$added_groups_teampage = (bool) $this->db->sql_fetchfield('teampage_id');
$this->db->sql_freeresult($result);
if (!$added_groups_teampage)
{
$sql = 'SELECT *
FROM ' . GROUPS_TABLE . '
WHERE group_type = ' . GROUP_SPECIAL . "
AND (group_name = 'ADMINISTRATORS'
OR group_name = 'GLOBAL_MODERATORS')
ORDER BY group_name ASC";
$result = $this->db->sql_query($sql);
$teampage_entries = array();
while ($row = $this->db->sql_fetchrow($result))
{
$teampage_entries[] = array(
'group_id' => (int) $row['group_id'],
'teampage_name' => '',
'teampage_position' => count($teampage_entries) + 1,
'teampage_parent' => 0,
);
}
$this->db->sql_freeresult($result);
if (count($teampage_entries))
{
$this->db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_entries);
}
unset($teampage_entries);
}
}
}

View File

@ -0,0 +1,194 @@
<?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 timezone extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_dst');
}
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_timezone' => array('VCHAR:100', ''),
),
),
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'update_timezones'))),
);
}
public function update_timezones($start)
{
$start = (int) $start;
$limit = 500;
$converted = 0;
$update_blocks = array();
$sql = 'SELECT user_id, user_timezone, user_dst
FROM ' . $this->table_prefix . 'users
ORDER BY user_id ASC';
$result = $this->db->sql_query_limit($sql, $limit, $start);
while ($row = $this->db->sql_fetchrow($result))
{
$converted++;
// In case this is somehow run twice on a row.
// Otherwise it would just end up as UTC on the second run
if (is_numeric($row['user_timezone']))
{
$update_blocks[$row['user_timezone'] . ':' . $row['user_dst']][] = (int) $row['user_id'];
}
}
$this->db->sql_freeresult($result);
// Update blocks of users who share the same timezone/dst
foreach ($update_blocks as $timezone => $user_ids)
{
$timezone = explode(':', $timezone);
$converted_timezone = $this->convert_phpbb30_timezone($timezone[0], $timezone[1]);
$sql = 'UPDATE ' . $this->table_prefix . "users
SET user_timezone = '" . $this->db->sql_escape($converted_timezone) . "'
WHERE " . $this->db->sql_in_set('user_id', $user_ids);
$this->sql_query($sql);
}
if ($converted == $limit)
{
// There are still more to convert
return $start + $limit;
}
// Update board default timezone
$sql = 'UPDATE ' . $this->table_prefix . "config
SET config_value = '" . $this->convert_phpbb30_timezone($this->config['board_timezone'], $this->config['board_dst']) . "'
WHERE config_name = 'board_timezone'";
$this->sql_query($sql);
}
/**
* Determine the new timezone for a given phpBB 3.0 timezone and
* "Daylight Saving Time" option
*
* @param $timezone float Users timezone in 3.0
* @param $dst int Users daylight saving time
* @return string Users new php Timezone which is used since 3.1
*/
public function convert_phpbb30_timezone($timezone, $dst)
{
$offset = (float) $timezone + (int) $dst;
switch ($timezone)
{
case '-12':
return 'Etc/GMT+' . abs($offset); //'[UTC - 12] Baker Island Time'
case '-11':
return 'Etc/GMT+' . abs($offset); //'[UTC - 11] Niue Time, Samoa Standard Time'
case '-10':
return 'Etc/GMT+' . abs($offset); //'[UTC - 10] Hawaii-Aleutian Standard Time, Cook Island Time'
case '-9.5':
return 'Pacific/Marquesas'; //'[UTC - 9:30] Marquesas Islands Time'
case '-9':
return 'Etc/GMT+' . abs($offset); //'[UTC - 9] Alaska Standard Time, Gambier Island Time'
case '-8':
return 'Etc/GMT+' . abs($offset); //'[UTC - 8] Pacific Standard Time'
case '-7':
return 'Etc/GMT+' . abs($offset); //'[UTC - 7] Mountain Standard Time'
case '-6':
return 'Etc/GMT+' . abs($offset); //'[UTC - 6] Central Standard Time'
case '-5':
return 'Etc/GMT+' . abs($offset); //'[UTC - 5] Eastern Standard Time'
case '-4.5':
return 'America/Caracas'; //'[UTC - 4:30] Venezuelan Standard Time'
case '-4':
return 'Etc/GMT+' . abs($offset); //'[UTC - 4] Atlantic Standard Time'
case '-3.5':
return 'America/St_Johns'; //'[UTC - 3:30] Newfoundland Standard Time'
case '-3':
return 'Etc/GMT+' . abs($offset); //'[UTC - 3] Amazon Standard Time, Central Greenland Time'
case '-2':
return 'Etc/GMT+' . abs($offset); //'[UTC - 2] Fernando de Noronha Time, South Georgia &amp; the South Sandwich Islands Time'
case '-1':
return 'Etc/GMT+' . abs($offset); //'[UTC - 1] Azores Standard Time, Cape Verde Time, Eastern Greenland Time'
case '0':
return (!$dst) ? 'UTC' : 'Etc/GMT-1'; //'[UTC] Western European Time, Greenwich Mean Time'
case '1':
return 'Etc/GMT-' . $offset; //'[UTC + 1] Central European Time, West African Time'
case '2':
return 'Etc/GMT-' . $offset; //'[UTC + 2] Eastern European Time, Central African Time'
case '3':
return 'Etc/GMT-' . $offset; //'[UTC + 3] Moscow Standard Time, Eastern African Time'
case '3.5':
return 'Asia/Tehran'; //'[UTC + 3:30] Iran Standard Time'
case '4':
return 'Etc/GMT-' . $offset; //'[UTC + 4] Gulf Standard Time, Samara Standard Time'
case '4.5':
return 'Asia/Kabul'; //'[UTC + 4:30] Afghanistan Time'
case '5':
return 'Etc/GMT-' . $offset; //'[UTC + 5] Pakistan Standard Time, Yekaterinburg Standard Time'
case '5.5':
return 'Asia/Kolkata'; //'[UTC + 5:30] Indian Standard Time, Sri Lanka Time'
case '5.75':
return 'Asia/Kathmandu'; //'[UTC + 5:45] Nepal Time'
case '6':
return 'Etc/GMT-' . $offset; //'[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time'
case '6.5':
return 'Indian/Cocos'; //'[UTC + 6:30] Cocos Islands Time, Myanmar Time'
case '7':
return 'Etc/GMT-' . $offset; //'[UTC + 7] Indochina Time, Krasnoyarsk Standard Time'
case '8':
return 'Etc/GMT-' . $offset; //'[UTC + 8] Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time'
case '8.75':
return 'Australia/Eucla'; //'[UTC + 8:45] Southeastern Western Australia Standard Time'
case '9':
return 'Etc/GMT-' . $offset; //'[UTC + 9] Japan Standard Time, Korea Standard Time, Chita Standard Time'
case '9.5':
return 'Australia/ACT'; //'[UTC + 9:30] Australian Central Standard Time'
case '10':
return 'Etc/GMT-' . $offset; //'[UTC + 10] Australian Eastern Standard Time, Vladivostok Standard Time'
case '10.5':
return 'Australia/Lord_Howe'; //'[UTC + 10:30] Lord Howe Standard Time'
case '11':
return 'Etc/GMT-' . $offset; //'[UTC + 11] Solomon Island Time, Magadan Standard Time'
case '11.5':
return 'Pacific/Norfolk'; //'[UTC + 11:30] Norfolk Island Time'
case '12':
return 'Etc/GMT-12'; //'[UTC + 12] New Zealand Time, Fiji Time, Kamchatka Standard Time'
case '12.75':
return 'Pacific/Chatham'; //'[UTC + 12:45] Chatham Islands Time'
case '13':
return 'Pacific/Tongatapu'; //'[UTC + 13] Tonga Time, Phoenix Islands Time'
case '14':
return 'Pacific/Kiritimati'; //'[UTC + 14] Line Island Time'
default:
return 'UTC';
}
}
}

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

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 topic_sort_username extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'topics' => array(
'topic_first_poster_name' => array('VCHAR_UNI:255', '', 'true_sort'),
),
),
);
}
public function revert_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'topics' => array(
'topic_first_poster_name' => array('VCHAR_UNI:255', ''),
),
),
);
}
}

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 ucp_popuppm_module extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
$sql = 'SELECT module_id
FROM ' . MODULES_TABLE . "
WHERE module_class = 'ucp'
AND module_langname = 'UCP_PM_POPUP_TITLE'";
$result = $this->db->sql_query($sql);
$module_id = $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result);
return $module_id == false;
}
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}
public function update_data()
{
return array(
array('module.remove', array(
'ucp',
'UCP_PM',
'UCP_PM_POPUP_TITLE',
)),
);
}
}