DumpCommands
extends AbstractCommands
in package
Provides commands to download and install dump files.
Table of Contents
- getConfigurationFile() : string
- Path to YAML configuration file containing command defaults.
- getWorkingDir() : string
- Returns the current working directory.
- initializeRuntimeConfiguration() : mixed
- Command initialization.
- toolkitCreateDump() : CollectionBuilder|int
- Export the local snapshot.
- toolkitDownloadDump() : CollectionBuilder
- Download ASDA snapshot.
- toolkitInstallDump() : CollectionBuilder|int
- Import the production snapshot.
- getBin() : string
- Validate and return the path to given bin.
- getBinPath() : string
- Return the path to given bin.
- getConfigValue() : mixed
- {@inheritdoc}
- getNodeBin() : string
- Validate and return the path to given bin from node packages.
- getNodeBinPath() : string
- Return the path to given bin from node packages.
- isSimulating() : bool
- Check if current command is being executed with option simulate.
- taskExecute() : mixed
- Execute a command.
- taskProcess() : Process|CollectionBuilder
- Process the file.
- taskReplaceBlock() : ReplaceBlock|CollectionBuilder
- Replace block in a file.
- asdaProcessFile() : array<string|int, mixed>
- Helper to download and process a ASDA file.
- checkForNewerDump() : bool
- Check if a newer dump exists on the server.
- generateAsdaWgetInputFile() : mixed
- Create a file containing the url to be used by wget --input-file option.
- getAsdaDate() : string
- Returns a human-readable date of the ASDA dump.
- taskImportDatabase() : CollectionBuilder|ExecStack
- Import given dump file, gunzip is used if dump ends with .gz.
- tmpDirectory() : string
- Return the tmp folder path, folder is created if missing.
- wgetDownloadFile() : CollectionBuilder|Exec
- Download the file present in the tmp file.
Methods
getConfigurationFile()
Path to YAML configuration file containing command defaults.
public
getConfigurationFile() : string
Return values
string —getWorkingDir()
Returns the current working directory.
public
getWorkingDir() : string
Return values
string —The current working directory.
initializeRuntimeConfiguration()
Command initialization.
public
initializeRuntimeConfiguration() : mixed
Tags
Return values
mixed —toolkitCreateDump()
Export the local snapshot.
public
toolkitCreateDump(ConsoleIO $io[, array<string|int, mixed> $options = ['dumpfile' => InputOption::VALUE_REQUIRED] ]) : CollectionBuilder|int
This command should be only used with the corporate docker image fpfis/httpd-php.
Parameters
- $io : ConsoleIO
- $options : array<string|int, mixed> = ['dumpfile' => InputOption::VALUE_REQUIRED]
-
Command options.
Tags
Return values
CollectionBuilder|int —Collection builder.
toolkitDownloadDump()
Download ASDA snapshot.
public
toolkitDownloadDump([array<string|int, mixed> $options = ['is-admin' => InputOption::VALUE_NONE, 'yes' => InputOption::VALUE_NONE] ]) : CollectionBuilder
Parameters
- $options : array<string|int, mixed> = ['is-admin' => InputOption::VALUE_NONE, 'yes' => InputOption::VALUE_NONE]
Tags
Return values
CollectionBuilder —Collection builder.
toolkitInstallDump()
Import the production snapshot.
public
toolkitInstallDump(ConsoleIO $io[, array<string|int, mixed> $options = ['dumpfile' => InputOption::VALUE_REQUIRED, 'myloader' => InputOption::VALUE_NONE] ]) : CollectionBuilder|int
Parameters
- $io : ConsoleIO
- $options : array<string|int, mixed> = ['dumpfile' => InputOption::VALUE_REQUIRED, 'myloader' => InputOption::VALUE_NONE]
-
Command options.
Tags
Return values
CollectionBuilder|int —Collection builder.
getBin()
Validate and return the path to given bin.
protected
getBin(string $name) : string
Parameters
- $name : string
-
The bin to look for.
Tags
Return values
string —The bin path.
getBinPath()
Return the path to given bin.
protected
getBinPath(string $name) : string
Parameters
- $name : string
Return values
string —The path to given binary.
getConfigValue()
{@inheritdoc}
protected
getConfigValue(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
Return values
mixed —getNodeBin()
Validate and return the path to given bin from node packages.
protected
getNodeBin(string $name) : string
Parameters
- $name : string
-
The bin to look for.
Tags
Return values
string —The bin path.
getNodeBinPath()
Return the path to given bin from node packages.
protected
getNodeBinPath(string $name) : string
Parameters
- $name : string
Return values
string —The path to given binary.
isSimulating()
Check if current command is being executed with option simulate.
protected
isSimulating() : bool
Return values
bool —True if using --simulate, false otherwise.
taskExecute()
Execute a command.
protected
taskExecute(array<string|int, mixed> $tasks) : mixed
Parameters
- $tasks : array<string|int, mixed>
-
An array with tasks to execute.
Return values
mixed —taskProcess()
Process the file.
protected
taskProcess(string $source[, string $destination = '' ]) : Process|CollectionBuilder
Parameters
- $source : string
-
The source file to process.
- $destination : string = ''
-
The destination file.
Return values
Process|CollectionBuilder —taskReplaceBlock()
Replace block in a file.
protected
taskReplaceBlock([string $filename = '' ]) : ReplaceBlock|CollectionBuilder
Parameters
- $filename : string = ''
-
The file to process.
Return values
ReplaceBlock|CollectionBuilder —asdaProcessFile()
Helper to download and process a ASDA file.
private
asdaProcessFile(string $link, string $service) : array<string|int, mixed>
Parameters
- $link : string
-
The link to the folder.
- $service : string
-
The service to use.
Return values
array<string|int, mixed> —The tasks to execute.
checkForNewerDump()
Check if a newer dump exists on the server.
private
checkForNewerDump(string $link, string $service) : bool
Parameters
- $link : string
-
The link to the folder.
- $service : string
-
The service to use.
Return values
bool —Return true if sha1 from local is different from the server, False is case of error or no local file exists.
generateAsdaWgetInputFile()
Create a file containing the url to be used by wget --input-file option.
private
generateAsdaWgetInputFile(string $url, string $tmp[, bool $silent = false ]) : mixed
Parameters
- $url : string
-
Url to fill in the temp file.
- $tmp : string
-
The temporary filename.
- $silent : bool = false
-
Whether show or not output from task.
Return values
mixed —getAsdaDate()
Returns a human-readable date of the ASDA dump.
private
getAsdaDate(string $filename) : string
Parameters
- $filename : string
-
The dump filename that contains the date.
Return values
string —The formatted date, fallback to filename if no date is found.
taskImportDatabase()
Import given dump file, gunzip is used if dump ends with .gz.
private
taskImportDatabase(string $dump) : CollectionBuilder|ExecStack
Parameters
- $dump : string
-
The path to the dump file.
Return values
CollectionBuilder|ExecStack —tmpDirectory()
Return the tmp folder path, folder is created if missing.
private
tmpDirectory() : string
Return values
string —The tmp folder path.
wgetDownloadFile()
Download the file present in the tmp file.
private
wgetDownloadFile(string $tmp, string $destination[, string|null $accept = null ][, bool $silent = false ]) : CollectionBuilder|Exec
Parameters
- $tmp : string
-
The temporary filename.
- $destination : string
-
The destination filename.
- $accept : string|null = null
-
A comma-separated list of accepted extensions.
- $silent : bool = false
-
Whether show or not output from task.