mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/9613] Implement a load switch for unread posts search feature.
Since unread posts search can produce a high server load in certain circumstances, we implement a switch for ACP "Load settings" to have an option to disable this type of search. PHPBB3-9613
This commit is contained in:
parent
dbe8fb6488
commit
f1d5005797
7 changed files with 18 additions and 5 deletions
|
@ -319,6 +319,7 @@ class acp_board
|
||||||
'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
'load_unreads_search' => array('lang' => 'YES_UNREADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||||
'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||||
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||||
'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
|
|
@ -4465,6 +4465,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||||
'S_ENABLE_FEEDS_TOPICS_ACTIVE' => ($config['feed_topics_active']) ? true : false,
|
'S_ENABLE_FEEDS_TOPICS_ACTIVE' => ($config['feed_topics_active']) ? true : false,
|
||||||
'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false,
|
'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false,
|
||||||
|
|
||||||
|
'S_LOAD_UNREADS' => ($config['load_unreads_search']) ? true : false,
|
||||||
|
|
||||||
'T_THEME_PATH' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme',
|
'T_THEME_PATH' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme',
|
||||||
'T_TEMPLATE_PATH' => "{$web_path}styles/" . $user->theme['template_path'] . '/template',
|
'T_TEMPLATE_PATH' => "{$web_path}styles/" . $user->theme['template_path'] . '/template',
|
||||||
'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . $user->theme['template_inherit_path'] . '/template' : "{$web_path}styles/" . $user->theme['template_path'] . '/template',
|
'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . $user->theme['template_inherit_path'] . '/template' : "{$web_path}styles/" . $user->theme['template_path'] . '/template',
|
||||||
|
|
|
@ -375,6 +375,7 @@ $lang = array_merge($lang, array(
|
||||||
'YES_POST_MARKING_EXPLAIN' => 'Indicates whether user has posted to a topic.',
|
'YES_POST_MARKING_EXPLAIN' => 'Indicates whether user has posted to a topic.',
|
||||||
'YES_READ_MARKING' => 'Enable server-side topic marking',
|
'YES_READ_MARKING' => 'Enable server-side topic marking',
|
||||||
'YES_READ_MARKING_EXPLAIN' => 'Stores read/unread status information in the database rather than a cookie.',
|
'YES_READ_MARKING_EXPLAIN' => 'Stores read/unread status information in the database rather than a cookie.',
|
||||||
|
'YES_UNREADS' => 'Enable search of unread posts',
|
||||||
));
|
));
|
||||||
|
|
||||||
// Auth settings
|
// Auth settings
|
||||||
|
|
|
@ -62,6 +62,7 @@ $lang = array_merge($lang, array(
|
||||||
'NO_SEARCH' => 'Sorry but you are not permitted to use the search system.',
|
'NO_SEARCH' => 'Sorry but you are not permitted to use the search system.',
|
||||||
'NO_SEARCH_RESULTS' => 'No suitable matches were found.',
|
'NO_SEARCH_RESULTS' => 'No suitable matches were found.',
|
||||||
'NO_SEARCH_TIME' => 'Sorry but you cannot use search at this time. Please try again in a few minutes.',
|
'NO_SEARCH_TIME' => 'Sorry but you cannot use search at this time. Please try again in a few minutes.',
|
||||||
|
'NO_SEARCH_UNREADS' => 'Sorry but search for unread posts is not permitted.',
|
||||||
'WORD_IN_NO_POST' => 'No posts were found because the word <strong>%s</strong> is not contained in any post.',
|
'WORD_IN_NO_POST' => 'No posts were found because the word <strong>%s</strong> is not contained in any post.',
|
||||||
'WORDS_IN_NO_POST' => 'No posts were found because the words <strong>%s</strong> are not contained in any post.',
|
'WORDS_IN_NO_POST' => 'No posts were found because the words <strong>%s</strong> are not contained in any post.',
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,18 @@ if ($search_id == 'egosearch')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for unread posts needs user to be logged in if topics tracking for guests is disabled
|
// Search for unread posts needs to be allowed and user to be logged in if topics tracking for guests is disabled
|
||||||
if ($search_id == 'unreadposts' && !$config['load_anon_lastread'] && !$user->data['is_registered'])
|
if ($search_id == 'unreadposts')
|
||||||
{
|
{
|
||||||
|
if (!$config['load_unreads_search'])
|
||||||
|
{
|
||||||
|
$template->assign_var('S_NO_SEARCH', true);
|
||||||
|
trigger_error('NO_SEARCH_UNREADS');
|
||||||
|
}
|
||||||
|
else if (!$config['load_anon_lastread'] && !$user->data['is_registered'])
|
||||||
|
{
|
||||||
login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']);
|
login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is user able to search? Has search been disabled?
|
// Is user able to search? Has search been disabled?
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<!-- IF S_DISPLAY_SEARCH or (S_USER_LOGGED_IN and not S_IS_BOT) -->
|
<!-- IF S_DISPLAY_SEARCH or (S_USER_LOGGED_IN and not S_IS_BOT) -->
|
||||||
<ul class="linklist">
|
<ul class="linklist">
|
||||||
<!-- IF S_DISPLAY_SEARCH -->
|
<!-- IF S_DISPLAY_SEARCH -->
|
||||||
<li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_USER_LOGGED_IN --> • <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a> • <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> • <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
|
<li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_USER_LOGGED_IN --><!-- IF S_LOAD_UNREADS --> • <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ENDIF --> • <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> • <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
|
<!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -202,7 +202,7 @@ function marklist(id, name, state)
|
||||||
<p class="searchbar">
|
<p class="searchbar">
|
||||||
<span style="float: {S_CONTENT_FLOW_BEGIN};"><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a> | <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></span>
|
<span style="float: {S_CONTENT_FLOW_BEGIN};"><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a> | <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></span>
|
||||||
<!-- IF S_USER_LOGGED_IN -->
|
<!-- IF S_USER_LOGGED_IN -->
|
||||||
<span style="float: {S_CONTENT_FLOW_END};"><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a> | <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a></span>
|
<span style="float: {S_CONTENT_FLOW_END};"><!-- IF S_LOAD_UNREADS --><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a> | <!-- ENDIF --><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a></span>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</p>
|
</p>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue