mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-25 04:23:38 +01:00
Merge remote-tracking branch 'nickvergessen/ticket/10409' into develop
* nickvergessen/ticket/10409: [ticket/10409] Running database_update.php multiple times breaks the update
This commit is contained in:
commit
5cae822594
@ -2090,42 +2090,68 @@ function change_database_data(&$no_updates, $version)
|
||||
|
||||
// Changes from 3.1.0-dev to 3.1.0-A1
|
||||
case '3.1.0-dev':
|
||||
set_config('use_system_cron', 0);
|
||||
if (!isset($config['use_system_cron']))
|
||||
{
|
||||
set_config('use_system_cron', 0);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . GROUPS_TABLE . '
|
||||
SET group_teampage = 1
|
||||
WHERE group_type = ' . GROUP_SPECIAL . "
|
||||
AND group_name = 'ADMINISTRATORS'";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
$sql = 'UPDATE ' . GROUPS_TABLE . '
|
||||
SET group_teampage = 2
|
||||
WHERE group_type = ' . GROUP_SPECIAL . "
|
||||
AND group_name = 'GLOBAL_MODERATORS'";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
set_config('legend_sort_groupname', '0');
|
||||
set_config('teampage_multiple', '1');
|
||||
set_config('teampage_forums', '1');
|
||||
|
||||
$sql = 'SELECT group_id
|
||||
$sql = 'SELECT group_teampage
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_legend = 1
|
||||
ORDER BY group_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
WHERE group_teampage > 0';
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$added_groups_teampage = (bool) $db->sql_fetchfield('group_teampage');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$next_legend = 1;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
if (!$added_groups_teampage)
|
||||
{
|
||||
$sql = 'UPDATE ' . GROUPS_TABLE . '
|
||||
SET group_legend = ' . $next_legend . '
|
||||
WHERE group_id = ' . (int) $row['group_id'];
|
||||
SET group_teampage = 1
|
||||
WHERE group_type = ' . GROUP_SPECIAL . "
|
||||
AND group_name = 'ADMINISTRATORS'";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
$next_legend++;
|
||||
$sql = 'UPDATE ' . GROUPS_TABLE . '
|
||||
SET group_teampage = 2
|
||||
WHERE group_type = ' . GROUP_SPECIAL . "
|
||||
AND group_name = 'GLOBAL_MODERATORS'";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
}
|
||||
|
||||
if (!isset($config['use_system_cron']))
|
||||
{
|
||||
set_config('legend_sort_groupname', '0');
|
||||
set_config('teampage_multiple', '1');
|
||||
set_config('teampage_forums', '1');
|
||||
}
|
||||
|
||||
$sql = 'SELECT group_legend
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_teampage > 1';
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$updated_group_legend = (bool) $db->sql_fetchfield('group_teampage');
|
||||
$db->sql_freeresult($result);
|
||||
unset($next_legend);
|
||||
|
||||
if (!$updated_group_legend)
|
||||
{
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_legend = 1
|
||||
ORDER BY group_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$next_legend = 1;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$sql = 'UPDATE ' . GROUPS_TABLE . '
|
||||
SET group_legend = ' . $next_legend . '
|
||||
WHERE group_id = ' . (int) $row['group_id'];
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
$next_legend++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
unset($next_legend);
|
||||
}
|
||||
|
||||
// Install modules
|
||||
$modules_to_install = array(
|
||||
@ -2229,7 +2255,10 @@ function change_database_data(&$no_updates, $version)
|
||||
}
|
||||
|
||||
// Allow custom profile fields in pm templates
|
||||
set_config('load_cpf_pm', '0');
|
||||
if (!isset($config['load_cpf_pm']))
|
||||
{
|
||||
set_config('load_cpf_pm', '0');
|
||||
}
|
||||
|
||||
$no_updates = false;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user