MaintenanceManager
in package
Manages maintenance mode state and operations.
Table of Contents
Properties
- $_maintenanceFilePath : string
Methods
- __construct() : mixed
- disable() : bool
- Disable maintenance mode
- enable() : bool
- Enable maintenance mode
- getMessage() : string
- Get the maintenance message
- getRetryAfter() : int|null
- Get the retry-after value
- getStatus() : array<string|int, mixed>|null
- Get current maintenance status and configuration
- isEnabled() : bool
- Check if maintenance mode is currently enabled
- isIpAllowed() : bool
- Check if a specific IP address is allowed during maintenance
- ipInCidr() : bool
- Check if an IP address is within a CIDR range
- readMaintenanceFile() : array<string|int, mixed>
- Read maintenance file
- writeMaintenanceFile() : bool
- Write maintenance file
Properties
$_maintenanceFilePath
private
string
$_maintenanceFilePath
Methods
__construct()
public
__construct(string $basePath) : mixed
Parameters
- $basePath : string
-
Application base path
disable()
Disable maintenance mode
public
disable([string|null $disabledBy = null ]) : bool
Parameters
- $disabledBy : string|null = null
-
User who disabled maintenance mode
Return values
bool —Success status
enable()
Enable maintenance mode
public
enable([string $message = 'Site is currently under maintenance. Please check back soon.' ][, array<string|int, mixed>|null $allowedIps = null ][, int|null $retryAfter = null ][, string|null $enabledBy = null ]) : bool
Parameters
- $message : string = 'Site is currently under maintenance. Please check back soon.'
-
Custom maintenance message
- $allowedIps : array<string|int, mixed>|null = null
-
List of allowed IP addresses (null = use defaults)
- $retryAfter : int|null = null
-
Retry-After header value in seconds
- $enabledBy : string|null = null
-
User who enabled maintenance mode
Return values
bool —Success status
getMessage()
Get the maintenance message
public
getMessage() : string
Return values
stringgetRetryAfter()
Get the retry-after value
public
getRetryAfter() : int|null
Return values
int|nullgetStatus()
Get current maintenance status and configuration
public
getStatus() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullisEnabled()
Check if maintenance mode is currently enabled
public
isEnabled() : bool
Return values
boolisIpAllowed()
Check if a specific IP address is allowed during maintenance
public
isIpAllowed(string $ipAddress) : bool
Parameters
- $ipAddress : string
Return values
boolipInCidr()
Check if an IP address is within a CIDR range
private
ipInCidr(string $ipAddress, string $cidr) : bool
Parameters
- $ipAddress : string
-
IP address to check
- $cidr : string
-
CIDR notation (e.g., "192.168.1.0/24")
Return values
boolreadMaintenanceFile()
Read maintenance file
private
readMaintenanceFile() : array<string|int, mixed>
Return values
array<string|int, mixed>writeMaintenanceFile()
Write maintenance file
private
writeMaintenanceFile(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>