Logs
in package
implements
ActionInterface
Uses
BackwardCompatibility
Dispatcher to show various kinds of logs.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $prune_toggle : array<string|int, mixed>
- $subaction : string
- $subactions : array<string|int, mixed>
- $obj : object
- $backcompat : array<string|int, mixed>
Methods
- adminlog() : mixed
- Hands execution over to Modlog::call().
- adminLogs() : void|array<string|int, mixed>
- Backward compatibility wrapper.
- banlog() : mixed
- Hands execution over to Bans::log().
- call() : void
- Convenience method to load() and execute() an instance of this class.
- errorlog() : mixed
- Hands execution over to ErrorLog::view().
- execute() : void
- This function decides which log to load.
- exportStatic() : void
- Provides a way to export a class's public static properties and methods to global namespace.
- getConfigVars() : array<string|int, mixed>
- Gets the configuration variables for this admin area.
- load() : object
- Static wrapper for constructor.
- modlog() : mixed
- Hands execution over to Modlog::call().
- settings() : void|array<string|int, mixed>
- Allow to edit the settings on the pruning screen.
- spiderlog() : mixed
- Hands execution over to SearchEngines::logs().
- tasklog() : mixed
- Hands execution over to Tasks::log().
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
Properties
$prune_toggle
public
static array<string|int, mixed>
$prune_toggle
= ['pruneErrorLog', 'pruneModLog', 'pruneBanLog', 'pruneReportLog', 'pruneScheduledTaskLog', 'pruneSpiderHitLog']
Logs that can be toggled on or off for a nice user experience.
MOD AUTHORS: If you want to your log to be magically hidden when the 'pruning' option is off, use the integrate_prune_settings hook to add it to this list.
$subaction
public
string
$subaction
= 'errorlog'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['errorlog' => [
'',
'errorlog',
// At runtime, will be set to empty(Config::$modSettings['enableErrorLogging'])
'disabled' => 'enableErrorLogging',
], 'adminlog' => [
'',
'adminlog',
// At runtime, will be set to empty(Config::$modSettings['adminlog_enabled'])
'disabled' => 'adminlog_enabled',
], 'modlog' => [
'',
'modlog',
// At runtime, will be set to empty(Config::$modSettings['modlog_enabled'])
'disabled' => 'modlog_enabled',
], 'banlog' => ['', 'banlog'], 'spiderlog' => [
'',
'spiderlog',
// At runtime, will be set to empty(Config::$modSettings['spider_mode'])
'disabled' => 'spider_mode',
], 'tasklog' => ['', 'tasklog'], 'settings' => ['', 'settings']]
These are the logs they can load.
Format: 'sa' => array('file', 'function', 'disabled' => 'setting_to_check')
$obj
protected
static object
$obj
An instance of this class. This is used by the load() method to prevent mulitple instantiations.
$backcompat
private
static array<string|int, mixed>
$backcompat
= ['func_names' => ['adminLogs' => 'AdminLogs']]
BackwardCompatibility settings for this class.
Methods
adminlog()
Hands execution over to Modlog::call().
public
adminlog() : mixed
adminLogs()
Backward compatibility wrapper.
public
static adminLogs([bool $return_config = false ]) : void|array<string|int, mixed>
Parameters
- $return_config : bool = false
-
Whether to return the config_vars array.
Return values
void|array<string|int, mixed> —Returns nothing or returns the config_vars array.
banlog()
Hands execution over to Bans::log().
public
banlog() : mixed
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
errorlog()
Hands execution over to ErrorLog::view().
public
errorlog() : mixed
execute()
This function decides which log to load.
public
execute() : void
exportStatic()
Provides a way to export a class's public static properties and methods to global namespace.
public
static exportStatic() : void
To do so:
- Use this trait in the class.
- At the END of the class's file, call its exportStatic() method.
Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.
Regarding the $backcompat items:
A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].
$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.
$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.
Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.
getConfigVars()
Gets the configuration variables for this admin area.
public
static getConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the logs area.
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
modlog()
Hands execution over to Modlog::call().
public
modlog() : mixed
settings()
Allow to edit the settings on the pruning screen.
public
settings() : void|array<string|int, mixed>
Return values
void|array<string|int, mixed> —Returns nothing or returns the $config_vars array if $return_config is true
spiderlog()
Hands execution over to SearchEngines::logs().
public
spiderlog() : mixed
tasklog()
Hands execution over to Tasks::log().
public
tasklog() : mixed
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed