diff options
-rw-r--r-- | phpBB/adm/style/acp_forums.html | 52 | ||||
-rw-r--r-- | phpBB/adm/style/progress_bar.html (renamed from phpBB/adm/style/search_index_progress_bar.html) | 0 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_forums.php | 105 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_search.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 31 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_template.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/acp/forums.php | 3 | ||||
-rw-r--r-- | phpBB/language/en/email/admin_activate.txt | 2 |
9 files changed, 179 insertions, 20 deletions
diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index 9b203023d4..adcc5d18ef 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -283,8 +283,40 @@ </form> +<!-- ELSEIF S_CONTINUE_SYNC --> + + <script type="text/javascript"> + <!-- + + var close_waitscreen = 0; + window.open('{UA_PROGRESS_BAR}', '_sync', 'height=240, resizable=yes, scrollbars=no, width=400'); + + //--> + </script> + + <h1>{L_FORUM_ADMIN}</h1> + + <p>{L_FORUM_ADMIN_EXPLAIN}</p> + + <p>{L_PROGRESS_EXPLAIN}</p> + <!-- ELSE --> + <script type="text/javascript"> + <!-- + + /** + * Popup search progress bar + */ + function popup_progress_bar() + { + var close_waitscreen = 0; + window.open('{UA_PROGRESS_BAR}', '_sync', 'height=240, resizable=yes, scrollbars=no, width=400'); + } + + //--> + </script> + <h1>{L_FORUM_ADMIN}</h1> <p>{L_FORUM_ADMIN_EXPLAIN}</p> @@ -297,12 +329,18 @@ <!-- ENDIF --> <!-- IF S_RESYNCED --> + <script language="javascript" type="text/javascript"> + <!-- + var close_waitscreen = 1; + //--> + </script> + <div class="successbox"> <h3>{L_NOTIFY}</h3> <p>{L_FORUM_RESYNCED}</p> </div> <!-- ENDIF --> - + <p><strong>{NAVIGATION}<!-- IF S_NO_FORUMS --> [<a href="{U_EDIT}">{L_EDIT}</a> | <a href="{U_DELETE}">{L_DELETE}</a><!-- IF not S_LINK --> | <a href="{U_SYNC}">{L_RESYNC}</a><!-- ENDIF --->]<!-- ENDIF --></strong></p> <!-- IF .forums --> @@ -320,20 +358,20 @@ <td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;"> <!-- IF forums.S_FIRST_ROW && not forums.S_LAST_ROW --> {ICON_MOVE_UP_DISABLED} - <a href="{forums.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a> + <a href="{forums.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a> <!-- ELSEIF not forums.S_FIRST_ROW && not forums.S_LAST_ROW--> <a href="{forums.U_MOVE_UP}">{ICON_MOVE_UP}</a> <a href="{forums.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a> - <!-- ELSEIF forums.S_LAST_ROW && not forums.S_FIRST_ROW --> + <!-- ELSEIF forums.S_LAST_ROW && not forums.S_FIRST_ROW --> <a href="{forums.U_MOVE_UP}">{ICON_MOVE_UP}</a> {ICON_MOVE_DOWN_DISABLED} <!-- ELSE --> {ICON_MOVE_UP_DISABLED} - {ICON_MOVE_DOWN_DISABLED} - <!-- ENDIF --> + {ICON_MOVE_DOWN_DISABLED} + <!-- ENDIF --> <a href="{forums.U_EDIT}">{ICON_EDIT}</a> <!-- IF not forums.S_FORUM_LINK --> - <a href="{forums.U_SYNC}">{ICON_SYNC}</a> + <a href="{forums.U_SYNC}" onclick="popup_progress_bar();">{ICON_SYNC}</a> <!-- ELSE --> {ICON_SYNC_DISABLED} <!-- ENDIF --> @@ -368,4 +406,4 @@ <!-- ENDIF --> -<!-- INCLUDE overall_footer.html -->
\ No newline at end of file +<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/adm/style/search_index_progress_bar.html b/phpBB/adm/style/progress_bar.html index ef9590119f..ef9590119f 100644 --- a/phpBB/adm/style/search_index_progress_bar.html +++ b/phpBB/adm/style/progress_bar.html diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 042f5c4e48..fe7f14b330 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -36,6 +36,14 @@ class acp_forums // Check additional permissions switch ($action) { + case 'progress_bar': + $start = request_var('start', 0); + $total = request_var('total', 0); + + $this->display_progress_bar($start, $total); + exit; + break; + case 'delete': if (!$auth->acl_get('a_forumdel')) @@ -308,7 +316,74 @@ class acp_forums trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - sync('forum', 'forum_id', $forum_id); + sync('forum', 'forum_id', $forum_id, false, true); + $cache->destroy('sql', FORUMS_TABLE); + + $url = $this->u_action . "&parent_id={$this->parent_id}&f=$forum_id&action=sync_topic"; + meta_refresh(0, $url); + + $sql = 'SELECT forum_topics_real + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', + 'UA_PROGRESS_BAR' => str_replace('&', '&', $this->u_action) . '&action=progress_bar', + 'S_CONTINUE_SYNC' => true, + 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['forum_topics_real'])) + ); + +// add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']); + + return; + + break; + + case 'sync_topic': + + @set_time_limit(0); + + $sql = 'SELECT forum_name, forum_topics_real + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row['forum_topics_real']) + { + $start = request_var('start', 0); + + $batch_size = 3000; + $end = $start + $batch_size; + + // Sync all topics in batch mode... + // topic_moved + sync('topic_approved', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, false); + sync('topic', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, true); + + if ($end < $row['forum_topics_real']) + { + $start += $batch_size; + + $url = $this->u_action . "&parent_id={$this->parent_id}&f=$forum_id&action=sync_topic&start=$start&total={$row['forum_topics_real']}"; + + meta_refresh(0, $url); + + $template->assign_vars(array( + 'U_PROGRESS_BAR' => $this->u_action . "&action=progress_bar&start=$start&total={$row['forum_topics_real']}", + 'UA_PROGRESS_BAR' => str_replace('&', '&', $this->u_action) . "&action=progress_bar&start=$start&total={$row['forum_topics_real']}", + 'S_CONTINUE_SYNC' => true, + 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $row['forum_topics_real'])) + ); + + return; + } + } + add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']); $cache->destroy('sql', FORUMS_TABLE); @@ -634,7 +709,7 @@ class acp_forums // Jumpbox $forum_box = make_forum_select($this->parent_id, false, false, false, false); //make_forum_select($this->parent_id); - if ($action == 'sync') + if ($action == 'sync' || $action == 'sync_topic') { $template->assign_var('S_RESYNCED', true); } @@ -716,7 +791,10 @@ class acp_forums 'NAVIGATION' => $navigation, 'FORUM_BOX' => $forum_box, 'U_SEL_ACTION' => $this->u_action, - 'U_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id) + 'U_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id, + + 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', + 'UA_PROGRESS_BAR' => str_replace('&', '&', $this->u_action) . '&action=progress_bar') ); } @@ -1564,6 +1642,27 @@ class acp_forums return $target['forum_name']; } + + /** + * Display progress bar for syncinc forums + */ + function display_progress_bar($start, $total) + { + global $template, $user; + + adm_page_header($user->lang['SYNC_IN_PROGRESS']); + + $template->set_filenames(array( + 'body' => 'progress_bar.html') + ); + + $template->assign_vars(array( + 'L_PROGRESS' => $user->lang['SYNC_IN_PROGRESS'], + 'L_PROGRESS_EXPLAIN' => ($start && $total) ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS']) + ); + + adm_page_footer(); + } } ?>
\ No newline at end of file diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 2ff1b778bb..ca6fab89db 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -441,7 +441,7 @@ class acp_search adm_page_header($user->lang[$l_type]); $template->set_filenames(array( - 'body' => 'search_index_progress_bar.html') + 'body' => 'progress_bar.html') ); $template->assign_vars(array( diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 7ce428a2b7..27e271dbb7 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1068,14 +1068,33 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } else { - if (!sizeof($where_ids)) + if (!$where_type) { - return; + $where_sql = ''; + $where_sql_and = 'WHERE'; + } + else if ($where_type == 'range') + { + // Only check a range of topics/forums. For instance: 'topic_id BETWEEN 1 AND 60' + $where_sql = 'WHERE (' . $mode{0} . ".$where_ids)"; + $where_sql_and = $where_sql . "\n\tAND"; } + else + { + // Do not sync the "global forum" + $where_ids = array_diff($where_ids, array(0)); - // $where_type contains the field for the where clause (forum_id, topic_id) - $where_sql = 'WHERE ' . $db->sql_in_set($mode{0} . '.' . $where_type, $where_ids); - $where_sql_and = $where_sql . "\n\tAND"; + if (!sizeof($where_ids)) + { + // Empty array with IDs. This means that we don't have any work to do. Just return. + return; + } + + // Limit the topics/forums we are syncing, use specific topic/forum IDs. + // $where_type contains the field for the where clause (forum_id, topic_id) + $where_sql = 'WHERE ' . $db->sql_in_set($mode{0} . '.' . $where_type, $where_ids); + $where_sql_and = $where_sql . "\n\tAND"; + } } switch ($mode) @@ -1129,7 +1148,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $where_sql_and t.topic_first_post_id = p.post_id"; $db->sql_query($sql); break; - + default: $sql = 'SELECT t.topic_id, p.post_approved FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index fccefa0552..e241c1e83e 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -339,7 +339,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_ID' => $row['forum_id'], 'FORUM_NAME' => $row['forum_name'], 'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), - 'TOPICS' => $row['forum_topics'], + 'TOPICS' => ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics'], $l_post_click_count => $post_click_count, 'FORUM_FOLDER_IMG' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : $user->img($folder_image, $folder_alt), 'FORUM_FOLDER_IMG_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : $user->img($folder_image, $folder_alt, false, '', 'src'), diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index f173e001cf..8dce06c0c7 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -214,7 +214,7 @@ class template_compile // There will be a number of occassions where we switch into and out of // PHP mode instantaneously. Rather than "burden" the parser with this // we'll strip out such occurences, minimising such switching - $template_php = str_replace(' ?><?php ', '', $template_php); + $template_php = str_replace(' ?><?php ', ' ', $template_php); return (!$no_echo) ? $template_php : "\$$echo_var .= '" . $template_php . "'"; } diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index acbcd516a4..176562199d 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -124,6 +124,9 @@ $lang = array_merge($lang, array( 'REDIRECT_ACL' => 'Now you are able to %sset permissions%s for this forum.', + 'SYNC_IN_PROGRESS' => 'Synchronizing forum', + 'SYNC_IN_PROGRESS_EXPLAIN' => 'Currently resyncing topic range %1$d/%2$d.', + 'TYPE_CAT' => 'Category', 'TYPE_FORUM' => 'Forum', 'TYPE_LINK' => 'Link', diff --git a/phpBB/language/en/email/admin_activate.txt b/phpBB/language/en/email/admin_activate.txt index 04c8275491..a168ff533c 100644 --- a/phpBB/language/en/email/admin_activate.txt +++ b/phpBB/language/en/email/admin_activate.txt @@ -1,4 +1,4 @@ -Subject: New user account +Subject: Activate user account Hello, |