Drupal 6.14.

Book module generates book nodes but doesn't link them.

No Book module entries in menu_links table.

Very old (year or more) and very recent (post installation of 6.14) books in book table.

How do I fix this?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

markpenny’s picture

Title: No menu links, not books » No menu links, no books
VM’s picture

Title: No menu links, no books » No menu links, not books
Category: bug » support
Priority: Critical » Normal

when creating a book page you have to link it to a book/another page using the dropdown toward the bottom of the page. Have you done this?

Drupal.org uses drupal 6 and the documentation area, built on the books module works fine.

VM’s picture

Title: No menu links, not books » No menu links, no books

crosspost changed title

markpenny’s picture

The dropdown list is there, but it's empty. Once I understood that book.module in 6.x worked differently and used menu_links, I looked in that table for Book module entries and found none. It appears that the module and its partners are not putting data there.

VM’s picture

hmm, you should have two options in that drop down.

none and add new book ?

Did you set up the content types that are allowed to be used in administer -> books?

markpenny’s picture

Yeah, I've got none and add new book, but none of my books, even after adding a new one.

Yes, content types enabled.

VM’s picture

hmmm. my sandbox is has the lastest -dev of 6.x install and I can't recreate this issue.
I'd suggest, first testing your theory of a bug on a fresh install of 6.14, if the bug is present, test 6.x-dev where it may be fixed already and awaiting a new point release.

markpenny’s picture

I was thinking about switching to an older version of Book. I suppose I could switch in a later one. Or are there other modules involved, like Menu?

VM’s picture

Category: support » bug

Could be other modules involved. Reviewing the patches that went in and the bugs that were supposed to fied by these patches between 6.14 and the last roll, which I believe was Nov, 16 may prove fruitful.

I'll move this back to bug report for now, but I've no 6.14 to double check. Updating to -dev shouldn't be much of an issue. It's only been bug fixes going in. No API changes and I don't believe there has been a DB changed between 6.14 and what is currently 6.x-dev. If there has been, it's not in my notes.

markpenny’s picture

I'm not afraid of a new house. It's moving all the furniture that gives me pause. My site is module heavy.

Anyway, thanks for responding.

markpenny’s picture

The problem seems to be more menu- than boo-related. Might Simple Menu or Administration Menu somehow interfere? It doesn't seem likely, but I don't know enough about PHP to properly judge.

VM’s picture

I'm using admin menu, but not simple menu and don't see this issue. Disable simple menu and test.

markpenny’s picture

I'll try that. Thanks.

I've just checked menu_link again. No Book items. Also checked book. There are mlids, bids and nids, so it looks like the Book end is working. Looked for the mlids in menu_link. Found none.

markpenny’s picture

Status: Active » Fixed

By fixed I mean that I've gotten close enough to the bottom of the problem to understand what I need to do to get the desired results on my site.

The first problem was that the new menu_links-generating version of Book did not generate menu_links for pre-6.x books (books created before installation of Drupal 6). It added the field "mlid" to the book table and assigned all books an mlid, but it added no records for them to menu_links. Since Books 6.x pulls everything together through menu_links, there were no titles in the Book List (/book), even though there were plenty of nodes of type Book.

The second problem, the one that led me to believe the module wasn't generating new books, was that I forgot that books in the Book List have to be created through Book Outline (or Outline, if you want to skip clicking the Edit tab). That is, a node of content type Book is not automatically added to the Book List. The Book List lists the top-level page in a tree of pages and each top-level page must be designated through Book Outline (or Outline).

The quickest solution for me came in two stages.

Stage One 

1. In the database, open the book table and delete all records (necessary to avoid duplicate entry errors for the bid, safe because deletion from the book table does not affect a node's content type).
2. On the site, navigate to Content (Content management > Content or admin/content/node).
3. Filter for Books.
4. Open each node desired as a top-level page. 
5. Designate it as a top-level page through Outline (or Book Outline).

This populated the Book List and gave me books to assign pages to.

Stage Two

1. Open each node desired as a page of a book.
2. Designate it as a page of a given book through Outline (or Book Outline).

All done.

Fortunately for me, I only had about thirty or forty nodes to deal with. Sites with larger book and page populations might prefer a slicker, code-based solution.

Hopefully future versions of Book will either make no changes to the database structure of the module or automatically update all instances to the new structure. I had the impression 6.x was supposed to do that, but it didn't in my case. I was not alone.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Thomas_Zahreddin’s picture

Version: 6.14 » 6.15
Status: Closed (fixed) » Active

After checking the correct code in book.install

i came to this conclusion:

1.) drop table book in D6 (if there are no diffs to your backup of D5)
2.) reimport table book from D5
3.) run update_6000 for the book module (2nd page of update, Select Version, choose 6000 in the drop-down-box for book)
4.) check your book hirarchy

I'm very irritated that this error comes up after so many (??) D5 updates in the past, another annoying thing is that this error was closed without a solution for a core module!

@core developers: Please rethink your strategy: Either maintaining all (!) core modules or reduce the number of core modules.

Best
Thomas Zahreddin

markpenny’s picture

