function DrupalDataCollector::collect
File
-
webprofiler/
src/ DataCollector/ DrupalDataCollector.php, line 46
Class
- DrupalDataCollector
- Class DrupalDataCollector
Namespace
Drupal\webprofiler\DataCollectorCode
public function collect(Request $request, Response $response, \Exception $exception = NULL) {
$this->data['version'] = Drupal::VERSION;
$this->data['profile'] = drupal_get_profile();
$this->data['config_url'] = (new Drupal\Core\Url('webprofiler.settings', [], [
'query' => $this->redirectDestination
->getAsArray(),
]))
->toString();
try {
$process = new Process("git log -1 --pretty=format:'%H - %s (%ci)' --abbrev-commit");
$process->setTimeout(3600);
$process->mustRun();
$this->data['git_commit'] = $process->getOutput();
$process = new Process("git log -1 --pretty=format:'%h' --abbrev-commit");
$process->setTimeout(3600);
$process->mustRun();
$this->data['abbr_git_commit'] = $process->getOutput();
} catch (ProcessFailedException $e) {
$this->data['git_commit'] = $this->data['git_commit_abbr'] = NULL;
} catch (RuntimeException $e) {
$this->data['git_commit'] = $this->data['git_commit_abbr'] = NULL;
}
}