PHP Class 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
Mostrar archivo Open project: elgg/elgg Class Usage Examples

Public Properties

Property Type Description
$_instance Application Reference to the loaded Application returned by elgg()

Public Methods

Method Description
__construct ( ServiceProvider $services ) Constructor
__get ( string $name ) : mixed Get an undefined property
bootCore ( ) : void Bootstrap the Elgg engine, loads plugins, and calls initial system events
elggDir ( ) : Elgg\Filesystem\Directory Returns a directory that points to the root of Elgg, but not necessarily the install root. See self::root() for that.
getDataPath ( ) : string Determine the Elgg data directory with trailing slash, save it to config, and return it
getDb ( ) : Database Get a Database wrapper for performing queries without booting Elgg
index ( ) : boolean Elgg's front controller. Handles basically all incoming URL requests.
install ( ) : void Renders a web UI for installing Elgg.
isTestingApplication ( ) : boolean Checks if the application is running in PHPUnit
loadCore ( ) : void Load all Elgg procedural code and wire up boot events, but don't boot
loadSettings ( ) : void Load settings.php
run ( ) : boolean Routes the request, booting core if not yet booted
setTestingApplication ( boolean $testing = true ) : void Flag this application as running for testing (PHPUnit)
start ( ) : self Start and boot the core
upgrade ( ) : void Elgg upgrade script.

Private Methods

Method Description
allowPathRewrite ( ) : void Allow plugins to rewrite the path.
create ( ) : self Creates a new, trivial instance of Elgg\Application and set it as the singleton instance.
setupPath ( ) : string Get the request URI and store it in $_GET['__elgg_uri']

Method Details

__construct() public method

Upon construction, no actions are taken to load or boot Elgg.
public __construct ( ServiceProvider $services )
$services Elgg\Di\ServiceProvider Elgg services provider

__get() public method

Get an undefined property
public __get ( string $name ) : mixed
$name string The property name accessed
return mixed

bootCore() public method

This method loads the full Elgg engine, checks the installation state, and triggers a series of events to finish booting Elgg: - {@elgg_event boot system} - {@elgg_event init system} - {@elgg_event ready system} If Elgg is not fully installed, the browser will be redirected to an installation page.
public bootCore ( ) : void
return void

elggDir() public static method

Returns a directory that points to the root of Elgg, but not necessarily the install root. See self::root() for that.
public static elggDir ( ) : Elgg\Filesystem\Directory
return Elgg\Filesystem\Directory

getDataPath() public static method

Determine the Elgg data directory with trailing slash, save it to config, and return it
public static getDataPath ( ) : string
return string

getDb() public method

If settings.php has not been loaded, it will be loaded to configure the DB connection.
public getDb ( ) : Database
return Elgg\Application\Database

index() public static method

Elgg's front controller. Handles basically all incoming URL requests.
public static index ( ) : boolean
return boolean True if Elgg will handle the request, false if the server should (PHP-CLI server)

install() public static method

Renders a web UI for installing Elgg.
public static install ( ) : void
return void

isTestingApplication() public static method

Checks if the application is running in PHPUnit
public static isTestingApplication ( ) : boolean
return boolean

loadCore() public method

This is used for internal testing purposes
public loadCore ( ) : void
return void

loadSettings() public method

This is done automatically during the boot process or before requesting a database object
See also: Config::loadSettingsFile
public loadSettings ( ) : void
return void

run() public method

Routes the request, booting core if not yet booted
public run ( ) : boolean
return boolean False if Elgg wants the PHP CLI server to handle the request

setTestingApplication() public static method

Flag this application as running for testing (PHPUnit)
public static setTestingApplication ( boolean $testing = true ) : void
$testing boolean Is testing application
return void

start() public static method

Start and boot the core
public static start ( ) : self
return self

upgrade() public static method

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.
public static upgrade ( ) : void
return void

Property Details

$_instance public_oe static_oe property

Reference to the loaded Application returned by elgg()
public static Application,elgg $_instance
return Application