public static function UpgradeStatusForm::parseProject in Upgrade Status 8.2
Same name and namespace in other branches
- 8.3 src/Form/UpgradeStatusForm.php \Drupal\upgrade_status\Form\UpgradeStatusForm::parseProject()
- 8 src/Form/UpgradeStatusForm.php \Drupal\upgrade_status\Form\UpgradeStatusForm::parseProject()
Batch callback to analyze a project.
Parameters
\Drupal\Core\Extension\Extension $extension: The extension to analyze.
bool $use_http: Whether to use HTTP to execute the processing or execute locally. HTTP processing could fail in some container setups. Local processing may fail due to timeout or memory limits.
array $context: Batch context.
File
- src/
Form/ UpgradeStatusForm.php, line 912
Class
Namespace
Drupal\upgrade_status\FormCode
public static function parseProject(Extension $extension, $use_http, &$context) {
$context['message'] = t('Analysis complete for @project.', [
'@project' => $extension
->getName(),
]);
if (!$use_http) {
\Drupal::service('upgrade_status.deprecation_analyzer')
->analyze($extension);
return;
}
// Do the HTTP request to run processing.
list($error, $message, $data) = static::doHttpRequest($extension
->getType(), $extension
->getName());
if ($error !== FALSE) {
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $key_value */
$key_value = \Drupal::service('keyvalue')
->get('upgrade_status_scan_results');
$result = [];
$result['date'] = \Drupal::time()
->getRequestTime();
$result['data'] = [
'totals' => [
'errors' => 1,
'file_errors' => 1,
'upgrade_status_split' => [
'warning' => 1,
],
],
'files' => [],
];
$result['data']['files'][$error] = [
'errors' => 1,
'messages' => [
[
'message' => $message,
'line' => 0,
],
],
];
$key_value
->set($extension
->getName(), json_encode($result));
}
}