loadStaticConfig()
Load configuration from config.php
loadStaticConfig() : array<string|int, mixed>
This function die() if a config parameter is wrong.
Return values
array<string|int, mixed>
—
wkx_session_set_db_handler()
Set a db handler for session storage in session table
wkx_session_set_db_handler() : mixed
The creation of the identifiers is left to PHP.
-
see
-
https://www.php.net/manual/en/function.session-set-save-handler.php
wkx_session_set_file_handler()
Set the default file handler for session storage
wkx_session_set_file_handler() : mixed
wkx_session_open()
The open callback works like a constructor in classes and is executed when the session is being opened.
wkx_session_open(string $savePath, string $sessionName) : bool
It is the first callback function executed when the session is started automatically or manually with session_start().
Return value is true for success, false for failure.
Parameters
-
$savePath
: string
-
-
$sessionName
: string
-
wkx_session_close()
The close callback works like a destructor in classes and is executed after the session write callback has been called.
wkx_session_close() : bool
It is also invoked when session_write_close() is called.
Return value should be true for success, false for failure.
wkx_session_read()
The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.
wkx_session_read(string $sessionId) : string
This callback is called internally by PHP when the session starts or when session_start() is called.
Before this callback is invoked PHP will invoke the open callback.
The value this callback returns must be in exactly the same serialized format that was originally passed for storage
to the write callback. The value returned will be unserialized automatically by PHP and used to populate the $_SESSION superglobal.
While the data looks similar to serialize() please note it is a different format which is specified in the session.serialize_handler ini setting.
Parameters
-
$sessionId
: string
-
wkx_session_write()
The write callback is called when the session needs to be saved and closed.
wkx_session_write(string $sessionId, string $sessionData) : bool
This callback receives the current session ID a serialized version the $_SESSION superglobal.
The serialization method used internally by PHP is specified in the session.serialize_handler ini setting.
The serialized session data passed to this callback should be stored against the passed session ID.
When retrieving this data, the read callback must return the exact value that was originally passed to the write callback.
This callback is invoked when PHP shuts down or explicitly when session_write_close() is called.
Note that after executing this function PHP will internally execute the close callback.
Parameters
-
$sessionId
: string
-
-
$sessionData
: string
-
wkx_session_destroy()
This callback is executed when a session is destroyed with session_destroy() or with session_regenerate_id() with the destroy parameter set to true.
wkx_session_destroy(string $sessionId) : bool
Return value should be true for success, false for failure.
Parameters
-
$sessionId
: string
-
wkx_session_gc()
The garbage collector callback is invoked internally by PHP periodically in order to purge old session data.
wkx_session_gc(int $maxSessionLifetime) : bool
The frequency is controlled by WIKINDX_SESSION_GC_FREQUENCY.
The value of lifetime which is passed to this callback is a fallback set in session.gc_maxlifetime.
The real value of lifetime is:
- WIKINDX_SESSION_AUTH_MAXLIFETIME for sessions which have been authenticated at least once.
- WIKINDX_SESSION_AUTH_REMEMBERME_MAXLIFETIME for sessions which have been authenticated at least once with a "Remember Me" flag.
- WIKINDX_SESSION_NOTAUTH_MAXLIFETIME for sessions which have never been authenticated.
Return value should be true for success, false for failure.
Parameters
-
$maxSessionLifetime
: int
-
wkx_error_handler()
Custom PHP errors handler
wkx_error_handler(int $errno, string $errstr, string $errfile, int $errline) : bool
cf. https://www.php.net/manual/fr/function.set-error-handler.php
The $errcontext parameter is not used because it is deprecated since PHP 7.2
It is no longer possible to know the context of the error. Instead
we use the debug_print_backtrace() function.
NB: fatal errors like ‘parse error’ are still written in the log
defined by error_log php.ini option because this handler cannot be called in that case.
Parameters
-
$errno
: int
-
-
$errstr
: string
-
-
$errfile
: string
-
File or script where the error occurred
-
$errline
: int
-
wkx_error_log()
Write a message to the application log
wkx_error_log(mixed $Message) : void
When the application is not yet configured,
the message is written to the log defined by php.ini.
Parameters
-
$Message
: mixed
-
wkx_clear_error_log()
Remove expired error logs (14 days max) and limit their size to 25 MB by file
wkx_clear_error_log() : mixed
buildUpgradePage()
buildUpgradePage(string $body) : mixed
Parameters
-
$body
: string
-