mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-13 12:35:06 +01: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
@ -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 -->
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -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(
|
||||
|
@ -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
|
||||
|
@ -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'),
|
||||
|
@ -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 . "'";
|
||||
}
|
||||
|
@ -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',
|
||||
|
@ -1,4 +1,4 @@
|
||||
Subject: New user account
|
||||
Subject: Activate user account
|
||||
|
||||
Hello,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user