ApiOpenStudio PHPDoc

Install extends Script
in package
Uses HandleExceptionTrait

Class Install

Script to set-up the ApiOpenStudio database.

Table of Contents

$argMap  : array<string|int, mixed>
The command argument map array.
$arguments  : array<string|int, mixed>
The command arguments array.
$config  : Config
$db  : ADOConnection
$exec  : string
The current executed argument.
$flags  : array<string|int, mixed>
The command flags array.
$options  : array<string|int, mixed>
The command options array.
__construct()  : mixed
Install constructor.
createAdminUser()  : mixed
Create administrator user.
createDatabase()  : mixed
Create the database, user and permissions.
createLink()  : mixed
Connect to the database.
createResources()  : mixed
Add the Core resources to the DB.
createTables()  : mixed
Create the tables and populate them with initial Core data.
createUser()  : mixed
Create the database, user and permissions.
dropDatabase()  : mixed
Drop a database.
dropUser()  : mixed
Drop a suser with all their privileges.
exec()  : void
Execute the function.
generateJwtKeys()  : mixed
Generate the JWT keys.
importOpenApi()  : mixed
Import OpenApi schema into applications and resources.
load()  : void
Load arguments for the function.
useDatabase()  : mixed
Use a database.
handleException()  : void
Handle exceptions for CLI in a generic way.
help()  : void
Abstract function help.
readlineTerminal()  : false|string
Fetch a parameter from the command line.
timeToDie()  : void
Helper function to die.
getArgs()  : void
Parse and store arguments.
getValues()  : void
Either store value as single value or array of values
validateAllowed()  : void
Validate all supplied arguments are allowed.
validateFlags()  : void
Validate supplied flags.
validateMultiple()  : void
Validate any supplied arguments with multiple values are allowed.
validateOptions()  : void
Validate supplied options.
validatePermitted()  : void
Validate against any permitted value restrictions.
validateRequired()  : void
Validate all required options are present.

Properties

$argMap

The command argument map array.

protected array<string|int, mixed> $argMap = ['options' => [], 'flags' => []]

Command argument map.

$arguments

The command arguments array.

protected array<string|int, mixed> $arguments

Command args.

$db

protected ADOConnection $db

database connection.

$exec

The current executed argument.

protected string $exec

Current executed arg.

$flags

The command flags array.

protected array<string|int, mixed> $flags

Command flags.

$options

The command options array.

protected array<string|int, mixed> $options

Command options.

Methods

__construct()

Install constructor.

public __construct() : mixed
Return values
mixed

createAdminUser()

Create administrator user.

public createAdminUser([string $username = '' ][, string $password = '' ][, string $email = '' ]) : mixed
Parameters
$username : string = ''

Admin user username.

$password : string = ''

Admin user password.

$email : string = ''

Admin user email.

Return values
mixed

createDatabase()

Create the database, user and permissions.

public createDatabase([string|null $database = null ]) : mixed
Parameters
$database : string|null = null

Database name to create.

Return values
mixed

Connect to the database.

public createLink([string|null $driver = null ][, string|null $host = null ][, string|null $database = null ][, string|null $username = null ][, string|null $password = null ]) : mixed
Parameters
$driver : string|null = null

Database driver.

$host : string|null = null

Database host.

$database : string|null = null

Database name.

$username : string|null = null

Database username.

$password : string|null = null

Database password.

Return values
mixed

createResources()

Add the Core resources to the DB.

public createResources([string|null $basePath = null ][, string|null $dirResources = null ]) : mixed
Parameters
$basePath : string|null = null

Base path to the Codebase.

$dirResources : string|null = null

Path to the resources directory, relative to basePath.

Return values
mixed

createTables()

Create the tables and populate them with initial Core data.

public createTables([string|null $basePath = null ][, string|null $definitionPath = null ][, bool|null $includeTest = null ]) : mixed
Parameters
$basePath : string|null = null

Base path to the Codebase.

$definitionPath : string|null = null

Path to the resource definitions, relative to basePath.

$includeTest : bool|null = null

Create the Test account, application and user.

Return values
mixed

createUser()

Create the database, user and permissions.

public createUser([string|null $database = null ][, string|null $username = null ][, string|null $password = null ]) : mixed
Parameters
$database : string|null = null

Database name.

$username : string|null = null

Database username to create.

$password : string|null = null

Database password to create.

Return values
mixed

dropDatabase()

Drop a database.

public dropDatabase([string|null $database = null ]) : mixed
Parameters
$database : string|null = null

Database name to drop.

Return values
mixed

dropUser()

Drop a suser with all their privileges.

public dropUser([string|null $username = null ]) : mixed
Parameters
$username : string|null = null

Username to drop.

Return values
mixed

exec()

Execute the function.

public exec([array<string|int, mixed>|null $argv = null ]) : void
Parameters
$argv : array<string|int, mixed>|null = null

CLI args.

Return values
void

generateJwtKeys()

Generate the JWT keys.

public generateJwtKeys([null $generateKeys = null ]) : mixed
Parameters
$generateKeys : null = null

Force generation of keys.

Return values
mixed

importOpenApi()

Import OpenApi schema into applications and resources.

public importOpenApi([string|null $basePath = null ][, string|null $dirOpenapi = null ]) : mixed
Parameters
$basePath : string|null = null
$dirOpenapi : string|null = null
Return values
mixed

load()

Load arguments for the function.

public load(array<string|int, mixed> $argv) : void
Parameters
$argv : array<string|int, mixed>

CLI args.

Return values
void

useDatabase()

Use a database.

public useDatabase([string|null $database = null ]) : mixed
Parameters
$database : string|null = null

Name of the database.

Return values
mixed

help()

Abstract function help.

protected help() : void
Return values
void

readlineTerminal()

Fetch a parameter from the command line.

protected readlineTerminal([string $prompt = '' ]) : false|string
Parameters
$prompt : string = ''

Input prompt text.

Return values
false|string

Response in from the user.

timeToDie()

Helper function to die.

protected timeToDie(string|array<string|int, mixed> $msg) : void
Parameters
$msg : string|array<string|int, mixed>

Log message.

Return values
void

getArgs()

Parse and store arguments.

private getArgs(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>

Cli arguments.

Return values
void

getValues()

Either store value as single value or array of values

private getValues(mixed $index, mixed $value) : void
Parameters
$index : mixed

Option index.

$value : mixed

Option value.

Return values
void

validateAllowed()

Validate all supplied arguments are allowed.

private validateAllowed(string $name, mixed $index) : void
Parameters
$name : string

Arg name.

$index : mixed

Arg index.

Return values
void

validateFlags()

Validate supplied flags.

private validateFlags() : void
Return values
void

validateMultiple()

Validate any supplied arguments with multiple values are allowed.

private validateMultiple(string $name, mixed $value, mixed $index) : void
Parameters
$name : string

Arg name.

$value : mixed

Arg value.

$index : mixed

Arg index.

Return values
void

validateOptions()

Validate supplied options.

private validateOptions() : void
Return values
void

validatePermitted()

Validate against any permitted value restrictions.

private validatePermitted(string $name, mixed $value, mixed $index) : void
Parameters
$name : string

Arg name.

$value : mixed

Arg value.

$index : mixed

Arg index.

Return values
void

validateRequired()

Validate all required options are present.

private validateRequired(array<string|int, mixed> $opt, mixed $index) : void
Parameters
$opt : array<string|int, mixed>

Option name.

$index : mixed

Option index.

Return values
void

Search results