Loading CHANGELOG.txt +2 −0 Changes for CHANGELOG.txt: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ Backup and Migrate 5.1.x-dev, xxxx-xx-xx ---------------------------------------- #3223057 by paulocs, larisse, DamienMcKenna, Anybody, Grevil: Add Drush command for running a quick backup. #2968766 by paulocs, DamienMcKenna, intrafusion, larisse, fgm, hron84: Add Drush commands for getting details of available configurations. Backup and Migrate 5.0.x-dev, xxxx-xx-xx Loading drush.services.yml +1 −0 Changes for drush.services.yml: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,3 +3,4 @@ services: class: \Drupal\backup_migrate\Commands\BackupMigrateCommands tags: - { name: drush.command } arguments: ['@entity_type.manager'] src/Commands/BackupMigrateCommands.php +118 −2 Changes for src/Commands/BackupMigrateCommands.php: 118 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,8 +2,10 @@ namespace Drupal\backup_migrate\Commands; use Consolidation\OutputFormatters\StructuredData\RowsOfFields; use Drupal\backup_migrate\Drupal\Config\DrupalConfigHelper; use Drupal\backup_migrate\Entity\SettingsProfile; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drush\Commands\DrushCommands; /** Loading @@ -11,13 +13,27 @@ use Drush\Commands\DrushCommands; */ class BackupMigrateCommands extends DrushCommands { const QUAICK_BACKUP_OPTIONS = [ const QUICK_BACKUP_OPTIONS = [ 'source_id' => 'default_db', 'destination_id' => 'private_files', 'profile_id' => '', 'i' => FALSE, ]; /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** * {@inheritdoc} */ public function __construct(EntityTypeManagerInterface $entity_manager) { $this->entityTypeManager = $entity_manager; } /** * Drush command to run a quick backup. * Loading @@ -29,7 +45,7 @@ class BackupMigrateCommands extends DrushCommands { * @option i Run the command in a interactive way. * @usage backup_migrate:quick_backup */ public function quickBackup(array $options = self::QUAICK_BACKUP_OPTIONS) { public function quickBackup(array $options = self::QUICK_BACKUP_OPTIONS) { $is_interactive = $options['i']; if ($is_interactive) { Loading Loading @@ -73,4 +89,104 @@ class BackupMigrateCommands extends DrushCommands { backup_migrate_perform_backup($source_options[$source_choice], $dentination_options[$dentination_choice], $config); } /** * Get a list of available destinations. * * @command backup_migrate:destinations * @aliases bam-destinations * @usage backup_migrate:destinations * Get a list of available destinations. */ public function destinations() { $storage = $this->entityTypeManager ->getStorage('backup_migrate_destination'); $rows = [[dt('Machine name'), dt('Backup Destination')]]; foreach ($storage->getQuery()->execute() as $key) { $entity = $storage->load($key); $rows[] = [ $entity->id(), $entity->label(), ]; } return new RowsOfFields($rows); } /** * Get a list of available settings profiles. * * @command backup_migrate:profiles * @aliases bam-profiles * @usage backup_migrate:profiles * Get a list of available settings profiles. */ public function profiles() { $storage = $this->entityTypeManager ->getStorage('backup_migrate_settings'); $rows = [[dt('Machine name'), dt('Profile Name')]]; foreach ($storage->getQuery()->execute() as $key) { $entity = $storage->load($key); $rows[] = [ $entity->id(), $entity->label(), ]; } return new RowsOfFields($rows); } /** * Get a list of available schedules. * * @command backup_migrate:schedules * @aliases bam-schedules * @usage backup_migrate:schedules * Get a list of available schedules. */ public function schedules() { $storage = $this->entityTypeManager ->getStorage('backup_migrate_schedule'); $rows = [[dt('Machine name'), dt('Schedule Name')]]; foreach ($storage->getQuery()->execute() as $key) { $entity = $storage->load($key); $rows[] = [ $entity->id(), $entity->label(), ]; } return new RowsOfFields($rows); } /** * Get a list of available sources. * * @command backup_migrate:sources * @aliases bam-sources * @usage backup_migrate:sources * Get a list of available sources. */ public function sources() { $storage = $this->entityTypeManager ->getStorage('backup_migrate_source'); $rows = [[dt('Machine name'), dt('Backup Source'), dt('Type')]]; foreach ($storage->getQuery()->execute() as $key) { $entity = $storage->load($key); if ($plugin = $entity->getPlugin()) { $info = $plugin->getPluginDefinition(); } $rows[] = [ $entity->id(), $entity->label(), isset($info) ? $info['title'] : $entity->get('type'), ]; } return new RowsOfFields($rows); } } Loading
CHANGELOG.txt +2 −0 Changes for CHANGELOG.txt: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ Backup and Migrate 5.1.x-dev, xxxx-xx-xx ---------------------------------------- #3223057 by paulocs, larisse, DamienMcKenna, Anybody, Grevil: Add Drush command for running a quick backup. #2968766 by paulocs, DamienMcKenna, intrafusion, larisse, fgm, hron84: Add Drush commands for getting details of available configurations. Backup and Migrate 5.0.x-dev, xxxx-xx-xx Loading
drush.services.yml +1 −0 Changes for drush.services.yml: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,3 +3,4 @@ services: class: \Drupal\backup_migrate\Commands\BackupMigrateCommands tags: - { name: drush.command } arguments: ['@entity_type.manager']
src/Commands/BackupMigrateCommands.php +118 −2 Changes for src/Commands/BackupMigrateCommands.php: 118 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,8 +2,10 @@ namespace Drupal\backup_migrate\Commands; use Consolidation\OutputFormatters\StructuredData\RowsOfFields; use Drupal\backup_migrate\Drupal\Config\DrupalConfigHelper; use Drupal\backup_migrate\Entity\SettingsProfile; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drush\Commands\DrushCommands; /** Loading @@ -11,13 +13,27 @@ use Drush\Commands\DrushCommands; */ class BackupMigrateCommands extends DrushCommands { const QUAICK_BACKUP_OPTIONS = [ const QUICK_BACKUP_OPTIONS = [ 'source_id' => 'default_db', 'destination_id' => 'private_files', 'profile_id' => '', 'i' => FALSE, ]; /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** * {@inheritdoc} */ public function __construct(EntityTypeManagerInterface $entity_manager) { $this->entityTypeManager = $entity_manager; } /** * Drush command to run a quick backup. * Loading @@ -29,7 +45,7 @@ class BackupMigrateCommands extends DrushCommands { * @option i Run the command in a interactive way. * @usage backup_migrate:quick_backup */ public function quickBackup(array $options = self::QUAICK_BACKUP_OPTIONS) { public function quickBackup(array $options = self::QUICK_BACKUP_OPTIONS) { $is_interactive = $options['i']; if ($is_interactive) { Loading Loading @@ -73,4 +89,104 @@ class BackupMigrateCommands extends DrushCommands { backup_migrate_perform_backup($source_options[$source_choice], $dentination_options[$dentination_choice], $config); } /** * Get a list of available destinations. * * @command backup_migrate:destinations * @aliases bam-destinations * @usage backup_migrate:destinations * Get a list of available destinations. */ public function destinations() { $storage = $this->entityTypeManager ->getStorage('backup_migrate_destination'); $rows = [[dt('Machine name'), dt('Backup Destination')]]; foreach ($storage->getQuery()->execute() as $key) { $entity = $storage->load($key); $rows[] = [ $entity->id(), $entity->label(), ]; } return new RowsOfFields($rows); } /** * Get a list of available settings profiles. * * @command backup_migrate:profiles * @aliases bam-profiles * @usage backup_migrate:profiles * Get a list of available settings profiles. */ public function profiles() { $storage = $this->entityTypeManager ->getStorage('backup_migrate_settings'); $rows = [[dt('Machine name'), dt('Profile Name')]]; foreach ($storage->getQuery()->execute() as $key) { $entity = $storage->load($key); $rows[] = [ $entity->id(), $entity->label(), ]; } return new RowsOfFields($rows); } /** * Get a list of available schedules. * * @command backup_migrate:schedules * @aliases bam-schedules * @usage backup_migrate:schedules * Get a list of available schedules. */ public function schedules() { $storage = $this->entityTypeManager ->getStorage('backup_migrate_schedule'); $rows = [[dt('Machine name'), dt('Schedule Name')]]; foreach ($storage->getQuery()->execute() as $key) { $entity = $storage->load($key); $rows[] = [ $entity->id(), $entity->label(), ]; } return new RowsOfFields($rows); } /** * Get a list of available sources. * * @command backup_migrate:sources * @aliases bam-sources * @usage backup_migrate:sources * Get a list of available sources. */ public function sources() { $storage = $this->entityTypeManager ->getStorage('backup_migrate_source'); $rows = [[dt('Machine name'), dt('Backup Source'), dt('Type')]]; foreach ($storage->getQuery()->execute() as $key) { $entity = $storage->load($key); if ($plugin = $entity->getPlugin()) { $info = $plugin->getPluginDefinition(); } $rows[] = [ $entity->id(), $entity->label(), isset($info) ? $info['title'] : $entity->get('type'), ]; } return new RowsOfFields($rows); } }