Skip to content

Commit

Permalink
IPAccess nun auch deaktivierbar
Browse files Browse the repository at this point in the history
  • Loading branch information
dergel committed Mar 15, 2024
1 parent 5f96725 commit 49cea95
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/IPAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ final class IPAccess
/** @var string */
private const config_name = 'config/ip_access_config.json';

public static bool $active = true;
public static bool $forceInactivity = false;

/**
* @throws rex_exception
*/
public static function init(): void
{
if (!self::$active) {
if ('cli' === PHP_SAPI) {
return;
}

if (self::$forceInactivity) {
return;
}

Expand All @@ -50,7 +54,7 @@ public static function init(): void
});
}

if ('cli' === PHP_SAPI) {
if (!self::isActive()) {
return;
}

Expand Down Expand Up @@ -279,4 +283,10 @@ public static function isActive(string $envirement = 'frontend'): bool

return false;
}

public static function forceInactivity(bool $forceInactivity = true): void
{
self::$forceInactivity = $forceInactivity;
}

}

0 comments on commit 49cea95

Please sign in to comment.