mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/migrations] Migrations back through 3.0.6
PHPBB3-9737
This commit is contained in:
parent
e7389e4c32
commit
2a7985c26f
5 changed files with 197 additions and 204 deletions
|
@ -61,38 +61,47 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
|
|
||||||
function update_data()
|
function update_data()
|
||||||
{
|
{
|
||||||
// Let's see if the GD Captcha can be enabled... we simply look for what *is* enabled...
|
return array(
|
||||||
if (!empty($config['captcha_gd']) && !isset($config['captcha_plugin']))
|
//array('custom', array(array(&$this, '')))
|
||||||
{
|
array('config.add', array('captcha_plugin', 'phpbb_captcha_nogd')),
|
||||||
set_config('captcha_plugin', 'phpbb_captcha_gd');
|
array('config.update_if', array(
|
||||||
}
|
($this->config['captcha_gd']),
|
||||||
else if (!isset($config['captcha_plugin']))
|
'captcha_plugin',
|
||||||
{
|
'phpbb_captcha_gd',
|
||||||
set_config('captcha_plugin', 'phpbb_captcha_nogd');
|
)),
|
||||||
}
|
|
||||||
|
|
||||||
// Entries for the Feed Feature
|
array('config.add', array('feed_enable', 0)),
|
||||||
set_config('feed_enable', '0');
|
array('config.add', array('feed_limit', 10)),
|
||||||
set_config('feed_limit', '10');
|
array('config.add', array('feed_overall_forums', 1)),
|
||||||
|
array('config.add', array('feed_overall_forums_limit', 15)),
|
||||||
|
array('config.add', array('feed_overall_topics', 0)),
|
||||||
|
array('config.add', array('feed_overall_topics_limit', 15)),
|
||||||
|
array('config.add', array('feed_forum', 1)),
|
||||||
|
array('config.add', array('feed_topic', 1)),
|
||||||
|
array('config.add', array('feed_item_statistics', 1)),
|
||||||
|
|
||||||
set_config('feed_overall_forums', '1');
|
array('config.add', array('smilies_per_page', 50)),
|
||||||
set_config('feed_overall_forums_limit', '15');
|
array('config.add', array('allow_pm_report', 1)),
|
||||||
|
array('config.add', array('min_post_chars', 1)),
|
||||||
|
array('config.add', array('allow_quick_reply', 1)),
|
||||||
|
array('config.add', array('new_member_post_limit', 0)),
|
||||||
|
array('config.add', array('new_member_group_default', 0)),
|
||||||
|
array('config.add', array('delete_time', $this->config['edit_time'])),
|
||||||
|
|
||||||
set_config('feed_overall_topics', '0');
|
array('config.add', array('allow_avatar', 0)),
|
||||||
set_config('feed_overall_topics_limit', '15');
|
array('config.add_if', array(
|
||||||
|
($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']),
|
||||||
|
'allow_avatar',
|
||||||
|
1,
|
||||||
|
)),
|
||||||
|
array('config.add', array('allow_avatar_remote_upload', 0)),
|
||||||
|
array('config.add_if', array(
|
||||||
|
($this->config['allow_avatar_remote'] && $this->config['allow_avatar_upload']),
|
||||||
|
'allow_avatar_remote_upload',
|
||||||
|
1,
|
||||||
|
)),
|
||||||
|
|
||||||
set_config('feed_forum', '1');
|
array('module.add', array(
|
||||||
set_config('feed_topic', '1');
|
|
||||||
set_config('feed_item_statistics', '1');
|
|
||||||
|
|
||||||
// Entries for smiley pagination
|
|
||||||
set_config('smilies_per_page', '50');
|
|
||||||
|
|
||||||
// Entry for reporting PMs
|
|
||||||
set_config('allow_pm_report', '1');
|
|
||||||
|
|
||||||
// Install modules
|
|
||||||
$modules_to_install = array(
|
|
||||||
'feed' => array(
|
'feed' => array(
|
||||||
'base' => 'board',
|
'base' => 'board',
|
||||||
'class' => 'acp',
|
'class' => 'acp',
|
||||||
|
@ -101,6 +110,8 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
'cat' => 'ACP_BOARD_CONFIGURATION',
|
'cat' => 'ACP_BOARD_CONFIGURATION',
|
||||||
'after' => array('signature', 'ACP_SIGNATURE_SETTINGS')
|
'after' => array('signature', 'ACP_SIGNATURE_SETTINGS')
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
array('module.add', array(
|
||||||
'warnings' => array(
|
'warnings' => array(
|
||||||
'base' => 'users',
|
'base' => 'users',
|
||||||
'class' => 'acp',
|
'class' => 'acp',
|
||||||
|
@ -110,6 +121,8 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
'cat' => 'ACP_CAT_USERS',
|
'cat' => 'ACP_CAT_USERS',
|
||||||
'after' => array('feedback', 'ACP_USER_FEEDBACK')
|
'after' => array('feedback', 'ACP_USER_FEEDBACK')
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
array('module.add', array(
|
||||||
'send_statistics' => array(
|
'send_statistics' => array(
|
||||||
'base' => 'send_statistics',
|
'base' => 'send_statistics',
|
||||||
'class' => 'acp',
|
'class' => 'acp',
|
||||||
|
@ -117,6 +130,8 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
'auth' => 'acl_a_server',
|
'auth' => 'acl_a_server',
|
||||||
'cat' => 'ACP_SERVER_CONFIGURATION'
|
'cat' => 'ACP_SERVER_CONFIGURATION'
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
array('module.add', array(
|
||||||
'setting_forum_copy' => array(
|
'setting_forum_copy' => array(
|
||||||
'base' => 'permissions',
|
'base' => 'permissions',
|
||||||
'class' => 'acp',
|
'class' => 'acp',
|
||||||
|
@ -125,6 +140,8 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
'cat' => 'ACP_FORUM_BASED_PERMISSIONS',
|
'cat' => 'ACP_FORUM_BASED_PERMISSIONS',
|
||||||
'after' => array('setting_forum_local', 'ACP_FORUM_PERMISSIONS')
|
'after' => array('setting_forum_local', 'ACP_FORUM_PERMISSIONS')
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
array('module.add', array(
|
||||||
'pm_reports' => array(
|
'pm_reports' => array(
|
||||||
'base' => 'pm_reports',
|
'base' => 'pm_reports',
|
||||||
'class' => 'mcp',
|
'class' => 'mcp',
|
||||||
|
@ -132,6 +149,8 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
'auth' => 'aclf_m_report',
|
'auth' => 'aclf_m_report',
|
||||||
'cat' => 'MCP_REPORTS'
|
'cat' => 'MCP_REPORTS'
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
array('module.add', array(
|
||||||
'pm_reports_closed' => array(
|
'pm_reports_closed' => array(
|
||||||
'base' => 'pm_reports',
|
'base' => 'pm_reports',
|
||||||
'class' => 'mcp',
|
'class' => 'mcp',
|
||||||
|
@ -139,6 +158,8 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
'auth' => 'aclf_m_report',
|
'auth' => 'aclf_m_report',
|
||||||
'cat' => 'MCP_REPORTS'
|
'cat' => 'MCP_REPORTS'
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
array('module.add', array(
|
||||||
'pm_report_details' => array(
|
'pm_report_details' => array(
|
||||||
'base' => 'pm_reports',
|
'base' => 'pm_reports',
|
||||||
'class' => 'mcp',
|
'class' => 'mcp',
|
||||||
|
@ -146,24 +167,35 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
'auth' => 'aclf_m_report',
|
'auth' => 'aclf_m_report',
|
||||||
'cat' => 'MCP_REPORTS'
|
'cat' => 'MCP_REPORTS'
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
array('custom', array(array(&$this, 'add_newly_registered_group'))),
|
||||||
|
array('custom', array(array(&$this, 'set_user_options_default'))),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
_add_modules($modules_to_install);
|
function set_user_options_default()
|
||||||
|
{
|
||||||
|
// 229376 is the added value to enable all three signature options
|
||||||
|
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376';
|
||||||
|
$this->sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_newly_registered_group()
|
||||||
|
{
|
||||||
// Add newly_registered group... but check if it already exists (we always supported running the updater on any schema)
|
// Add newly_registered group... but check if it already exists (we always supported running the updater on any schema)
|
||||||
$sql = 'SELECT group_id
|
$sql = 'SELECT group_id
|
||||||
FROM ' . GROUPS_TABLE . "
|
FROM ' . GROUPS_TABLE . "
|
||||||
WHERE group_name = 'NEWLY_REGISTERED'";
|
WHERE group_name = 'NEWLY_REGISTERED'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$group_id = (int) $db->sql_fetchfield('group_id');
|
$group_id = (int) $this->db->sql_fetchfield('group_id');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$group_id)
|
if (!$group_id)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)";
|
$sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)";
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
|
|
||||||
$group_id = $db->sql_nextid();
|
$group_id = $this->db->sql_nextid();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert new user role... at the end of the chain
|
// Insert new user role... at the end of the chain
|
||||||
|
@ -171,35 +203,35 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
FROM ' . ACL_ROLES_TABLE . "
|
FROM ' . ACL_ROLES_TABLE . "
|
||||||
WHERE role_name = 'ROLE_USER_NEW_MEMBER'
|
WHERE role_name = 'ROLE_USER_NEW_MEMBER'
|
||||||
AND role_type = 'u_'";
|
AND role_type = 'u_'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$u_role = (int) $db->sql_fetchfield('role_id');
|
$u_role = (int) $this->db->sql_fetchfield('role_id');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$u_role)
|
if (!$u_role)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT MAX(role_order) as max_order_id
|
$sql = 'SELECT MAX(role_order) as max_order_id
|
||||||
FROM ' . ACL_ROLES_TABLE . "
|
FROM ' . ACL_ROLES_TABLE . "
|
||||||
WHERE role_type = 'u_'";
|
WHERE role_type = 'u_'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$next_order_id = (int) $db->sql_fetchfield('max_order_id');
|
$next_order_id = (int) $this->db->sql_fetchfield('max_order_id');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$next_order_id++;
|
$next_order_id++;
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)";
|
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)";
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
$u_role = $db->sql_nextid();
|
$u_role = $this->db->sql_nextid();
|
||||||
|
|
||||||
if (!$errored)
|
if (!$errored)
|
||||||
{
|
{
|
||||||
// Now add the correct data to the roles...
|
// Now add the correct data to the roles...
|
||||||
// The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups
|
// The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups
|
||||||
$sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')";
|
$sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')";
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
|
|
||||||
// Add user role to group
|
// Add user role to group
|
||||||
$sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)";
|
$sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)";
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,29 +240,29 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
FROM ' . ACL_ROLES_TABLE . "
|
FROM ' . ACL_ROLES_TABLE . "
|
||||||
WHERE role_name = 'ROLE_FORUM_NEW_MEMBER'
|
WHERE role_name = 'ROLE_FORUM_NEW_MEMBER'
|
||||||
AND role_type = 'f_'";
|
AND role_type = 'f_'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$f_role = (int) $db->sql_fetchfield('role_id');
|
$f_role = (int) $this->db->sql_fetchfield('role_id');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$f_role)
|
if (!$f_role)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT MAX(role_order) as max_order_id
|
$sql = 'SELECT MAX(role_order) as max_order_id
|
||||||
FROM ' . ACL_ROLES_TABLE . "
|
FROM ' . ACL_ROLES_TABLE . "
|
||||||
WHERE role_type = 'f_'";
|
WHERE role_type = 'f_'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$next_order_id = (int) $db->sql_fetchfield('max_order_id');
|
$next_order_id = (int) $this->db->sql_fetchfield('max_order_id');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$next_order_id++;
|
$next_order_id++;
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)";
|
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)";
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
$f_role = $db->sql_nextid();
|
$f_role = $this->db->sql_nextid();
|
||||||
|
|
||||||
if (!$errored)
|
if (!$errored)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')";
|
$sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')";
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,25 +270,14 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
$sql = 'SELECT 1
|
$sql = 'SELECT 1
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_new = 0';
|
WHERE user_new = 0';
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $this->db->sql_query_limit($sql, 1);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $this->db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$row)
|
if (!$row)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0';
|
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0';
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
}
|
|
||||||
|
|
||||||
// Newly registered users limit
|
|
||||||
if (!isset($config['new_member_post_limit']))
|
|
||||||
{
|
|
||||||
set_config('new_member_post_limit', (!empty($config['enable_queue_trigger'])) ? $config['queue_trigger_posts'] : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['new_member_group_default']))
|
|
||||||
{
|
|
||||||
set_config('new_member_group_default', 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts...
|
// To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts...
|
||||||
|
@ -265,9 +286,9 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
FROM ' . ACL_GROUPS_TABLE . '
|
FROM ' . ACL_GROUPS_TABLE . '
|
||||||
WHERE group_id = ' . $group_id . '
|
WHERE group_id = ' . $group_id . '
|
||||||
AND auth_role_id = ' . $f_role;
|
AND auth_role_id = ' . $f_role;
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$is_options = (int) $db->sql_fetchfield('forum_id');
|
$is_options = (int) $this->db->sql_fetchfield('forum_id');
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
// Not assigned at all... :/
|
// Not assigned at all... :/
|
||||||
if (!$is_options)
|
if (!$is_options)
|
||||||
|
@ -276,75 +297,18 @@ class phpbb_db_migration_v306rc1 extends phpbb_db_migration
|
||||||
$sql = 'SELECT forum_id
|
$sql = 'SELECT forum_id
|
||||||
FROM ' . FORUMS_TABLE . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
WHERE forum_type != ' . FORUM_LINK;
|
WHERE forum_type != ' . FORUM_LINK;
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
_sql('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)', $errored, $error_ary);
|
$this->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)');
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear permissions...
|
// Clear permissions...
|
||||||
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
|
include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->phpEx);
|
||||||
$auth_admin = new auth_admin();
|
$auth_admin = new auth_admin();
|
||||||
$auth_admin->acl_clear_prefetch();
|
$auth_admin->acl_clear_prefetch();
|
||||||
|
|
||||||
if (!isset($config['allow_avatar']))
|
|
||||||
{
|
|
||||||
if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote'])
|
|
||||||
{
|
|
||||||
set_config('allow_avatar', '1');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
set_config('allow_avatar', '0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['allow_avatar_remote_upload']))
|
|
||||||
{
|
|
||||||
if ($config['allow_avatar_remote'] && $config['allow_avatar_upload'])
|
|
||||||
{
|
|
||||||
set_config('allow_avatar_remote_upload', '1');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
set_config('allow_avatar_remote_upload', '0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Minimum number of characters
|
|
||||||
if (!isset($config['min_post_chars']))
|
|
||||||
{
|
|
||||||
set_config('min_post_chars', '1');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['allow_quick_reply']))
|
|
||||||
{
|
|
||||||
set_config('allow_quick_reply', '1');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set every members user_options column to enable
|
|
||||||
// bbcode, smilies and URLs for signatures by default
|
|
||||||
$sql = 'SELECT user_options
|
|
||||||
FROM ' . USERS_TABLE . '
|
|
||||||
WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
|
||||||
$user_option = (int) $db->sql_fetchfield('user_options');
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Check if we already updated the database by checking bit 15 which we used to store the sig_bbcode option
|
|
||||||
if (!($user_option & 1 << 15))
|
|
||||||
{
|
|
||||||
// 229376 is the added value to enable all three signature options
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376';
|
|
||||||
_sql($sql, $errored, $error_ary);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['delete_time']))
|
|
||||||
{
|
|
||||||
set_config('delete_time', $config['edit_time']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,19 @@ class phpbb_db_migration_v306rc3 extends phpbb_db_migration
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_data()
|
function update_data()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('custom', array(array(&$this, 'update_cp_fields'))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_cp_fields()
|
||||||
{
|
{
|
||||||
// Update the Custom Profile Fields based on previous settings to the new format
|
// Update the Custom Profile Fields based on previous settings to the new format
|
||||||
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . '
|
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . '
|
||||||
SET field_show_on_vt = 1
|
SET field_show_on_vt = 1
|
||||||
WHERE field_hide = 0
|
WHERE field_hide = 0
|
||||||
AND (field_required = 1 OR field_show_on_reg = 1 OR field_show_profile = 1)';
|
AND (field_required = 1 OR field_show_on_reg = 1 OR field_show_profile = 1)';
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,22 @@ class phpbb_db_migration_v307rc1 extends phpbb_db_migration
|
||||||
|
|
||||||
function update_data()
|
function update_data()
|
||||||
{
|
{
|
||||||
// ATOM Feeds
|
return array(
|
||||||
set_config('feed_overall', '1');
|
array('config.add', array('feed_overall', 1)),
|
||||||
set_config('feed_http_auth', '0');
|
array('config.add', array('feed_http_auth', 0)),
|
||||||
set_config('feed_limit_post', (string) (isset($config['feed_limit']) ? (int) $config['feed_limit'] : 15));
|
array('config.add', array('feed_limit_post', $this->config['feed_limit'])),
|
||||||
set_config('feed_limit_topic', (string) (isset($config['feed_overall_topics_limit']) ? (int) $config['feed_overall_topics_limit'] : 10));
|
array('config.add', array('feed_limit_topic', $this->config['feed_overall_topics_limit'])),
|
||||||
set_config('feed_topics_new', (!empty($config['feed_overall_topics']) ? '1' : '0'));
|
array('config.add', array('feed_topics_new', $this->config['feed_overall_topics'])),
|
||||||
set_config('feed_topics_active', (!empty($config['feed_overall_topics']) ? '1' : '0'));
|
array('config.add', array('feed_topics_active', $this->config['feed_overall_topics'])),
|
||||||
|
array('custom', array(array(&$this, 'delete_text_templates'))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_text_templates()
|
||||||
|
{
|
||||||
// Delete all text-templates from the template_data
|
// Delete all text-templates from the template_data
|
||||||
$sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
|
$sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
|
||||||
WHERE template_filename ' . $db->sql_like_expression($db->any_char . '.txt');
|
WHERE template_filename ' . $this->db->sql_like_expression($this->db->any_char . '.txt');
|
||||||
_sql($sql, $errored, $error_ary);
|
$this->sql_query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,26 @@ class phpbb_db_migration_v307rc2 extends phpbb_db_migration
|
||||||
|
|
||||||
function update_data()
|
function update_data()
|
||||||
{
|
{
|
||||||
|
return array(
|
||||||
|
array('custom', array(array(&$this, 'update_email_hash'))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_email_hash($start = 0)
|
||||||
|
{
|
||||||
|
$limit = 1000;
|
||||||
|
|
||||||
$sql = 'SELECT user_id, user_email, user_email_hash
|
$sql = 'SELECT user_id, user_email, user_email_hash
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type <> ' . USER_IGNORE . "
|
WHERE user_type <> ' . USER_IGNORE . "
|
||||||
AND user_email <> ''";
|
AND user_email <> ''";
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query_limit($sql, $limit, $start);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
$i++;
|
||||||
|
|
||||||
// Snapshot of the phpbb_email_hash() function
|
// Snapshot of the phpbb_email_hash() function
|
||||||
// We cannot call it directly because the auto updater updates the DB first. :/
|
// We cannot call it directly because the auto updater updates the DB first. :/
|
||||||
$user_email_hash = sprintf('%u', crc32(strtolower($row['user_email']))) . strlen($row['user_email']);
|
$user_email_hash = sprintf('%u', crc32(strtolower($row['user_email']))) . strlen($row['user_email']);
|
||||||
|
@ -41,13 +52,19 @@ class phpbb_db_migration_v307rc2 extends phpbb_db_migration
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
|
||||||
WHERE user_id = ' . (int) $row['user_id'];
|
WHERE user_id = ' . (int) $row['user_id'];
|
||||||
_sql($sql, $errored, $error_ary, ($i % 100 == 0));
|
$this->sql_query($sql);
|
||||||
|
|
||||||
++$i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($i < $limit)
|
||||||
|
{
|
||||||
|
// Completed
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $start + $limit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ class phpbb_db_migration_v308rc1 extends phpbb_db_migration
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
array('config.add', array('load_unreads_search', 1)),
|
array('config.add', array('load_unreads_search', 1)),
|
||||||
array('config.update_if', array(600, 'queue_interval', 60)),
|
array('config.update_if_equals', array(600, 'queue_interval', 60)),
|
||||||
array('config.update_if', array(50, 'email_package_size', 20)),
|
array('config.update_if_equals', array(50, 'email_package_size', 20)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue