class CoreApp extends InstalledApp

Server management/info app included with the framework.

Handles DB config, install, and getting/setting config/logs.

Properties

protected $API

Reference to the main API, for convenience

from  BaseApp
static private $metadata from  BaseApp
protected $config from  InstalledApp
protected $database from  InstalledApp

Methods

__construct(Main $API)

All apps are constructed when Andromeda runs

mixed
Run(Input $input)

Checks if the client is running/needs to run install/upgrade {@inheritDoc}

static array
getUsage()

Returns an array of strings showing the CLI usage of the app

static string
getName()

No description

static string|null
getLogClass()

Return this app's BaseAppLog class name, if used (or null)

static 
getMetadata(string $app, string $key)

Loads a metadata for the given app with the given key

from  BaseApp
static array
getAppRequires(string $app)

No description

from  BaseApp
static string
getAppApiVersion(string $app)

No description

from  BaseApp
static string
getVersion()

No description

commit()

Tells the app to commit any changes made outside the database

from  BaseApp
rollback()

Tells the app to rollback any changes made outside the database

from  BaseApp
static string
getInstallFlags()

No description

static string
getUpgradeFlags()

No description

static array
getInstallUsage()

No description

static string
getConfigClass()

Return the BaseConfig class for this app

bool
allowInstall()

Returns true if the user is allowed to install/upgrade

static string
getTemplateFolder()

Returns the path of the app's code folder

static array
getUpgradeScripts()

No description

Install(Input $input)

Installs the app by importing its SQL file and creating config

Upgrade(Input $input)

Iterates over the list of upgrade scripts, running them sequentially until the DB is up to date with the code

GetConfig()

No description

array
GetUsages(Input $input)

Collects usage strings from every installed app and returns them

string|null
ConfigDB(Input $input, bool $isAdmin)

Creates a database config with the given input

array
ListApps(Input $input, bool $isAdmin)

No description

void
PHPInfo(Input $input, bool $isAdmin)

Prints the phpinfo() page

array
ServerInfo(Input $input, bool $isAdmin)

Gets miscellaneous server identity information

void
TestMail(Input $input, bool $isAdmin, $authenticator, AccessLog|null $accesslog)

Sends a test email via a given mailer

array
EnableApp(Input $input, bool $isAdmin, AccessLog|null $accesslog)

Registers (enables) an app

array
DisableApp(Input $input, bool $isAdmin, AccessLog|null $accesslog)

Unregisters (disables) an app

array
RunGetConfig(Input $input, bool $isAdmin)

Loads server config

array
GetDBConfig(Input $input, bool $isAdmin)

Loads server DB config

array
RunSetConfig(Input $input, bool $isAdmin, AccessLog|null $accesslog)

Sets server config

array
GetMailers(Input $input, bool $isAdmin)

Returns a list of the configured mailers

array
CreateMailer(Input $input, bool $isAdmin, $authenticator, AccessLog|null $accesslog)

Creates a new emailer config

void
DeleteMailer(Input $input, bool $isAdmin, AccessLog|null $accesslog)

Deletes a configured emailer

array
GetErrors(Input $input, bool $isAdmin)

Returns the server error log, possibly filtered

int
CountErrors(Input $input, bool $isAdmin)

Counts server error log entries, possibly filtered

array
GetRequests(Input $input, bool $isAdmin)

Returns all request logs matching the given input

int
CountRequests(Input $input, bool $isAdmin)

Counts all request logs matching the given input

array
GetAllActions(Input $input, bool $isAdmin)

Returns all action logs matching the given input

int
CountAllActions(Input $input, bool $isAdmin)

Counts all action logs matching the given input

array
GetActions(Input $input, bool $isAdmin)

Returns all app action logs matching the given input

int
CountActions(Input $input, bool $isAdmin)

Counts all app action logs matching the given input

Details

in InstalledApp at line 126
__construct(Main $API)

All apps are constructed when Andromeda runs

Parameters

Main $API

at line 120
mixed Run(Input $input)

Checks if the client is running/needs to run install/upgrade {@inheritDoc}

Parameters

Input $input

the user input

Return Value

mixed

the value to be output to the user

Exceptions

InstallRequiredException

if the DB is not installed

UpgradeRequiredException

