Skip to content

Commit

Permalink
Merge in master branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed May 6, 2016
2 parents 7a2caf0 + 1d7380d commit 4591667
Show file tree
Hide file tree
Showing 62 changed files with 335 additions and 1,827 deletions.
17 changes: 0 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ sudo: false

env:
matrix:
#D6
- UNISH_DRUPAL_MAJOR_VERSION=6 PHPUNIT_ARGS=--group=base
- UNISH_DRUPAL_MAJOR_VERSION=6 PHPUNIT_ARGS=--group=commands
- UNISH_DRUPAL_MAJOR_VERSION=6 PHPUNIT_ARGS=--group=pm
- UNISH_DRUPAL_MAJOR_VERSION=6 PHPUNIT_ARGS=--exclude-group=base,make,commands,pm,quick-drupal
#D7
- UNISH_DRUPAL_MAJOR_VERSION=7 PHPUNIT_ARGS=--group=make
- UNISH_DRUPAL_MAJOR_VERSION=7 PHPUNIT_ARGS=--group=base
Expand Down Expand Up @@ -56,18 +51,6 @@ env:
- UNISH_NO_TIMEOUTS=y
- UNISH_DB_URL=mysql://root:@127.0.0.1

matrix:
exclude:
- php: 7.0
env: UNISH_DRUPAL_MAJOR_VERSION=6 PHPUNIT_ARGS=--group=base
- php: 7.0
env: UNISH_DRUPAL_MAJOR_VERSION=6 PHPUNIT_ARGS=--group=commands
- php: 7.0
env: UNISH_DRUPAL_MAJOR_VERSION=6 PHPUNIT_ARGS=--group=pm
- php: 7.0
env: UNISH_DRUPAL_MAJOR_VERSION=6 PHPUNIT_ARGS=--exclude-group=base,make,commands,pm,quick-drupal


