class PermissionsByTermRebuildCommands in Permissions by Term 8.2
A Drush commandfile.
Hierarchy
- class \Drupal\permissions_by_term\Commands\PermissionsByTermRebuildCommands extends \Drush\Commands\DrushCommands
Expanded class hierarchy of PermissionsByTermRebuildCommands
1 string reference to 'PermissionsByTermRebuildCommands'
1 service uses PermissionsByTermRebuildCommands
File
- src/
Commands/ PermissionsByTermRebuildCommands.php, line 11
Namespace
Drupal\permissions_by_term\CommandsView source
class PermissionsByTermRebuildCommands extends DrushCommands {
/**
* @var \Drupal\permissions_by_term\Service\NodeAccess
*/
private $nodeAccess;
public function __construct(NodeAccess $nodeAccess) {
$this->nodeAccess = $nodeAccess;
}
/**
* Rebuild node access for terms related to permissions_by_term.
*
* @command permissions-by-term:rebuild
* @aliases pbtr
*/
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();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PermissionsByTermRebuildCommands:: |
private | property | ||
PermissionsByTermRebuildCommands:: |
public | function | Rebuild node access for terms related to permissions_by_term. | |
PermissionsByTermRebuildCommands:: |
public | function |