if the DB version does not match

See also

\Andromeda\Apps\Core\BaseApp::Run()

at line 71
static array getUsage()

Returns an array of strings showing the CLI usage of the app

Return Value

array

possible commands

at line 41
static string getName()

No description

Return Value

string

the lowercase name of the app

at line 43
static protected string|null getLogClass()

Return this app's BaseAppLog class name, if used (or null)

Return Value

string|null

in BaseApp at line 59
static protected getMetadata(string $app, string $key)

Loads a metadata for the given app with the given key

Loads the app's JSON metadata file but not its code

Parameters

string $app
string $key

in BaseApp at line 77
static array getAppRequires(string $app)

No description

Parameters

string $app

Return Value

array

Returns the list of apps this app depends on

in BaseApp at line 83
static string getAppApiVersion(string $app)

No description

Parameters

string $app

Return Value

string

Returns the major.minor API version this app is compatible with

at line 49
static string getVersion()

No description

Return Value

string

the app's version information

in BaseApp at line 95
commit()

Tells the app to commit any changes made outside the database

in BaseApp at line 98
rollback()

Tells the app to rollback any changes made outside the database

in InstalledApp at line 107
static protected string getInstallFlags()

No description

Return Value

string

in InstalledApp at line 108
static protected string getUpgradeFlags()

No description

Return Value

string

at line 58
static protected array getInstallUsage()

No description

Return Value

array

at line 45
static protected string getConfigClass()

Return the BaseConfig class for this app

Return Value

string

in InstalledApp at line 144
protected bool allowInstall()

Returns true if the user is allowed to install/upgrade

Return Value

bool

at line 51
static protected string getTemplateFolder()

Returns the path of the app's code folder

Return Value

string

at line 53
static protected array getUpgradeScripts()

No description

Return Value

array

the array of upgrade scripts indexed by version (in order!)

at line 230
protected Install(Input $input)

Installs the app by importing its SQL file and creating config

Parameters

Input $input

See also

InstalledApp::Install

at line 257
protected Upgrade(Input $input)

Iterates over the list of upgrade scripts, running them sequentially until the DB is up to date with the code

Parameters

Input $input

See also

InstalledApp::Upgrade

at line 47
protected Config GetConfig()

No description

Return Value

Config

at line 195
protected array GetUsages(Input $input)

Collects usage strings from every installed app and returns them

Parameters

Input $input

Return Value

array

array of possible commands

at line 213
protected string|null ConfigDB(Input $input, bool $isAdmin)

Creates a database config with the given input

Parameters

Input $input
bool $isAdmin

Return Value

string|null

Exceptions

DatabaseFailException

if the config is invalid

at line 273
array ListApps(Input $input, bool $isAdmin)

No description

Parameters

Input $input
bool $isAdmin

Return Value

array

See also

\Andromeda\Apps\Core\Config::ListApps()

at line 282
protected void PHPInfo(Input $input, bool $isAdmin)

Prints the phpinfo() page

Parameters

Input $input
bool $isAdmin

Return Value

void

Exceptions

AdminRequiredException

if not admin-level access

at line 301
protected array ServerInfo(Input $input, bool $isAdmin)

Gets miscellaneous server identity information

Parameters

Input $input
bool $isAdmin

Return Value

array

{uname:string, server:[various], db:Database::getInfo()}

Exceptions

AdminRequiredException

if not admin-level access

See also

\Andromeda\Apps\Core\Database::getInfo()

at line 323
protected void TestMail(Input $input, bool $isAdmin, $authenticator, AccessLog|null $accesslog)

Sends a test email via a given mailer

Parameters

Input $input
bool $isAdmin
$authenticator
AccessLog|null $accesslog

Return Value

void

Exceptions

AdminRequiredException

if not an admin via the accounts app

UnknownMailerException

if the given mailer is invalid

MailSendFailException

if sending the email fails

at line 356
protected array EnableApp(Input $input, bool $isAdmin, AccessLog|null $accesslog)

Registers (enables) an app

Parameters

Input $input
bool $isAdmin
AccessLog|null $accesslog

Return Value

array

array of enabled apps

Exceptions

AdminRequiredException

if not an admin

at line 374
protected array DisableApp(Input $input, bool $isAdmin, AccessLog|null $accesslog)

