You are here

function hacked_calculate_project_data_drush in Hacked! 7.2

Same name and namespace in other branches
  1. 8.2 hacked.drush.inc \hacked_calculate_project_data_drush()
  2. 6.2 hacked.drush.inc \hacked_calculate_project_data_drush()

Compute the report data for hacked.

WARNING: This function can invoke a batch process and end your current page. So you'll want to be very careful if you call this!

2 calls to hacked_calculate_project_data_drush()
drush_hacked_list_projects in ./hacked.drush.inc
Command callback for drush hacked_list_projects.
drush_hacked_lock_modified in ./hacked.drush.inc
Lock modified files so that pm-updatecode won't touch them.

File

./hacked.drush.inc, line 96

Code

function hacked_calculate_project_data_drush($projects, $force = FALSE, $redirect = NULL) {
  hacked_load_drush_dependencies();

  // Try to get the report form cache if we can.
  $cache = drush_cache_get('hacked:drush:full-report', HACKED_CACHE_TABLE);
  if (!empty($cache->data) && !$force) {
    return $cache->data;
  }

  // Enter a batch to build the report.
  $operations = array();
  foreach ($projects as $project) {
    $operations[] = array(
      'hacked_build_report_batch_drush',
      array(
        $project['name'],
      ),
    );
  }
  $batch = array(
    'operations' => $operations,
    'finished' => 'hacked_build_report_batch_finished_drush',
    'file' => drupal_get_path('module', 'hacked') . '/hacked.report.inc',
    'title' => dt('Building report'),
  );
  drush_print('Rebuilding Hacked! report');
  batch_set($batch);
  $batch =& batch_get();
  $batch['progressive'] = FALSE;
  drush_backend_batch_process();
  drush_print('Done.');

  // Now we can get the data from the cache.
  $cache = drush_cache_get('hacked:drush:full-report', HACKED_CACHE_TABLE);
  if (!empty($cache->data)) {
    return $cache->data;
  }
}