Elgg  Version 6.1
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
Elgg\Application Class Reference

Load, boot, and implement a front controller for an Elgg application. More...

Public Member Functions

 __construct (InternalContainer $internal_services)
 Constructor. More...
 
 bootCore ()
 Bootstrap the Elgg engine, loads plugins, and calls initial system events. More...
 
 getBootStatus (string $type)
 Retrieve the boot status of the application. More...
 
 setBootStatus (string $type, bool $status)
 Sets the boot status. More...
 
 getDb ()
 Get a Database wrapper for performing queries without booting Elgg. More...
 
 run ()
 Routes the request, booting core if not yet booted. More...
 
 allowPathRewrite ()
 Allow plugins to rewrite the path. More...
 

Static Public Member Functions

static getInstance ()
 Get the global Application instance. More...
 
static setInstance (Application $application=null)
 Set the global Application instance. More...
 
static loadCore ()
 Define all Elgg global functions and constants, wire up boot events, but don't boot. More...
 
static start ()
 Start and boot the core. More...
 
static isCoreLoaded ()
 Are Elgg's global functions loaded? More...
 
static setGlobalConfig (Application $application)
 Make the global $CONFIG a reference to this application's config service. More...
 
static factory (array $spec=[])
 Create a new application. More...
 
static route (HttpRequest $request)
 Route a request. More...
 
static respond (ResponseBuilder $builder)
 Build and send a response. More...
 
static index ()
 Elgg's front controller. More...
 
static install ()
 Renders a web UI for installing Elgg. More...
 
static upgrade ()
 Elgg upgrade script. More...
 
static migrate ()
 Runs database migrations. More...
 
static getMigrationSettings ()
 Returns configuration array for database migrations. More...
 
static isCli ()
 Is application running in CLI. More...
 
static getRequest ()
 Build request object. More...
 
static getStdIn ()
 Load console input interface. More...
 
static getStdOut ()
 Load console output interface. More...
 
static getStdErr ()
 Load console error output interface. More...
 
static getResponseTransport ()
 Build a transport for sending responses. More...
 

Public Attributes

 $internal_services
 
 $public_services
 

Static Public Attributes

static $_instance
 Reference to the loaded Application. More...
 

Protected Attributes

 $boot_status
 

Detailed Description

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

Definition at line 47 of file Application.php.

Constructor & Destructor Documentation

Elgg\Application::__construct ( InternalContainer  $internal_services)

Constructor.

Upon construction, no actions are taken to load or boot Elgg.

Parameters
InternalContainer$internal_servicesElgg internal services

Definition at line 117 of file Application.php.

Member Function Documentation

Elgg\Application::allowPathRewrite ( )

Allow plugins to rewrite the path.

Returns
void

Definition at line 622 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 186 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$specSpecification for initial call.
Returns
self
Exceptions
InvalidArgumentException

Definition at line 254 of file Application.php.

Elgg\Application::getBootStatus ( string  $type)

Retrieve the boot status of the application.

Parameters
string$typestatus to check
Returns
bool
Since
4.3

Definition at line 199 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 225 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 90 of file Application.php.

static Elgg\Application::getMigrationSettings ( )
static

Returns configuration array for database migrations.

Returns
array

Definition at line 584 of file Application.php.

static Elgg\Application::getRequest ( )
static

Build request object.

Returns

Definition at line 653 of file Application.php.

static Elgg\Application::getResponseTransport ( )
static

Build a transport for sending responses.

Returns
ResponseTransport

Definition at line 708 of file Application.php.

static Elgg\Application::getStdErr ( )
static

Load console error output interface.

Returns
OutputInterface

Definition at line 694 of file Application.php.

static Elgg\Application::getStdIn ( )
static

Load console input interface.

Returns
InputInterface

Definition at line 666 of file Application.php.

static Elgg\Application::getStdOut ( )
static

Load console output interface.

Returns
OutputInterface

Definition at line 681 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 388 of file Application.php.

static Elgg\Application::install ( )
static

Renders a web UI for installing Elgg.

Returns
Response|false

Definition at line 485 of file Application.php.

static Elgg\Application::isCli ( )
static

Is application running in CLI.

Returns
bool

Definition at line 637 of file Application.php.

static Elgg\Application::isCoreLoaded ( )
static

Are Elgg's global functions loaded?

Returns
bool

Definition at line 163 of file Application.php.

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 133 of file Application.php.

static Elgg\Application::migrate ( )
static

Runs database migrations.

Exceptions
InstallationException
Returns
bool

Definition at line 553 of file Application.php.

static Elgg\Application::respond ( ResponseBuilder  $builder)
static

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$builderResponse builder
Returns
Response|null Sent response

Definition at line 352 of file Application.php.

static Elgg\Application::route ( HttpRequest  $request)
static

Route a request.

Parameters
HttpRequest$requestRequest
Returns
Response|false

Definition at line 315 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 397 of file Application.php.

Elgg\Application::setBootStatus ( string  $type,
bool  $status 
)

Sets the boot status.

Parameters
string$typetype of status to set
bool$statusvalue of the status
Returns
void
Since
4.3

Definition at line 212 of file Application.php.

static Elgg\Application::setGlobalConfig ( Application  $application)
static

Make the global $CONFIG a reference to this application's config service.

Parameters
Application$applicationThe Application
Returns
void

Definition at line 236 of file Application.php.

static Elgg\Application::setInstance ( Application  $application = null)
static

Set the global Application instance.

Parameters
Application$applicationGlobal application
Returns
void

Definition at line 106 of file Application.php.

static Elgg\Application::start ( )
static

Start and boot the core.

Returns
self

Definition at line 151 of file Application.php.

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 512 of file Application.php.

Member Data Documentation

Elgg\Application::$_instance
static

Reference to the loaded Application.

Definition at line 71 of file Application.php.

Elgg\Application::$boot_status
protected
Initial value:
= [
'application_boot_completed' => false

Definition at line 78 of file Application.php.

Elgg\Application::$internal_services

Definition at line 56 of file Application.php.

Elgg\Application::$public_services

Definition at line 63 of file Application.php.


The documentation for this class was generated from the following file: