You are here

public function PermissionsByTermRebuildCommands::accessRebuild in Permissions by Term 8.2

Rebuild node access for terms related to permissions_by_term.

@command permissions-by-term:rebuild @aliases pbtr

File

src/Commands/PermissionsByTermRebuildCommands.php, line 28

Class

PermissionsByTermRebuildCommands
A Drush commandfile.

Namespace

Drupal\permissions_by_term\Commands

Code

public function accessRebuild() {
  if ($this
    ->io()
    ->confirm('Do you really want to rebuild all Drupal node access records, which the Permissions by Term module manages?', FALSE)) {
    $nids = $this->nodeAccess
      ->getNidsForAccessRebuild();
    $this
      ->io()
      ->progressStart(count($nids));
    foreach ($nids as $nid) {
      $this->nodeAccess
        ->rebuildNodeAccessOne($nid);
      $this
        ->io()
        ->progressAdvance();
    }
    $this
      ->io()
      ->progressFinish();
  }
}