PermissionsByTermRebuildCommands.php in Permissions by Term 8.2
File
src/Commands/PermissionsByTermRebuildCommands.php
View source
<?php
namespace Drupal\permissions_by_term\Commands;
use Drupal\permissions_by_term\Service\NodeAccess;
use Drush\Commands\DrushCommands;
class PermissionsByTermRebuildCommands extends DrushCommands {
private $nodeAccess;
public function __construct(NodeAccess $nodeAccess) {
$this->nodeAccess = $nodeAccess;
}
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();
}
}
}