function drush_sitelist_align_lists

6.x drush_sitelist_align_lists(&$source, &$target, &$source_result, &$target_result)
3.x drush_sitelist_align_lists(&$source, &$target, &$source_result, &$target_result)
4.x drush_sitelist_align_lists(&$source, &$target, &$source_result, &$target_result)
5.x drush_sitelist_align_lists(&$source, &$target, &$source_result, &$target_result)

If the source and target lists contain alias records to the same sets of sites, but in different orders, this routine will re-order the lists so that they are in alignment.

TODO: Review the advisability of this operation.

1 call to drush_sitelist_align_lists()
drush_do_multiple_command in includes/
Used by functions that operate on lists of sites, moving information from the source to the destination. Currenlty this includes 'drush rsync' and 'drush sql sync'.


includes/, line 1020
The site alias API.


function drush_sitelist_align_lists(&$source, &$target, &$source_result, &$target_result) {
  $source_result = array();
  $target_result = array();

  foreach ($source as $key => $one_source) {
    $one_target = _drush_sitelist_find_in_list($one_source, $target);
    if ($one_target !== FALSE) {
      $source_result[] = $one_source;
      $target_result[] = $one_target;

  $source = $source_result;
  $target = $target_result;