Rebuild node permissions table on large sites with many nodes
Every now and again the node permissions table on a Drupal site can go out of whack. The result is that some users may get an accessed denied message when trying to access pages.
This is fairly easy to fix on a "normal size" website. You simply go to admin -> content -> post settings and click "Rebuild permissions".
However, this does not always work on a partcularly large Drupal based website. I have tried this on a site with around 11,000 nodes and it times out, giving me a page not found error.
One solution is to use a custom script to rebuild the node permissions one node at a time. I found this script on drupal.org:
Thanks to enboig for the script.
I have used it on the site with 11,000 nodes and it works like a treat. Although it does take a long time to run. In this case, it took several hours. But at least it worked!
If you liked this, you'll love my book, Master Drupal Module Development.
"..the must have drupal developers book"
Feeling stuck with Drupal 8 module dev?
Get the free 7 lesson course that will help you get started today without feeling overwhelmed.
- Create Drupal modules with just a few commands using the Drupal Console
- Create custom pages
- Create custom blocks
- Create admin forms
- Demystify routers and controllers
- Bonus material