Fill in error messages related to Queue configuration

This commit is contained in:
Kijin Sung 2024-10-10 23:30:54 +09:00
parent 61b9f57196
commit 0fd3b42885
3 changed files with 18 additions and 6 deletions

View file

@ -60,11 +60,11 @@ class Queue extends Base
$driver = trim($vars->queue_driver);
if (!array_key_exists($driver, $drivers))
{
throw new Exception('1111');
throw new Exception('msg_queue_driver_not_found');
}
if ($enabled && (!$driver || $driver === 'dummy'))
{
throw new Exception('2222');
throw new Exception('msg_queue_driver_cannot_be_dummy');
}
// Validate required and optional driver settings.
@ -74,7 +74,7 @@ class Queue extends Base
$conf_value = trim($vars->{'queue_' . $driver . '_' . $conf_name} ?? '');
if ($conf_value === '')
{
throw new Exception('3333');
throw new Exception('msg_queue_invalid_config');
}
$driver_config[$conf_name] = $conf_value === '' ? null : $conf_value;
}
@ -88,21 +88,21 @@ class Queue extends Base
$interval = intval($vars->queue_interval ?? 1);
if ($interval < 1 || $interval > 10)
{
throw new Exception('4444');
throw new Exception('msg_queue_invalid_interval');
}
// Validate the process count.
$process_count = intval($vars->queue_process_count ?? 1);
if ($process_count < 1 || $process_count > 10)
{
throw new Exception('4444');
throw new Exception('msg_queue_invalid_process_count');
}
// Validate the key.
$key = trim($vars->queue_key ?? '');
if (strlen($key) < 16 || !ctype_alnum($key))
{
throw new Exception('5555');
throw new Exception('msg_queue_invalid_key');
}
// Save system config.

View file

@ -306,6 +306,12 @@ $lang->msg_queue_instructions['webcron'] = 'Configure an external cron service t
$lang->msg_queue_instructions['systemd1'] = 'Put the following content in <code>/etc/systemd/system/rhymix-queue.service</code>';
$lang->msg_queue_instructions['systemd2'] = 'Put the following content in <code>/etc/systemd/system/rhymix-queue.timer</code>';
$lang->msg_queue_instructions['systemd3'] = 'Execute the following commands to enable the timer, and monitor your journal to make sure that it is operating as scheduled.';
$lang->msg_queue_driver_not_found = 'Invalid task queue driver';
$lang->msg_queue_driver_cannot_be_dummy = 'In otder to use the task queue, you must select a driver other than "Not use"';
$lang->msg_queue_invalid_config = 'Missing or invalid configuration for the selected queue driver.';
$lang->msg_queue_invalid_interval = 'The calling interval must be between 1 and 10 minutes.';
$lang->msg_queue_invalid_process_count = 'The process count must be between 1 and 10.';
$lang->msg_queue_invalid_key = 'The webcron auth key must be at least 16 characters long, and only consist of alphanumeric characters.';
$lang->autoinstall = 'EasyInstall';
$lang->last_week = 'Last Week';
$lang->this_week = 'This Week';

View file

@ -302,6 +302,12 @@ $lang->msg_queue_instructions['webcron'] = '아래의 URL을 1분 간격 또는
$lang->msg_queue_instructions['systemd1'] = '<code>/etc/systemd/system/rhymix-queue.service</code> 파일에 아래와 같은 내용을 넣습니다.';
$lang->msg_queue_instructions['systemd2'] = '<code>/etc/systemd/system/rhymix-queue.timer</code> 파일에 아래와 같은 내용을 넣습니다.';
$lang->msg_queue_instructions['systemd3'] = '아래의 명령을 실행하여 타이머를 활성화하고, 정상 작동하는지 모니터링하십시오.';
$lang->msg_queue_driver_not_found = '지원하지 않는 비동기 드라이버입니다.';
$lang->msg_queue_driver_cannot_be_dummy = '비동기 작업을 사용하려면 "미사용" 이외의 드라이버를 선택해야 합니다.';
$lang->msg_queue_invalid_config = '비동기 드라이버의 필수 설정이 누락되었습니다.';
$lang->msg_queue_invalid_interval = '호출 간격은 1~10분 이내여야 합니다.';
$lang->msg_queue_invalid_process_count = '프로세스 갯수는 1~10개 이내여야 합니다.';
$lang->msg_queue_invalid_key = '웹크론 인증키는 16자 이상으로, 알파벳 대소문자와 숫자만으로 이루어져야 합니다.';
$lang->autoinstall = '쉬운 설치';
$lang->last_week = '지난주';
$lang->this_week = '이번주';