Unregisters (disables) an app

Parameters

Input $input
bool $isAdmin
AccessLog|null $accesslog

Return Value

array

array of enabled apps

Exceptions

AdminRequiredException

if not an admin

at line 390
protected array RunGetConfig(Input $input, bool $isAdmin)

Loads server config

Parameters

Input $input
bool $isAdmin

Return Value

array

Config

See also

\Andromeda\Apps\Core\Config::GetClientObject()

at line 400
protected array GetDBConfig(Input $input, bool $isAdmin)

Loads server DB config

Parameters

Input $input
bool $isAdmin

Return Value

array

Database

See also

\Andromeda\Apps\Core\Database::GetClientObject()

at line 413
protected array RunSetConfig(Input $input, bool $isAdmin, AccessLog|null $accesslog)

Sets server config

Parameters

Input $input
bool $isAdmin
AccessLog|null $accesslog

Return Value

array

Config

Exceptions

AdminRequiredException

if not an admin

See also

\Andromeda\Apps\Core\Config::GetClientObject()

at line 426
protected array GetMailers(Input $input, bool $isAdmin)

Returns a list of the configured mailers

Parameters

Input $input
bool $isAdmin

Return Value

array

[id:Emailer]

Exceptions

AdminRequiredException

if not an admin

See also

\Andromeda\Apps\Core\Emailer::GetClientObject()

at line 440
protected array CreateMailer(Input $input, bool $isAdmin, $authenticator, AccessLog|null $accesslog)

Creates a new emailer config

Parameters

Input $input
bool $isAdmin
$authenticator
AccessLog|null $accesslog

Return Value

array

Emailer

Exceptions

AdminRequiredException

if not an admin

See also

\Andromeda\Apps\Core\Emailer::GetClientObject()

at line 463
protected void DeleteMailer(Input $input, bool $isAdmin, AccessLog|null $accesslog)

Deletes a configured emailer

Parameters

Input $input
bool $isAdmin
AccessLog|null $accesslog

Return Value

void

Exceptions

AdminRequiredException

if not an admin

UnknownMailerException

if given an invalid emailer

at line 482
protected array GetErrors(Input $input, bool $isAdmin)

Returns the server error log, possibly filtered

Parameters

Input $input
bool $isAdmin

Return Value

array

Exceptions

AdminRequiredException

if not an admin

at line 495
protected int CountErrors(Input $input, bool $isAdmin)

Counts server error log entries, possibly filtered

Parameters

Input $input
bool $isAdmin

Return Value

int

error log entry count

Exceptions

AdminRequiredException

if not an admin

at line 508
protected array GetRequests(Input $input, bool $isAdmin)

Returns all request logs matching the given input

Parameters

Input $input
bool $isAdmin

Return Value

array

RequestLog

Exceptions

AdminRequiredException

if not admin

See also

RequestLog::GetFullClientObject

at line 530
protected int CountRequests(Input $input, bool $isAdmin)

Counts all request logs matching the given input

Parameters

Input $input
bool $isAdmin

Return Value

int

log entry count

Exceptions

AdminRequiredException

if not admin

at line 543
protected array GetAllActions(Input $input, bool $isAdmin)

Returns all action logs matching the given input

Parameters

Input $input
bool $isAdmin

Return Value

array

ActionLog

Exceptions

AdminRequiredException

if not admin

See also

ActionLog::GetFullClientObject

at line 565
protected int CountAllActions(Input $input, bool $isAdmin)

Counts all action logs matching the given input

Parameters

Input $input
bool $isAdmin

Return Value

int

log entry count

Exceptions

AdminRequiredException

if not admin

at line 579
protected array GetActions(Input $input, bool $isAdmin)

Returns all app action logs matching the given input

Parameters

Input $input
bool $isAdmin

Return Value

array

BaseAppLog

Exceptions

AdminRequiredException

if not admin

InvalidAppException

if the given app is invalid

See also

BaseAppLog::GetFullClientObject

at line 609
protected int CountActions(Input $input, bool $isAdmin)

Counts all app action logs matching the given input

Parameters

Input $input
bool $isAdmin

Return Value

int

log entry count

Exceptions

AdminRequiredException

if not admin

InvalidAppException

if the given app is invalid