before_install:
- echo 'mbstring.http_input = pass' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- echo 'mbstring.http_output = pass' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
Expand Down
3 changes: 2 additions & 1 deletion commands/core/archive.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function archive_drush_command() {
'arguments' => array(
'sites' => 'Optional. Site specifications, delimited by commas. Typically, list subdirectory name(s) under /sites.',
),
'options' => array(
// Most options on sql-dump should not be shown, so just offer a subset.
'options' => drush_sql_get_table_selection_options() + array(
'description' => 'Describe the archive contents.',
'tags' => 'Add tags to the archive manifest. Delimit multiple by commas.',
'destination' => 'The full path and filename in which the archive should be stored. If omitted, it will be saved to the drush-backups directory and a filename will be generated.',
Expand Down
39 changes: 20 additions & 19 deletions commands/core/config.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function config_drush_help($section) {
* Implementation of hook_drush_command().
*/
function config_drush_command() {
$deps = array('drupal dependencies' => array('config'));
$items['config-get'] = array(
'description' => 'Display a config value, or a whole configuration object.',
'arguments' => array(
Expand Down Expand Up @@ -116,7 +117,7 @@ function config_drush_command() {
),
);

$items['config-import'] = array(
$items['config-import'] = $deps + array(
'description' => 'Import config from a config directory.',
'arguments' => array(
'label' => "A config directory label (i.e. a key in \$config_directories array in settings.php). Defaults to 'sync'",
Expand Down Expand Up @@ -160,8 +161,8 @@ function config_drush_command() {
),
);

$items['config-edit'] = array(
'description' => 'Open a config file in a text editor. Edits are imported into active configration after closing editor.',
$items['config-edit'] = $deps + array(
'description' => 'Open a config file in a text editor. Edits are imported into active configuration after closing editor.',
'core' => array('8+'),
'aliases' => array('cedit'),
'arguments' => array(
Expand Down Expand Up @@ -272,7 +273,7 @@ function drush_config_set($config_name, $key = NULL, $data = NULL) {
return drush_set_error('DRUSH_CONFIG_ERROR', dt('No config value specified.'));
}

$config = Drupal::configFactory()->getEditable($config_name);
$config = \Drupal::configFactory()->getEditable($config_name);
// Check to see if config key already exists.
if ($config->get($key) === NULL) {
$new_key = TRUE;
Expand Down Expand Up @@ -436,7 +437,7 @@ function _drush_config_export($destination, $destination_dir, $branch) {
// Retrieve a list of differences between the active and target configuration (if any).
$target_storage = new FileStorage($destination_dir);
/** @var \Drupal\Core\Config\StorageInterface $active_storage */
$active_storage = Drupal::service('config.storage');
$active_storage = \Drupal::service('config.storage');
$comparison_source = $active_storage;

// If the output is being filtered, then write a temporary copy before doing
Expand All @@ -454,7 +455,7 @@ function _drush_config_export($destination, $destination_dir, $branch) {
}
}

$config_comparer = new StorageComparer($comparison_source, $target_storage, Drupal::service('config.manager'));
$config_comparer = new StorageComparer($comparison_source, $target_storage, \Drupal::service('config.manager'));
if (!$config_comparer->createChangelist()->hasChanges()) {
return drush_log(dt('The active configuration is identical to the configuration in the export directory (!target).', array('!target' => $destination_dir)), LogLevel::OK);
}
Expand Down Expand Up @@ -482,7 +483,7 @@ function _drush_config_export($destination, $destination_dir, $branch) {
}

// Write all .yml files.
$source_storage = Drupal::service('config.storage');
$source_storage = \Drupal::service('config.storage');
$destination_storage = new FileStorage($destination_dir);
// If there are any filters, then attach them to the destination storage
if (!empty($storage_filters)) {
Expand Down Expand Up @@ -605,7 +606,7 @@ function drush_config_import($source = NULL) {

// Determine $source_storage in partial and non-partial cases.
/** @var \Drupal\Core\Config\StorageInterface $active_storage */
$active_storage = Drupal::service('config.storage');
$active_storage = \Drupal::service('config.storage');
if (drush_get_option('partial')) {
$source_storage = new StorageReplaceDataWrapper($active_storage);
$file_storage = new FileStorage($source_dir);
Expand All @@ -627,7 +628,7 @@ function drush_config_import($source = NULL) {
}

/** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
$config_manager = Drupal::service('config.manager');
$config_manager = \Drupal::service('config.manager');
$storage_comparer = new StorageComparer($source_storage, $active_storage, $config_manager);


Expand Down Expand Up @@ -666,14 +667,14 @@ function drush_config_import($source = NULL) {
function _drush_config_import(StorageComparer $storage_comparer) {
$config_importer = new ConfigImporter(
$storage_comparer,
Drupal::service('event_dispatcher'),
Drupal::service('config.manager'),
Drupal::lock(),
Drupal::service('config.typed'),
Drupal::moduleHandler(),
Drupal::service('module_installer'),
Drupal::service('theme_handler'),
Drupal::service('string_translation')
\Drupal::service('event_dispatcher'),
\Drupal::service('config.manager'),
\Drupal::lock(),
\Drupal::service('config.typed'),
\Drupal::moduleHandler(),
\Drupal::service('module_installer'),
\Drupal::service('theme_handler'),
\Drupal::service('string_translation')
);
if ($config_importer->alreadyImporting()) {
drush_log('Another request may be synchronizing configuration already.', LogLevel::WARNING);
Expand Down Expand Up @@ -704,7 +705,7 @@ function _drush_config_import(StorageComparer $storage_comparer) {
function drush_config_edit($config_name = '') {
// Identify and validate input.
if ($config_name) {
$config = Drupal::configFactory()->get($config_name);
$config = \Drupal::configFactory()->get($config_name);
if ($config->isNew()) {
return drush_set_error(dt('Config !name does not exist', array('!name' => $config_name)));
}
Expand All @@ -717,7 +718,7 @@ function drush_config_edit($config_name = '') {
}
else {
$config_name = $config_names[$choice];
$config = Drupal::configFactory()->get($config_name);
$config = \Drupal::configFactory()->get($config_name);
}
}

Expand Down
5 changes: 2 additions & 3 deletions commands/core/core.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1194,9 +1194,8 @@ function _drush_core_eval_shebang_script($script_filename) {
return $found;
}


/**
* Process sets from the specified batch.
* 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.
Expand All @@ -1206,7 +1205,7 @@ function drush_core_batch_process($id) {
}

/**
* Process outstanding updates during updatedb.
* Command callback. Process outstanding updates during updatedb.
*
* This is a batch processing command that makes use of the drush_backend_invoke
* api.
Expand Down
54 changes: 38 additions & 16 deletions commands/core/drupal/batch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,21 @@ function _drush_backend_batch_process($command = 'batch-process', $args, $option

drush_include_engine('drupal', 'environment');
// Store the batch.
db_insert('batch')
->fields(array(
'bid' => $batch['id'],
'timestamp' => REQUEST_TIME,
'token' => drush_get_token($batch['id']),
'batch' => serialize($batch),
))
->execute();
if (drush_drupal_major_version() >= 8) {
/** @var \Drupal\Core\Batch\BatchStorage $batch_storage */
$batch_storage = \Drupal::service('batch.storage');
$batch_storage->create($batch);
}
else {
db_insert('batch')
->fields(array(
'bid' => $batch['id'],
'timestamp' => REQUEST_TIME,
'token' => drush_get_token($batch['id']),
'batch' => serialize($batch),
))
->execute();
}
$finished = FALSE;

// Not used in D8+ and possibly earlier.
Expand Down Expand Up @@ -235,16 +242,24 @@ function _drush_batch_finished() {
$queue = _batch_queue($batch_set);
$operations = $queue->getAllItems();
$elapsed = $batch_set['elapsed'] / 1000;
$elapsed = drush_drupal_major_version() >=8 ? Drupal::service('date.formatter')->formatInterval($elapsed) : format_interval($elapsed);
$elapsed = drush_drupal_major_version() >=8 ? \Drupal::service('date.formatter')->formatInterval($elapsed) : format_interval($elapsed);
$batch_set['finished']($batch_set['success'], $batch_set['results'], $operations, $elapsed);
}
}
}

// Clean up the batch table and unset the static $batch variable.
db_delete('batch')
->condition('bid', $batch['id'])
->execute();
if (drush_drupal_major_version() >= 8) {
/** @var \Drupal\Core\Batch\BatchStorage $batch_storage */
$batch_storage = \Drupal::service('batch.storage');
$batch_storage->delete($batch['id']);
}
else {
db_delete('batch')
->condition('bid', $batch['id'])
->execute();
}

foreach ($batch['sets'] as $batch_set) {
if ($queue = _batch_queue($batch_set)) {
$queue->deleteQueue();
Expand All @@ -261,9 +276,16 @@ function _drush_batch_finished() {
*/
function _drush_batch_shutdown() {
if ($batch = batch_get()) {
db_update('batch')
->fields(array('batch' => serialize($batch)))
->condition('bid', $batch['id'])
->execute();
if (drush_drupal_major_version() >= 8) {
/** @var \Drupal\Core\Batch\BatchStorage $batch_storage */
$batch_storage = \Drupal::service('batch.storage');
$batch_storage->update($batch);
}
else {
db_update('batch')
->fields(array('batch' => serialize($batch)))
->condition('bid', $batch['id'])
->execute();
}
}
}
Loading

0 comments on commit 4591667

Please sign in to comment.