Fix #2057 add option to change or disable search division count

This commit is contained in:
Kijin Sung 2023-09-24 21:50:53 +09:00
parent 33b2c79891
commit 8b9b00652c
5 changed files with 23 additions and 2 deletions

View file

@ -56,6 +56,7 @@ class DocumentAdminController extends Document
$config->view_count_option = Context::get('view_count_option');
$config->icons = Context::get('icons');
$config->micons = Context::get('micons');
$config->search_division = intval(Context::get('search_division') ?? 5000);
// Get icon skin type
$config->icons_type = 'gif';

View file

@ -1526,7 +1526,16 @@ class DocumentModel extends Document
$args->sort_index = 'list_order';
}
// division search by 5,000
// search division
if($use_division)
{
$document_config = self::getDocumentConfig();
$division_count = $document_config->search_division ?? 5000;
if (!$division_count)
{
$use_division = false;
}
}
if($use_division)
{
$args->order_type = 'asc';
@ -1548,7 +1557,7 @@ class DocumentModel extends Document
// get end point of the division
if(Context::get('last_division') === null && $args->division)
{
$division_args->offset = 5000;
$division_args->offset = $division_count;
$division_args->list_order = $args->division;
$division_output = executeQuery('document.getDocumentDivision', $division_args)->data;
$args->last_division = $division_output ? $division_output->list_order : 0;

View file

@ -122,3 +122,5 @@ $lang->allow_vote_non_member = 'Allow voting by non-members';
$lang->allow_vote_cancel = 'Allow vote cancellation';
$lang->allow_declare_from_same_ip = 'Allow reporting from same IP';
$lang->allow_declare_cancel = 'Allow report cancellation';
$lang->cmd_search_division = 'Search division';
$lang->about_search_division = 'Divide search results into sections in order to reduce time and server load. Setting this value to 0 will disable divisions entirely.<br />Disabling divisions or using large values may cause serious problems such as timeouts or server overload. Values between 5000 and 10000 are recommended.';

View file

@ -122,3 +122,5 @@ $lang->allow_vote_non_member = '비회원 추천 허용';
$lang->allow_vote_cancel = '추천 취소 허용';
$lang->allow_declare_from_same_ip = '동일 IP 신고 허용';
$lang->allow_declare_cancel = '신고 취소 허용';
$lang->cmd_search_division = '검색 결과 분할';
$lang->about_search_division = '검색 소요시간과 서버 부하를 줄이기 위해 일정 갯수만큼 끊어서 검색합니다. 0으로 설정할 경우 분할하지 않습니다.<br />분할하지 않거나 지나치게 많은 게시물을 한 번에 검색하려고 하면 타임아웃, 서버 다운 등 심각한 부작용이 발생할 수 있으므로 5000~10000 내외를 권장합니다.';

View file

@ -41,6 +41,13 @@
<p id="micons_help" class="x_help-block">{$lang->about_cmd_mobile_icon_setting}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="search_division">{$lang->cmd_search_division}</label>
<div class="x_controls">
<input type="number" name="search_division" value="{$config->search_division ?? 5000}" />
<p class="x_help-block">{$lang->about_search_division}</p>
</div>
</div>
<div class="btnArea x_clearfix">
<span class="x_pull-right" style="margin-left:10px;"><input class="btn" type="button" value="{$lang->cmd_delete_all_thumbnail}" onclick="doDeleteAllThumbnail()"/></span>
<span class="x_pull-right"><input class="x_btn x_btn-primary" type="submit" value="{$lang->cmd_save}" /></span>