DumpCommands
extends AbstractCommands
in package
Provides commands to download and install dump files.
Table of Contents
Methods
- getConfigurationFile() : mixed
- Path to YAML configuration file containing command defaults.
- getJson() : array<string|int, mixed>
- Returns the JSON parsed content.
- getWorkingDir() : string
- Returns the current working directory.
- isWebsiteInstalled() : bool
- Check if the website is installed.
- toolkitCreateDump() : CollectionBuilder|int
- Export the local snapshot.
- toolkitDownloadDump() : mixed
- Download database 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() : mixed
- Process the file.
- taskReplaceBlock() : mixed
- Replace block in a file.
- addAuthToUrl() : string
- Prepare given URL to include the user and pass/token.
- asdaProcessFile() : array<string|int, mixed>
- Helper to download and process a Nextcloud dump file.
- customCheckNewerDump() : bool
- Check if a newer dump exists on the Custom server.
- customDownloadDump() : mixed
- Download the dumpfile from the custom server.
- getAsdaDate() : string
- Returns a human-readable date of the ASDA dump.
- nextcloudCheckNewerDump() : bool
- Check if a newer dump exists on the Nextcloud server.
- nextcloudDownloadDump() : mixed
- Download the available services from Nextcloud.
- taskImportDatabase() : mixed
- 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() : mixed
- Download the file present in the tmp file.
- wgetGenerateInputFile() : mixed
- Create a file containing the url to be used by wget --input-file option.
- wgetGetFileModifiedDate() : mixed
- Get the modified date from the remote file.
Methods
getConfigurationFile()
Path to YAML configuration file containing command defaults.
public
getConfigurationFile() : mixed
getJson()
Returns the JSON parsed content.
public
getJson(string $filename[, mixed $throwException = true ]) : array<string|int, mixed>
Parameters
- $filename : string
- $throwException : mixed = true
Return values
array<string|int, mixed>getWorkingDir()
Returns the current working directory.
public
getWorkingDir() : string
Return values
string —The current working directory.
isWebsiteInstalled()
Check if the website is installed.
public
isWebsiteInstalled() : bool
Return values
booltoolkitCreateDump()
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 database snapshot.
public
toolkitDownloadDump(ConsoleIO $io[, array<string|int, mixed> $options = ['is-admin' => InputOption::VALUE_NONE, 'yes' => InputOption::VALUE_NONE] ]) : mixed
Parameters
- $io : ConsoleIO
- $options : array<string|int, mixed> = ['is-admin' => InputOption::VALUE_NONE, 'yes' => InputOption::VALUE_NONE]
Tags
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
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.
taskProcess()
Process the file.
protected
taskProcess(string $source[, string $destination = '' ]) : mixed
Parameters
- $source : string
-
The source file to process.
- $destination : string = ''
-
The destination file.
taskReplaceBlock()
Replace block in a file.
protected
taskReplaceBlock([string $filename = '' ]) : mixed
Parameters
- $filename : string = ''
-
The file to process.
addAuthToUrl()
Prepare given URL to include the user and pass/token.
private
addAuthToUrl(string $url, string $user, string $pass) : string
Parameters
- $url : string
-
The URL to process.
- $user : string
-
The user to be added to the URL.
- $pass : string
-
The password or token to be added to the URL.
Return values
stringasdaProcessFile()
Helper to download and process a Nextcloud dump 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.
customCheckNewerDump()
Check if a newer dump exists on the Custom server.
private
customCheckNewerDump(string $tmpFile, string $dumpfile) : bool
Parameters
- $tmpFile : string
-
The tmp file containing the url for the remote file.
- $dumpfile : string
-
The local dumpfile.
Return values
bool —Return true if the modified date is different between local and remote dumps, False is case of error or no local file exists.
customDownloadDump()
Download the dumpfile from the custom server.
private
customDownloadDump(ConsoleIO $io, array<string|int, mixed> $options) : mixed
Parameters
- $io : ConsoleIO
- $options : array<string|int, 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.
nextcloudCheckNewerDump()
Check if a newer dump exists on the Nextcloud server.
private
nextcloudCheckNewerDump(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.
nextcloudDownloadDump()
Download the available services from Nextcloud.
private
nextcloudDownloadDump(ConsoleIO $io, array<string|int, mixed> $options) : mixed
Parameters
- $io : ConsoleIO
- $options : array<string|int, mixed>
Tags
taskImportDatabase()
Import given dump file, gunzip is used if dump ends with .gz.
private
taskImportDatabase(string $dump) : mixed
Parameters
- $dump : string
-
The path to the dump file.
Tags
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 ]) : mixed
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.
wgetGenerateInputFile()
Create a file containing the url to be used by wget --input-file option.
private
wgetGenerateInputFile(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.
wgetGetFileModifiedDate()
Get the modified date from the remote file.
private
wgetGetFileModifiedDate(string $tmp) : mixed
Parameters
- $tmp : string
-
The temporary filename.