mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-12 15:21:40 +09:00
Validate queue driver configuration before saving
This commit is contained in:
parent
0ee9747a22
commit
36af489b15
7 changed files with 80 additions and 6 deletions
|
|
@ -68,7 +68,7 @@ class Queue extends Base
|
|||
}
|
||||
|
||||
// Validate required and optional driver settings.
|
||||
$driver_config = array();
|
||||
$driver_config = [];
|
||||
foreach ($drivers[$driver]['required'] as $conf_name)
|
||||
{
|
||||
$conf_value = trim($vars->{'queue_' . $driver . '_' . $conf_name} ?? '');
|
||||
|
|
@ -105,6 +105,18 @@ class Queue extends Base
|
|||
throw new Exception('msg_queue_invalid_key');
|
||||
}
|
||||
|
||||
// Validate actual operation of the driver.
|
||||
$driver_class = '\\Rhymix\\Framework\\Drivers\\Queue\\' . $driver;
|
||||
if (!class_exists($driver_class) || !$driver_class::isSupported())
|
||||
{
|
||||
throw new Exception('msg_queue_driver_not_found');
|
||||
}
|
||||
if (!$driver_class::validateConfig($driver_config))
|
||||
{
|
||||
throw new Exception('msg_queue_driver_not_usable');
|
||||
}
|
||||
|
||||
|
||||
// Save system config.
|
||||
Config::set("queue.enabled", $enabled);
|
||||
Config::set("queue.driver", $driver);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue