Elgg  Version 4.3
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 elggDir ()
 Returns a directory that points to the root of Elgg, but not necessarily the install root. More...
 
static projectDir ()
 Returns a directory that points to the project root, where composer is installed. 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

Since
2.0.0

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

Member Function Documentation

Elgg\Application::allowPathRewrite ( )

Allow plugins to rewrite the path.

Returns
void

Definition at line 651 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 496 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

The time with microseconds when the Elgg engine was started.

float

Definition at line 257 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 201 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 228 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 612 of file Application.php.

static Elgg\Application::getRequest ( )
static

Build request object.

Returns

Definition at line 680 of file Application.php.

static Elgg\Application::getResponseTransport ( )
static

Build a transport for sending responses.

Returns
ResponseTransport

Definition at line 731 of file Application.php.

static Elgg\Application::getStdErr ( )
static

Load console error output interface.

Returns
OutputInterface

Definition at line 718 of file Application.php.

static Elgg\Application::getStdIn ( )
static

Load console input interface.

Returns
InputInterface

Definition at line 692 of file Application.php.

static Elgg\Application::getStdOut ( )
static

Load console output interface.

Returns
OutputInterface

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

static Elgg\Application::install ( )
static

Renders a web UI for installing Elgg.

Returns
Response|false

Definition at line 514 of file Application.php.

static Elgg\Application::isCli ( )
static

Is application running in CLI.

Returns
bool

Definition at line 665 of file Application.php.

static Elgg\Application::isCoreLoaded ( )
static

Are Elgg's global functions loaded?

Returns
bool

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

static Elgg\Application::migrate ( )
static

Runs database migrations.

Exceptions
InstallationException
Returns
bool

Definition at line 582 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 505 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|false Sent response

Definition at line 358 of file Application.php.

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

Route a request.

Parameters
HttpRequest$requestRequest
Returns
Response|false

Definition at line 321 of file Application.php.

Elgg\Application::run ( )

Routes the request, booting core if not yet booted.

Returns
Response|false False if Elgg wants the PHP CLI server to handle the request
Exceptions
PageNotFoundException

Definition at line 404 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 215 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 239 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 107 of file Application.php.

static Elgg\Application::start ( )
static

Start and boot the core.

Returns
self

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

Member Data Documentation

Elgg\Application::$_instance
static

Reference to the loaded Application.

Definition at line 72 of file Application.php.

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

Definition at line 79 of file Application.php.

Elgg\Application::$internal_services

Definition at line 57 of file Application.php.

Elgg\Application::$public_services

Definition at line 64 of file Application.php.


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