Toolkit

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.
isJunit()  : bool
Check whether Junit option is being used, or env var is set.
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
bool

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
command

toolkit:create-dump

option

dumpfile The dump file name.

aliases

tk-cdump

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
codingStandardsIgnoreStart

Generic.Commenting.DocComment.TagsNotGrouped

Configuration for database snapshot in NEXTCLOUD.

  • Environment variables: NEXTCLOUD_USER, NEXTCLOUD_PASS (EU Login).
  • Runner variables:
code

toolkit: clone: type: 'nextcloud' nextcloud: url: 'files.fpfis.tech.ec.europa.eu/remote.php/dav/files' services: - mysql - solr - virtuoso

code

toolkit: clone: type: 'custom' dumpfile: dumpfile.sql.gz custom: url: example.com/databases user: username pass: secret-password

endcode

Configuration for database snapshot in custom server.

  • Runner variables:
endcode
codingStandardsIgnoreEnd
command

toolkit:download-dump

option

is-admin For nextcloud admin user.

option

yes Skip the question to download newer dump.

aliases

tk-ddump

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
command

toolkit:install-dump

option

dumpfile The dump file name.

option

myloader If set, MyLoader will be used to import the database.

aliases

tk-idump

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
throws
TaskException
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
throws
TaskException
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.

isJunit()

Check whether Junit option is being used, or env var is set.

protected isJunit() : bool
Return values
bool

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
string

asdaProcessFile()

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
SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

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
SuppressWarnings

(PHPMD.CyclomaticComplexity)

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.


        
On this page

Search results