You are here

function hacked_calculate_project_data in Hacked! 6.2

Same name and namespace in other branches
  1. 5 hacked.module \hacked_calculate_project_data()
  2. 6 hacked.module \hacked_calculate_project_data()
  3. 7.2 hacked.module \hacked_calculate_project_data()

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()
hacked_reports_hacked in ./hacked.report.inc
Page callback to build up a full report.
hacked_reports_rebuild in ./hacked.report.inc
Page callback to rebuild the hacked report.

File

./hacked.module, line 163
The Hacked! module, shows which project have been changed since download.

Code

function hacked_calculate_project_data($projects, $force = FALSE, $redirect = NULL) {

  // Try to get the report form cache if we can.
  $cache = cache_get('hacked: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',
      array(
        $project['short_name'],
      ),
    );
  }
  $batch = array(
    'operations' => $operations,
    'finished' => 'hacked_build_report_batch_finished',
    'file' => drupal_get_path('module', 'hacked') . '/hacked.report.inc',
    'title' => t('Building report'),
  );
  batch_set($batch);

  // End page execution and run the batch.
  batch_process($redirect);
}