diff options
Diffstat (limited to 'phpBB/install')
-rw-r--r-- | phpBB/install/database_update.php | 40 | ||||
-rw-r--r-- | phpBB/install/install_install.php | 4 |
2 files changed, 42 insertions, 2 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 6097341ace..c700b483a5 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2026,7 +2026,7 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.10-RC3 to 3.0.10 case '3.0.10-RC3': break; - + // Changes from 3.0.10 to 3.0.11-RC1 case '3.0.10': // Updates users having current style a deactivated one @@ -2050,6 +2050,44 @@ function change_database_data(&$no_updates, $version) _sql($sql, $errored, $error_ary); } + // Delete orphan private messages + $batch_size = 500; + + $sql_array = array( + 'SELECT' => 'p.msg_id', + 'FROM' => array( + PRIVMSGS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(PRIVMSGS_TO_TABLE => 't'), + 'ON' => 'p.msg_id = t.msg_id', + ), + ), + 'WHERE' => 't.user_id IS NULL', + ); + $sql = $db->sql_build_query('SELECT', $sql_array); + + do + { + $result = $db->sql_query_limit($sql, $batch_size); + + $delete_pms = array(); + while ($row = $db->sql_fetchrow($result)) + { + $delete_pms[] = (int) $row['msg_id']; + } + $db->sql_freeresult($result); + + if (!empty($delete_pms)) + { + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_pms); + _sql($sql, $errored, $error_ary); + } + } + while (sizeof($delete_pms) == $batch_size); + $no_updates = false; break; } diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 35fc0bb58e..8e3fe0387c 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -53,11 +53,13 @@ class install_install extends module function main($mode, $sub) { - global $lang, $template, $language, $phpbb_root_path; + global $lang, $template, $language, $phpbb_root_path, $cache; switch ($sub) { case 'intro': + $cache->purge(); + $this->page_title = $lang['SUB_INTRO']; $template->assign_vars(array( |