mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
- fixing a bug i am unsure about when it occurs (but it occurs). The symptoms are broken template cache files if after removing unnecessary php opening/closing tags result in statements being syntactially incorrect.
- added real syncing to forums acp (not only forum statistics rebuild) git-svn-id: file:///svn/phpbb/trunk@6419 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
e4fc191e0d
commit
b08c54f35e
9 changed files with 179 additions and 20 deletions
|
@ -283,8 +283,40 @@
|
||||||
|
|
||||||
</form>
|
</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 -->
|
<!-- 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>
|
<h1>{L_FORUM_ADMIN}</h1>
|
||||||
|
|
||||||
<p>{L_FORUM_ADMIN_EXPLAIN}</p>
|
<p>{L_FORUM_ADMIN_EXPLAIN}</p>
|
||||||
|
@ -297,6 +329,12 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF S_RESYNCED -->
|
<!-- IF S_RESYNCED -->
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
var close_waitscreen = 1;
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class="successbox">
|
<div class="successbox">
|
||||||
<h3>{L_NOTIFY}</h3>
|
<h3>{L_NOTIFY}</h3>
|
||||||
<p>{L_FORUM_RESYNCED}</p>
|
<p>{L_FORUM_RESYNCED}</p>
|
||||||
|
@ -333,7 +371,7 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<a href="{forums.U_EDIT}">{ICON_EDIT}</a>
|
<a href="{forums.U_EDIT}">{ICON_EDIT}</a>
|
||||||
<!-- IF not forums.S_FORUM_LINK -->
|
<!-- 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 -->
|
<!-- ELSE -->
|
||||||
{ICON_SYNC_DISABLED}
|
{ICON_SYNC_DISABLED}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -36,6 +36,14 @@ class acp_forums
|
||||||
// Check additional permissions
|
// Check additional permissions
|
||||||
switch ($action)
|
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':
|
case 'delete':
|
||||||
|
|
||||||
if (!$auth->acl_get('a_forumdel'))
|
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);
|
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']);
|
add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']);
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
$cache->destroy('sql', FORUMS_TABLE);
|
||||||
|
|
||||||
|
@ -634,7 +709,7 @@ class acp_forums
|
||||||
// Jumpbox
|
// Jumpbox
|
||||||
$forum_box = make_forum_select($this->parent_id, false, false, false, false); //make_forum_select($this->parent_id);
|
$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);
|
$template->assign_var('S_RESYNCED', true);
|
||||||
}
|
}
|
||||||
|
@ -716,7 +791,10 @@ class acp_forums
|
||||||
'NAVIGATION' => $navigation,
|
'NAVIGATION' => $navigation,
|
||||||
'FORUM_BOX' => $forum_box,
|
'FORUM_BOX' => $forum_box,
|
||||||
'U_SEL_ACTION' => $this->u_action,
|
'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'];
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -441,7 +441,7 @@ class acp_search
|
||||||
adm_page_header($user->lang[$l_type]);
|
adm_page_header($user->lang[$l_type]);
|
||||||
|
|
||||||
$template->set_filenames(array(
|
$template->set_filenames(array(
|
||||||
'body' => 'search_index_progress_bar.html')
|
'body' => 'progress_bar.html')
|
||||||
);
|
);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
|
|
@ -1068,15 +1068,34 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!$where_type)
|
||||||
|
{
|
||||||
|
$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));
|
||||||
|
|
||||||
if (!sizeof($where_ids))
|
if (!sizeof($where_ids))
|
||||||
{
|
{
|
||||||
|
// Empty array with IDs. This means that we don't have any work to do. Just return.
|
||||||
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_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 = 'WHERE ' . $db->sql_in_set($mode{0} . '.' . $where_type, $where_ids);
|
||||||
$where_sql_and = $where_sql . "\n\tAND";
|
$where_sql_and = $where_sql . "\n\tAND";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -339,7 +339,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
'FORUM_ID' => $row['forum_id'],
|
'FORUM_ID' => $row['forum_id'],
|
||||||
'FORUM_NAME' => $row['forum_name'],
|
'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']),
|
'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,
|
$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' => ($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'),
|
'FORUM_FOLDER_IMG_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : $user->img($folder_image, $folder_alt, false, '', 'src'),
|
||||||
|
|
|
@ -124,6 +124,9 @@ $lang = array_merge($lang, array(
|
||||||
|
|
||||||
'REDIRECT_ACL' => 'Now you are able to %sset permissions%s for this forum.',
|
'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_CAT' => 'Category',
|
||||||
'TYPE_FORUM' => 'Forum',
|
'TYPE_FORUM' => 'Forum',
|
||||||
'TYPE_LINK' => 'Link',
|
'TYPE_LINK' => 'Link',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Subject: New user account
|
Subject: Activate user account
|
||||||
|
|
||||||
Hello,
|
Hello,
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue