public function NodeAccess::rebuildAccess in Permissions by Term 8.2
File
- src/
Service/ NodeAccess.php, line 291
Class
- NodeAccess
- Class NodeAccess
Namespace
Drupal\permissions_by_term\ServiceCode
public function rebuildAccess() : void {
$nids = $this
->getNidsForAccessRebuild();
if (count($nids) > 50) {
$operations = array_map(function ($id) {
return [
'Drupal\\permissions_by_term\\Service\\NodeAccess::rebuildNodeAccessOne',
[
$id,
],
];
}, $nids);
$batch = [
'title' => t('Updating content access permissions'),
'operations' => $operations,
'finished' => 'Drupal\\permissions_by_term\\Service\\NodeAccess::rebuildComplete',
];
batch_set($batch);
batch_process(\Drupal::service('path.current')
->getPath());
}
else {
// Try to allocate enough time to rebuild node grants
Environment::setTimeLimit(240);
// Rebuild newest nodes first so that recent content becomes available
// quickly.
rsort($nids);
foreach ($nids as $nid) {
$this
->rebuildNodeAccessOne($nid);
}
}
}