I'm sorry other people are still having trouble. My solution has worked swimmingly for me. Granted it's a bit troublesome.

Hopefully this sort of thing won't come up again.

Hetta’s picture

Version: 6.15 » 6.16
Priority: Normal » Critical
FileSize
114.49 KB
126.64 KB
128.29 KB
158.17 KB
79.69 KB
90.5 KB
82.2 KB

OK, the book module update script is horribly broken.

I just upgraded from d5.21 to d6.16. A list of d5 and d6 installed modules can be found in the attached screenshots. I don't think they matter ... I think what matters is the number of book nodes vs. the amount of memory allocated to mysql and php.

I did the upgrade by the book: disabled all d5-contributed modules, removed d5 files, unzipped and moved d6 files, ran update.php, added d6-contributed modules, and ran update.php again.

Running the update script netted me about 500 identical errors. They all basically say this:

php
Date	Thursday, March 4, 2010 - 16:45
User	Henriette
Location	http://localhost/update.php?id=1&op=do
Referrer	http://localhost/update.php?op=start&id=1
Message	You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY fit DESC LIMIT 0, 1' at line 1 query: SELECT path FROM menu_router WHERE path IN () ORDER BY fit DESC LIMIT 0, 1 in /srv/www/htdocs/includes/menu.inc on line 2099.

after those, the next batch of about 500 errors was this:

Type	php
Date	Thursday, March 4, 2010 - 16:47
User	Henriette
Location	http://localhost/update.php?id=2&op=do
Referrer	http://localhost/update.php?op=start&id=2
Message	Duplicate entry '17783' for key 2 query: INSERT INTO book (mlid, nid, bid) VALUES (3856, 17783, 17610) in /srv/www/htdocs/modules/book/book.install on line 223.
Severity	error
Hostname	127.0.0.1
Operations	

After the upgrade, the site worked, kind of sort of. However, I
1) had to up the max_allowed_packet limit from 1M to 16M (got error messages that mysql couldn't handle things, on trying to view any node included in a book)
and
2) had to up the memory_limit from 128M to 256M. (php threw "out of memory" errors, yes, with that 128M, so I did the binary thing and doubled the availalbe memory).

It's entirely possible that the book-to-menu-list update is enough of a resource hog that it CANNOT complete ... BUT doesn't throw an error to say so. I don't know. Set things to 1M and 16M (or similar), run the script, and see what happens.

Several of my books were partially (or fully) unlinked. I have no idea why some are still linked while others aren't. ALL of my top-level books had menu entries; some of those books are unlinked (while also orphaning all child nodes), some aren't.

The fix given by Thomas http://drupal.org/node/645214#comment-2454738 works.

HorsePunchKid’s picture

Version: 6.16 » 6.x-dev

Thank you, Thomas_Zahreddin; that worked like a charm. Changing version because this is still broken when upgrading from latest D5 to latest D6.

Hetta’s picture

Of course, you could delete the book-toc-% entries from menu_links first ... if you don't, they'll be double, but your books will work.

WiredEscape’s picture

Drupal 5.22 -> D6.18 has same problem.

With original update the book table is updated but mlid values are not created in menu_link table. There is a gap in menu_link mlid values that match the mlid values created in the book table. Seems like the auto-increment is increased by the number of rows in the book table but rows are not inserted into menu_link table. Almost like it fails part way through the menu_link table update.

Thomas's #16 solution works with no visible problems, but I'm unsure if there will be future problems...

asb’s picture

fehin’s picture

Post #16 solved the problem for me. Thank you.

sumitk’s picture

#16 helped me! Thanks!

maxudit007’s picture

#16 working in Drupal 6.15 but not in Drupal 6.16. When I followed the Thomas steps, I got this: (So, any fix more than this? Many thanks in Advance.)
book module
Update #6000

* CREATE TABLE {book_temp} ( `nid` INT unsigned NOT NULL DEFAULT 0, `parent` INT NOT NULL DEFAULT 0, `weight` TINYINT NOT NULL DEFAULT 0, PRIMARY KEY (nid), INDEX parent (parent) ) /*!40100 DEFAULT CHARACTER SET UTF8 */

* Failed: INSERT INTO {book_temp} (nid, parent, weight) SELECT b.nid, b.parent, b.weight FROM {book} b INNER JOIN {node} n on b.vid = n.vid

* DROP TABLE {book}

