0
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2024-11-23 15:47:35 +00:00
RSS-Bridge_rss-bridge/lib/Debug.php
Dag 2acd415475
refactor: drop usage of Debug::log (#4202)
* refactor: drop usage of Debug::log

* lint
2024-08-08 04:31:47 +02:00

19 lines
575 B
PHP

<?php
class Debug
{
/**
* Convenience function for Configuration::getConfig('system', 'enable_debug_mode')
*/
public static function isEnabled(): bool
{
$ip = $_SERVER['REMOTE_ADDR'] ?? 'x.y.z.1';
$enableDebugMode = Configuration::getConfig('system', 'enable_debug_mode');
$debugModeWhitelist = Configuration::getConfig('system', 'debug_mode_whitelist') ?: [];
if ($enableDebugMode && ($debugModeWhitelist === [] || in_array($ip, $debugModeWhitelist))) {
return true;
}
return false;
}
}