mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 15:05:43 +02:00
[ticket/15911] Prevent errors when trying to delete from non-existent tables
This can happen when migrating to the latest version from versions before 3.0.14. PHPBB3-15911
This commit is contained in:
parent
5a21f7eb97
commit
a2407ce978
@ -666,8 +666,29 @@ function user_delete($mode, $user_ids, $retain_username = true)
|
|||||||
delete_posts('poster_id', $user_ids);
|
delete_posts('poster_id', $user_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE, PRIVMSGS_FOLDER_TABLE, PRIVMSGS_RULES_TABLE, $phpbb_container->getParameter('tables.auth_provider_oauth_token_storage'), $phpbb_container->getParameter('tables.auth_provider_oauth_states'), $phpbb_container->getParameter('tables.auth_provider_oauth_account_assoc'));
|
$table_ary = [
|
||||||
|
USERS_TABLE,
|
||||||
|
USER_GROUP_TABLE,
|
||||||
|
TOPICS_WATCH_TABLE,
|
||||||
|
FORUMS_WATCH_TABLE,
|
||||||
|
ACL_USERS_TABLE,
|
||||||
|
TOPICS_TRACK_TABLE,
|
||||||
|
TOPICS_POSTED_TABLE,
|
||||||
|
FORUMS_TRACK_TABLE,
|
||||||
|
PROFILE_FIELDS_DATA_TABLE,
|
||||||
|
MODERATOR_CACHE_TABLE,
|
||||||
|
DRAFTS_TABLE,
|
||||||
|
BOOKMARKS_TABLE,
|
||||||
|
SESSIONS_KEYS_TABLE,
|
||||||
|
PRIVMSGS_FOLDER_TABLE,
|
||||||
|
PRIVMSGS_RULES_TABLE,
|
||||||
|
$phpbb_container->getParameter('tables.auth_provider_oauth_token_storage'),
|
||||||
|
$phpbb_container->getParameter('tables.auth_provider_oauth_states'),
|
||||||
|
$phpbb_container->getParameter('tables.auth_provider_oauth_account_assoc')
|
||||||
|
];
|
||||||
|
|
||||||
|
// Ignore errors on deleting from non-existent tables, e.g. when migrating
|
||||||
|
$db->sql_return_on_error(true);
|
||||||
// Delete the miscellaneous (non-post) data for the user
|
// Delete the miscellaneous (non-post) data for the user
|
||||||
foreach ($table_ary as $table)
|
foreach ($table_ary as $table)
|
||||||
{
|
{
|
||||||
@ -675,6 +696,7 @@ function user_delete($mode, $user_ids, $retain_username = true)
|
|||||||
WHERE " . $user_id_sql;
|
WHERE " . $user_id_sql;
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
$db->sql_return_on_error();
|
||||||
|
|
||||||
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user