* CREATE TABLE {book} ( `mlid` INT unsigned NOT NULL DEFAULT 0, `nid` INT unsigned NOT NULL DEFAULT 0, `bid` INT unsigned NOT NULL DEFAULT 0, PRIMARY KEY (mlid), UNIQUE KEY nid (nid), INDEX bid (bid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
* Relocated existing book pages.

* DROP TABLE {book_temp}

fehin’s picture

Post #16 worked for me in 6.16.

arithok’s picture

Post #16 worked for me in 6.17, thx.

t3r0’s picture

I had just the same issue when updating a d5 site to d6.. And post #16 fixed the issue for me too!

PMunn’s picture

I also had this problem coming from 5.x to 6.x on PostgreSQL. I was lazy checking my site and caught this late. Plus my books were small so I used the method described in #14.

This really makes me fearful of what upgrading from 6 to 7 will be like, but at least I've solved the problem for now.

Thanks for all the help on coming up with this solution. Personally I'd have been afraid of doing something like #14 but then again, with database backups one can be bold.

ducdebreme’s picture

#16 worked for me when upgrading D5.23 -> D6.17

calebgilbert’s picture

Instructions in comment #16 worked for me as well, thanks!

oadaeh’s picture

Those of you who are still having problems with upgrading from D5 to D6 should check out #767408: semaphore table need to be created during update_fix_d6_requirements(). Applying that patch to my D6 installation before running the upgrade.php script fixed my book outline disappearing problem.

ronsnow’s picture

Just wanted to add that Thomas_Zahreddin's #16 fixed the problem we encountered on 5.23 -> 6.19 upgrade. Before doing the steps outlined in #16 I had insured that #32's suggestion that the semaphore table exist was also done. In short I dropped the book table, brought that table over from our 5.23 DB and re-ran the update.php with number 6000 being selected for the book-module.

Thanks! It fixed our problem without a lot of data entry/manipulation.

dentonlt’s picture

#16/Thomas: wow. Today you're my hero.

Another confirmation that this method works for 5.23->6.19. Much savings in time and effort, no need to manually re-create book hierarchy - thanks!

curtzt’s picture

When this piece of the update script shown in #25 failed for my 5.23 site as I was trying to upgrade it to 6.19, it failed because it encountered duplicate entries in the old book table. The actual error I got in the big pink box looked like this:

* user warning: Duplicate entry '5693' for key 'PRIMARY' query: INSERT INTO book_temp (nid, parent, weight) SELECT b.nid, b.parent, b.weight FROM book b INNER JOIN node n on b.vid = n.vid in /home2/olyblogn/public_html/testbed/modules/book/book.install on line 127.
* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home2/olyblogn/public_html/testbed/modules/book/book.install on line 219.

Naturally, this happened when I tried the solution in #16 too, since the same script was running on the same database tables. (There were actually a couple of kinds of entries with identical nids in my 5.23 book table.)

I think that these duplicates were there all along, and that they just didn't interfere with the display of the books using the simpler database structure for books in 5.x. (However, I didn't have a working 5.23 setup any more by the time I finally worked through my other problems getting from 5.23 to 6.19; I didn't even realize that most of the book links were gone until a few days after I heaved a sigh of relief and thought that I'd finally made it to 6.x. 600 or so entries out of the 2600 that should have been done actually got made in the new book table before things went south, though many of those were screwed up.) So it's conceivable that these duplicates weren't actually in the database when my 5.23 site was working fine, and that the data for that table got corrupted at some stage in my trying to work out other problems in the upgrade.)

Anyway, I finally copied the data out of the sql dump for the book table, put it in a spreadsheet to locate all the duplicate nids, deleted them manually, pasted the remaining data back into the sql dump in the appropriate format, imported that table back into my 6.23 site, and ran the 6000 update according to the advice in #16. I bet there were more elegant ways I might have done this, if I knew more, but it did work.

The potentially useful point for others with book update problems may be that I think you can end up with duplicate nid entries in a book table in 5.x and still not have any difficulty with your books, but any duplicate nid entries in that table will break the upgrade script when you try to go to 6.x.

kenianbei’s picture

subscribe

Marvine’s picture

Any idea to execute this :

3.) run update_6000 for the book module (2nd page of update, Select Version, choose 6000 in the drop-down-box for book)

with Drush module ?

Thanks.

nvahalik’s picture

#16 worked well for me as well.

prokopton’s picture

Does anyone know the complete mysql command to re-create the "book" table for Drupal 6.19 using the mysql command line?

Thanks.

gemini’s picture

Confirming: solution in comment #16 solved my upgrade issue from 5.23 to 6.19

catya’s picture

Version: 6.x-dev » 6.20

Anyone know if there was ever a non-manual fix for this? I have way too much content to do this by hand.

ambereyes’s picture

Status: Active » Needs review

Solution in comment #16 solved my upgrade issue from 5.23 to 6.19 as well

VM’s picture

Version: 6.20 » 6.x-dev

This needs to remain version 6.x-dev if it's ever going to be looked at.

prokopton’s picture

For solution #16, can someone please show me the commands to do it?

Thank-you.

ajzz’s picture

#16 Works from CVS DRUPAL-5 to DRUPAL-6-20

@prokopton, note that if you have two databases on your mysql server instance for D5 and D6 (with names mysite_d5 and mysite_d6), the following command will remove the existing book table from the D6 database and copy the one from the D5 database. [As usual, make sure you have full backups of both databases before you start playing around with mysql commands that drop tables.]

DROP TABLE IF EXISTS mysite_d6.book; CREATE TABLE mysite_d6.book LIKE mysite_d5.book; INSERT INTO mysite_d6.book SELECT * FROM mysite_d5.book;
prokopton’s picture

Thanks, ajzz.

sara78’s picture

Happened to me with Drupal7 too.

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.