Skip to content
This repository was archived by the owner on Jun 26, 2019. It is now read-only.

Commit

Permalink
Port batch commands to annotated. (drush-ops#2491)
Browse files Browse the repository at this point in the history
* Port batch commands to annotated.

* Try to fix batch error.

* Forgot to add the annotated file.
  • Loading branch information
weitzman authored Dec 8, 2016
1 parent 9985b68 commit bd25206
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 48 deletions.
47 changes: 0 additions & 47 deletions commands/core/core.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -122,28 +122,6 @@ function core_drush_command() {
'aliases' => array('rsync'),
'topics' => array('docs-aliases'),
);

$items['batch-process'] = array(
'description' => 'Process operations in the specified batch set',
'hidden' => TRUE,
'arguments' => array(
'batch-id' => 'The batch id that will be processed.',
),
'required-arguments' => TRUE,
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
);

$items['updatedb-batch-process'] = array(
'description' => 'Perform update functions',
'hidden' => TRUE,
'arguments' => array(
'batch-id' => 'The batch id that will be processed',
),
'required-arguments' => TRUE,
// Drupal 7 needs DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION, while Drupal 8 needs _FULL.
// Therefore we bootstrap to _FULL in commands/core/drupal/update.inc.
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION,
);
$items['core-quick-drupal'] = array(
'description' => 'Download, install, serve and login to Drupal with minimal configuration and dependencies.',
'bootstrap' => DRUSH_BOOTSTRAP_NONE,
Expand Down Expand Up @@ -623,31 +601,6 @@ function drush_core_quick_drupal_options(&$items) {
$items['core-quick-drupal']['engines'] = $pm['pm-download']['engines'];
}

/**
* Command callback. Process sets from the specified batch.
*
* This is the default batch processor that will be used if the $command parameter
* to drush_backend_batch_process() has not been specified.
*/
function drush_core_batch_process($id) {
drush_batch_command($id);
}

/**
* Command callback. Process outstanding updates during updatedb.
*
* This is a batch processing command that makes use of the drush_backend_invoke
* api.
*
* This command includes the version specific update engine, which correctly
* initialises the environment to be able to successfully handle minor and major
* upgrades.
*/
function drush_core_updatedb_batch_process($id) {
drush_include_engine('drupal', 'update');
_update_batch_command($id);
}

/**
* Called for `drush version` or `drush --version`
*/
Expand Down
35 changes: 35 additions & 0 deletions lib/Drush/Commands/core/BatchCommands.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
namespace Drush\Commands\core;

use Drush\Commands\DrushCommands;

class BatchCommands extends DrushCommands {

/**
* Process operations in the specified batch set.
*
* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
*
* @command batch-process
* @param $batch_id The batch id that will be processed.
* @hidden
* @bootstrap DRUSH_BOOTSTRAP_DRUPAL_LOGIN
*/
public function process($batch_id) {
drush_batch_command($batch_id);
}

/**
* Perform update functions.
*
* @command updatedb-batch-process
* @param $batch_id The batch id that will be processed.
* @hidden
* @bootstrap DRUSH_BOOTSTRAP_DRUPAL_FULL
*/
public function updatedb_process($batch_id) {
drush_include_engine('drupal', 'update');
_update_batch_command($id);
}

}
2 changes: 1 addition & 1 deletion tests/batchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testBatch() {
'root' => $this->webroot(),
'uri' => key($sites),
'yes' => NULL,
'include' => dirname(__FILE__),
'include' => __DIR__,
);
$this->drush('unit-batch', array(), $options);
// Collect log messages that begin with "!!!" (@see: _drush_unit_batch_operation())
Expand Down

0 comments on commit bd25206

Please sign in to comment.