0

I would like to remove a book, its contents, its outline, and uninstall the book module itself.

I deleted all the "Book page" content type nodes. I then deleted the one book listed under: admin/structure/book

However, when I try and uninstall the module using Drush I get the message:

"To uninstall Book, delete all content that is part of a book"

I'm assuming this is the outline data on non "Book page" nodes that I missed, but there's nothing there in the Admin UI to tell me which ones they are. The UI says "No books available."

There is a module that addresses the issue of deleting book pages and their outlines in this answer here in Drupal 7.

Is there a way to easily find and delete that book content and uninstall the module in Drupal 8?

1

It sounds like you have orphaned book content. You can go look for any nodes of type book page at /admin/content, and delete them all. Also, check your configuration of the book module to see if any other content types are enabled as book content. You may have to determine which nodes of those content types have been created as book pages but not assigned to an outline.

3
  • In the admin UI, I deleted all the "book page" nodes and the outline. But I didn't see any place in the admin where you can see a list of these other nodes that must have their book outlines removed. Eventually, found the problem nodes with an SQL statement, but thought I was missing something.
    – edg
    Mar 28 at 19:30
  • I don't think such an interface exists. You need to figure out if the book module has any other content types configured to be book pages, then go through the items of those content types to find which items have been assigned as book pages (but without an outline)
    – Jaypan
    Mar 28 at 19:59
  • I posted an answer which explains how I did it. If I was going to do it again, I'd first query the database, remove potential "orphans" from the outline and then remove the book. Thanks for responding!
    – edg
    Mar 28 at 20:02
1

The problem was that there were some non "Book page" nodes that still had Book outlines (after I had deleted the Book and all Book page nodes through the Admin).

I could get a list of the NIDs of these problematic, "trace" outlines through a database query:

drush sqlq "select nid from book"

However, I couldn't access the nodes. I got a message:

"The website encountered an unexpected error. Please try again later."

So I rolled back/reinstalled the Book content and then deleted the outlines of the problematic nodes through the UI at:

/node/1234/outline/remove

Fortunately, there weren't too many of them.

If I was doing this again I would first query the database just to see if there many non-Book Page nodes with Book outlines:

drush sqlq "select * from node, book where book.nid = node.nid and not node.type='book'"

After deleting these outlines through the UI, I was able to uninstall the Book module through Drush.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.