mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-31 13:50:23 +02:00
config: Use global constant for config files
The configuration files are currently hard-coded in the configuration classes and error messages. However, the implementation should not rely on specific details like the file name. Instead, the files should be part of the global definition. This commit introduces two global constants for the configuration files - FILE_CONFIG => 'config.ini.php' - FILE_CONFIG_DEFAULT => 'config.default.ini.php'
This commit is contained in:
@@ -16,19 +16,19 @@ class MemcachedCache implements CacheInterface {
|
||||
$host = Configuration::getConfig(get_called_class(), 'host');
|
||||
$port = Configuration::getConfig(get_called_class(), 'port');
|
||||
if (empty($host) && empty($port)) {
|
||||
returnServerError('Configuration for ' . get_called_class() . ' missing. Please check your config.ini.php');
|
||||
returnServerError('Configuration for ' . get_called_class() . ' missing. Please check your ' . FILE_CONFIG);
|
||||
} else if (empty($host)) {
|
||||
returnServerError('"host" param is not set for ' . get_called_class() . '. Please check your config.ini.php');
|
||||
returnServerError('"host" param is not set for ' . get_called_class() . '. Please check your ' . FILE_CONFIG);
|
||||
} else if (empty($port)) {
|
||||
returnServerError('"port" param is not set for ' . get_called_class() . '. Please check your config.ini.php');
|
||||
returnServerError('"port" param is not set for ' . get_called_class() . '. Please check your ' . FILE_CONFIG);
|
||||
} else if (!ctype_digit($port)) {
|
||||
returnServerError('"port" param is invalid for ' . get_called_class() . '. Please check your config.ini.php');
|
||||
returnServerError('"port" param is invalid for ' . get_called_class() . '. Please check your ' . FILE_CONFIG);
|
||||
}
|
||||
|
||||
$port = intval($port);
|
||||
|
||||
if ($port < 1 || $port > 65535) {
|
||||
returnServerError('"port" param is invalid for ' . get_called_class() . '. Please check your config.ini.php');
|
||||
returnServerError('"port" param is invalid for ' . get_called_class() . '. Please check your ' . FILE_CONFIG);
|
||||
}
|
||||
|
||||
$conn = new Memcached();
|
||||
|
Reference in New Issue
Block a user