Skip to content

Commit

Permalink
Add backup create and restore again.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Feb 21, 2024
1 parent 0f0139e commit d7a95d7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Command/DbBackupCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ class DbBackupCreateCommand extends Command {
*/
protected $io;

/**
* @return string
*/
public static function getDescription(): string {
return 'Dumps SQL database into a backup file.';
}

/**
* @return void
*/
Expand Down Expand Up @@ -195,7 +202,7 @@ public function getOptionParser(): ConsoleOptionParser {
];

return parent::getOptionParser()
->setDescription('dump and restore SQL databases. The advantage: It uses native CLI commands which save a lot of resources and are very fast.')
->setDescription(static::getDescription() . ' The advantage: It uses native CLI commands which save a lot of resources and are very fast.')
->addArgument('file', [
'help' => 'Use a specific backup file (needs to be an absolute path).',
'optional' => true,
Expand Down
9 changes: 8 additions & 1 deletion src/Command/DbBackupRestoreCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ class DbBackupRestoreCommand extends Command {
*/
protected $io;

/**
* @return string
*/
public static function getDescription(): string {
return 'Restores SQL database from a backup file.';
}

/**
* @return void
*/
Expand Down Expand Up @@ -194,7 +201,7 @@ public function getOptionParser(): ConsoleOptionParser {
];

return parent::getOptionParser()
->setDescription('dump and restore SQL databases. The advantage: It uses native CLI commands which save a lot of resources and are very fast.')
->setDescription(static::getDescription())
->addArgument('file', [
'help' => 'Use a specific backup file (needs to be an absolute path).',
'optional' => true,
Expand Down
9 changes: 9 additions & 0 deletions src/SetupPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
use Setup\Command\CurrentConfigDisplayCommand;
use Setup\Command\CurrentConfigPhpinfoCommand;
use Setup\Command\CurrentConfigValidateCommand;
use Setup\Command\DbBackupCreateCommand;
use Setup\Command\DbBackupRestoreCommand;
use Setup\Command\DbIntegrityBoolsCommand;
use Setup\Command\DbIntegrityConstraintsCommand;
use Setup\Command\DbIntegrityIntsCommand;
use Setup\Command\DbIntegrityKeysCommand;
use Setup\Command\DbIntegrityNullsCommand;
use Setup\Command\MaintenanceModeActivateCommand;
Expand Down Expand Up @@ -49,6 +53,11 @@ public function console(CommandCollection $commands): CommandCollection {
$commands->add('db_integrity keys', DbIntegrityKeysCommand::class);
$commands->add('db_integrity constraints', DbIntegrityConstraintsCommand::class);
$commands->add('db_integrity nulls', DbIntegrityNullsCommand::class);
$commands->add('db_integrity bools', DbIntegrityBoolsCommand::class);
$commands->add('db_integrity ints', DbIntegrityIntsCommand::class);

$commands->add('db_backup create', DbBackupCreateCommand::class);
$commands->add('db_backup restore', DbBackupRestoreCommand::class);

$commands->add('user create', UserCreateCommand::class);
$commands->add('user update', UserUpdateCommand::class);
Expand Down

0 comments on commit d7a95d7

Please sign in to comment.