You are here

protected function HackedController::getProjectData in Hacked! 8.2

Compute the report data for hacked.

Parameters

$projects:

bool|FALSE $force:

null $redirect:

Return value

mixed

2 calls to HackedController::getProjectData()
HackedController::hackedStatus in src/Controller/HackedController.php
Page callback to build up a full report.
HackedController::hackedStatusManually in src/Controller/HackedController.php
Page callback to rebuild the hacked report.

File

src/Controller/HackedController.php, line 70

Class

HackedController
Controller routines for hacked routes.

Namespace

Drupal\hacked\Controller

Code

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

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

  // Enter a batch to build the report.
  $operations = [];
  foreach ($projects as $project) {
    $operations[] = [
      'hacked_build_report_batch',
      [
        $project['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.
  return batch_process($redirect);
}