ArangoRestoreTrait uses trait:short, trait:short
The command to manage an ArangoDB database.
Table of Contents
Constants
- ARANGO_RESTORE : string = 'arangorestore'
- The arango restore command.
Properties
- $database : string|null
- The ArangoDB database name.
- $endpoint : string|null
- The ArangoDB database endpoint.
- $password : string|null
- The ArangoDB database password.
- $username : string|null
- The ArangoDB database username.
Methods
- arangoRestore() : int
- Run the 'arangorestore' command to restore the ArangoDB database.
- assertDatabase() : void
- Assert the database reference.
- assertEndpoint() : void
- Assert the passed-in endpoint reference.
- assertPassword() : void
- Assert the passed-in password reference.
- assertUsername() : void
- Assert the passed-in username reference.
- getArangoRestoreArguments() : array<int, string>
- Builds the `arangorestore` argument vector (argv[0] = binary name).
- getDatabase() : string
- Returns the database name and asserts the existence of the value.
- getEndpoint() : string
- Returns the database endpoint and throws an error if not set.
- getPassword() : string
- Returns the database password and throws an error if not set.
- getUsername() : string
- Returns the database username and throws an error if not set.
- initializeArangoDB() : static
- Initialize the arangodb components.
- optionsToArguments() : array<int, string>
- Converts an {@see Options} object into a flat argument vector, using the same flag mapping as the string serializer (prefix + {@see Option::getCommandOption()}), but keeping each value as its own `argv` entry instead of quoting it into a shell string.
- runProcess() : int
- Runs an external process from an argument vector, without a shell.
Constants
ARANGO_RESTORE
The arango restore command.
public
string
ARANGO_RESTORE
= 'arangorestore'
Properties
$database
The ArangoDB database name.
protected
string|null
$database
= null
$endpoint
The ArangoDB database endpoint.
protected
string|null
$endpoint
= null
$password
The ArangoDB database password.
protected
string|null
$password
= null
$username
The ArangoDB database username.
protected
string|null
$username
= null
Methods
arangoRestore()
Run the 'arangorestore' command to restore the ArangoDB database.
public
arangoRestore([array<string|int, mixed>|ArangoRestoreOptions|null $options = null ][, bool $silent = false ]) : int
Parameters
- $options : array<string|int, mixed>|ArangoRestoreOptions|null = null
-
The arangorestore options definition.
- $silent : bool = false
-
Indicates if the command is invoked silently.
Tags
Return values
intassertDatabase()
Assert the database reference.
public
assertDatabase(string|null $database) : void
Parameters
- $database : string|null
Tags
assertEndpoint()
Assert the passed-in endpoint reference.
public
assertEndpoint(string|null $endpoint) : void
Parameters
- $endpoint : string|null
Tags
assertPassword()
Assert the passed-in password reference.
public
assertPassword(string|null $password) : void
Parameters
- $password : string|null
Tags
assertUsername()
Assert the passed-in username reference.
public
assertUsername(string|null $username) : void
Parameters
- $username : string|null
Tags
getArangoRestoreArguments()
Builds the `arangorestore` argument vector (argv[0] = binary name).
public
getArangoRestoreArguments([array<string|int, mixed>|ArangoRestoreOptions|null $options = null ]) : array<int, string>
The vector is executed without a shell (see ArangoProcessTrait::runProcess()), so option values are passed verbatim and never re-interpreted.
Parameters
- $options : array<string|int, mixed>|ArangoRestoreOptions|null = null
Tags
Return values
array<int, string>getDatabase()
Returns the database name and asserts the existence of the value.
public
getDatabase() : string
Tags
Return values
stringgetEndpoint()
Returns the database endpoint and throws an error if not set.
public
getEndpoint() : string
Tags
Return values
stringgetPassword()
Returns the database password and throws an error if not set.
public
getPassword() : string
Tags
Return values
stringgetUsername()
Returns the database username and throws an error if not set.
public
getUsername() : string
Tags
Return values
stringinitializeArangoDB()
Initialize the arangodb components.
public
initializeArangoDB([array<string|int, mixed> $init = [] ]) : static
Parameters
- $init : array<string|int, mixed> = []
Return values
staticoptionsToArguments()
Converts an {@see Options} object into a flat argument vector, using the same flag mapping as the string serializer (prefix + {@see Option::getCommandOption()}), but keeping each value as its own `argv` entry instead of quoting it into a shell string.
protected
static optionsToArguments(Options $options, Option> $optionClass) : array<int, string>
- array value → the flag is repeated for each item (
--collection a --collection b); - boolean true → the bare flag (
--create-collection); - boolean false → flag followed by the literal
false; - scalar value → flag followed by the value, as a single argv entry.
Null and empty values are dropped (handled by Options::toArray()).
Parameters
- $options : Options
-
The options to serialize.
- $optionClass : Option>
-
The Option subclass providing the flag mapping.
Tags
Return values
array<int, string>runProcess()
Runs an external process from an argument vector, without a shell.
protected
static runProcess(array<int, string> $arguments[, bool $silent = false ]) : int
stdin/stdout/stderr are inherited from the parent process so the
native arangodump / arangorestore progress output stays visible,
unless $silent redirects stdout/stderr to the null device.
Parameters
- $arguments : array<int, string>
-
The argv (argv[0] = binary name).
- $silent : bool = false
-
Whether to discard the process output.
Tags
Return values
int —The process exit code.