Load, boot, and implement a front controller for an Elgg application.
More...
Load, boot, and implement a front controller for an Elgg application.
To run as PHP CLI server: php -S localhost:8888 /full/path/to/elgg/index.php
The full path is necessary to work around this: https://bugs.php.net/bug.php?id=55726
- Since
- 2.0.0
Definition at line 48 of file Application.php.
Constructor.
Upon construction, no actions are taken to load or boot Elgg.
- Parameters
-
InternalContainer | $internal_services | Elgg internal services |
Definition at line 118 of file Application.php.
Elgg\Application::allowPathRewrite |
( |
| ) |
|
Allow plugins to rewrite the path.
- Returns
- void
Definition at line 642 of file Application.php.
Elgg\Application::bootCore |
( |
| ) |
|
Bootstrap the Elgg engine, loads plugins, and calls initial system events.
This method loads the full Elgg engine, checks the installation state, and triggers a series of events to finish booting Elgg:
- plugins_load system
- plugins_boot system
- init system
- ready system
Please note that the Elgg session is started after all plugins are loader, there will therefore be no information about a logged user available until plugins_load,system event is complete.
If Elgg is not fully installed, the browser will be redirected to an installation page.
- Returns
- void
Definition at line 187 of file Application.php.
static Elgg\Application::elggDir |
( |
| ) |
|
|
static |
Returns a directory that points to the root of Elgg, but not necessarily the install root.
See self::root()
for that.
- Returns
- Directory
Definition at line 487 of file Application.php.
static Elgg\Application::factory |
( |
array |
$spec = [] | ) |
|
|
static |
Create a new application.
- Warning
- You generally want to use getInstance().
For normal operation, you must use setInstance() and optionally setGlobalConfig() to wire the application to Elgg's global API.
- Parameters
-
array | $spec | Specification for initial call. |
- Returns
- self
- Exceptions
-
Definition at line 255 of file Application.php.
Elgg\Application::getBootStatus |
( |
string |
$type | ) |
|
Retrieve the boot status of the application.
- Parameters
-
string | $type | status to check |
- Returns
- bool
- Since
- 4.3
Definition at line 200 of file Application.php.
Elgg\Application::getDb |
( |
| ) |
|
Get a Database wrapper for performing queries without booting Elgg.
If settings has not been loaded, it will be loaded to configure the DB connection.
- Note
- Before boot, the Database instance will not yet be bound to a Logger.
- Returns
Definition at line 226 of file Application.php.
static Elgg\Application::getInstance |
( |
| ) |
|
|
static |
Get the global Application instance.
If not set, it's auto-created and wired to $CONFIG.
- Returns
- Application|null
Definition at line 91 of file Application.php.
static Elgg\Application::getMigrationSettings |
( |
| ) |
|
|
static |
Returns configuration array for database migrations.
- Returns
- array
Definition at line 604 of file Application.php.
static Elgg\Application::getRequest |
( |
| ) |
|
|
static |
static Elgg\Application::getResponseTransport |
( |
| ) |
|
|
static |
Build a transport for sending responses.
- Returns
- ResponseTransport
Definition at line 728 of file Application.php.
static Elgg\Application::getStdErr |
( |
| ) |
|
|
static |
Load console error output interface.
- Returns
- OutputInterface
Definition at line 714 of file Application.php.
static Elgg\Application::getStdIn |
( |
| ) |
|
|
static |
Load console input interface.
- Returns
- InputInterface
Definition at line 686 of file Application.php.
static Elgg\Application::getStdOut |
( |
| ) |
|
|
static |
Load console output interface.
- Returns
- OutputInterface
Definition at line 701 of file Application.php.
static Elgg\Application::index |
( |
| ) |
|
|
static |
Elgg's front controller.
Handles basically all incoming URL requests.
- Returns
- Response|false True if Elgg will handle the request, false if the server should (PHP-CLI server)
Definition at line 389 of file Application.php.
static Elgg\Application::install |
( |
| ) |
|
|
static |
static Elgg\Application::isCli |
( |
| ) |
|
|
static |
Is application running in CLI.
- Returns
- bool
Definition at line 657 of file Application.php.
static Elgg\Application::isCoreLoaded |
( |
| ) |
|
|
static |
static Elgg\Application::loadCore |
( |
| ) |
|
|
static |
Define all Elgg global functions and constants, wire up boot events, but don't boot.
This includes all the .php files in engine/lib (not upgrades). If a script returns a function, it is queued and executed at the end.
- Returns
- void
Definition at line 134 of file Application.php.
static Elgg\Application::migrate |
( |
| ) |
|
|
static |
Runs database migrations.
- Exceptions
-
- Returns
- bool
Definition at line 573 of file Application.php.
static Elgg\Application::projectDir |
( |
| ) |
|
|
static |
Returns a directory that points to the project root, where composer is installed.
- Returns
- Directory
Definition at line 496 of file Application.php.
Build and send a response.
If application is booted, we will use the response factory service, otherwise we will prepare a non-cacheable response
- Parameters
-
ResponseBuilder | $builder | Response builder |
- Returns
- Response|null Sent response
Definition at line 353 of file Application.php.
static Elgg\Application::route |
( |
HttpRequest |
$request | ) |
|
|
static |
Route a request.
- Parameters
-
- Returns
- Response|false
Definition at line 316 of file Application.php.
Elgg\Application::run |
( |
| ) |
|
Routes the request, booting core if not yet booted.
- Returns
- Response|null|false False if Elgg wants the PHP CLI server to handle the request
Definition at line 398 of file Application.php.
Elgg\Application::setBootStatus |
( |
string |
$type, |
|
|
bool |
$status |
|
) |
| |
Sets the boot status.
- Parameters
-
string | $type | type of status to set |
bool | $status | value of the status |
- Returns
- void
- Since
- 4.3
Definition at line 213 of file Application.php.
static Elgg\Application::setGlobalConfig |
( |
Application |
$application | ) |
|
|
static |
Make the global $CONFIG a reference to this application's config service.
- Parameters
-
- Returns
- void
Definition at line 237 of file Application.php.
static Elgg\Application::setInstance |
( |
Application |
$application = null | ) |
|
|
static |
static Elgg\Application::start |
( |
| ) |
|
|
static |
static Elgg\Application::upgrade |
( |
| ) |
|
|
static |
Elgg upgrade script.
This script triggers any necessary upgrades. If the site has been upgraded to the most recent version of the code, no upgrades are run but the caches are flushed.
Upgrades use a table {db_prefix}upgrade_lock as a mutex to prevent concurrent upgrades.
The URL to forward to after upgrades are complete can be specified by setting $_GET['forward'] to a relative URL.
- Returns
- Response|false
Definition at line 532 of file Application.php.
Elgg\Application::$_instance |
|
static |
Elgg\Application::$boot_status |
|
protected |
Initial value:= [
'application_boot_completed' => false
Definition at line 79 of file Application.php.
Elgg\Application::$internal_services |
Elgg\Application::$public_services |
The documentation for this class was generated from the following file: