Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After upgrade from Drupal 4.6 to 4.7 Beta 2, primary and secondary links do not display anymore. Adding items to the new primary and secondary menus (?q=admin/settings/menu) DO NOT help either.
The solution is to get the menu id's from administer->settings->menus, and run the following PHP code:
variable_set('menu_primary_menu', 133);
variable_set('menu_secondary_menu', 134);
Best regards.
Frank
Comment | File | Size | Author |
---|---|---|---|
#19 | updates.prim.sec.links_0.patch | 1.55 KB | tenrapid |
#18 | updates.prim.sec.links.patch | 1.5 KB | tenrapid |
#12 | primary_links_update_1.patch | 1.52 KB | Richard Archer |
#11 | primary_links_update_0.patch | 900 bytes | Richard Archer |
#5 | primary_links_update.patch | 4.24 KB | Richard Archer |
Comments
Comment #1
Richard Archer CreditAttribution: Richard Archer commentedThe update script is supposed to copy links from the theme into the menu and only if some items were copied it sets those variable.
So, the obvious question... were links copied into the menu correctly?
admin/settings/menu also provides an interface for setting those variables.
Comment #2
naudefj CreditAttribution: naudefj commentedThank you very much for the reply! The update script did not copy any links from my theme into the menu.
After the update the "variable" table still contains exactly the same values for "phptemplate_primary_links" and "phptemplate_secondary_links".
Comment #3
Richard Archer CreditAttribution: Richard Archer commentedThat's because the update script looks for variables 'primary_links' and 'secondary_links'.
Can you see how your variables got 'phptemplate_' prepended? I can't see how that can happen... or how the links could work if it did!
Comment #4
naudefj CreditAttribution: naudefj commentedNow, that is a very good question. Probably because I'm using a PHP template with Drupal 4.6. Does the update procedure cater for both phptemplate and xtemplate themes?
Anyway, searching for 'phptemplate_primary_links' on Google returns about 99 links, so other people may have the same problem.
Comment #5
Richard Archer CreditAttribution: Richard Archer commentedHere's a patch to update.inc that does a better job of importing links. I'm upping the issue status to critical because the current update script loses the links in a number of situations. Even if this version still has problems it has to be an improvement!
It still won't import xtemplate links which are stored as a string... but it now leaves them in the theme_settings variable so they can be recovered if needed.
Difficult patch to test, this one. Nearly sent me mad debugging it! I hope someone volunteers to review it :)
Comment #6
naudefj CreditAttribution: naudefj commented+1
After applying your patch, my primary and secondary links were successfully migrated to Drupal 4.7 beta2.
Comment #7
Dries CreditAttribution: Dries commentedCommitted to HEAD. Thanks.
Comment #8
(not verified) CreditAttribution: commentedComment #9
naudefj CreditAttribution: naudefj commentedThis problem is back in Drupal 4.7 beta 3. Looks like some changes were committed after this patch that broke the primary and secondary links upgrade again.
Comment #10
Richard Archer CreditAttribution: Richard Archer commentedIt's funny how the upgrade script has caused more problems than the actual patch!
This patch: http://cvs.drupal.org/viewcvs/drupal/drupal/database/updates.inc?r1=1.17... should not have changed the way phptemplate links are imported... it only effects way the theme_settings variable is processed.
What the upgrade script does is:
gets the phptemplate_primary_links variable
gets the phptemplate_primary_links_more variable
if theme_settings['primary_links'] is an array, gets it
if theme_settings['primary_links'] is not an array, parses links from xtemplate format
It then merges these all together and adds the links to the primary links menu. And repeats for secondary links.
I don't see how this process could fail... provided all the links are in the expected variables.
Could you perhaps email me a dump of the variables table from your 4.6 database?
drupal.org@juggernaut.com.au
Comment #11
Richard Archer CreditAttribution: Richard Archer commentedOK, I've had a look at this and it looks like the data should be imported correctly but that under some circumstances (php_template has the links toggle on but theme settings has it off) the new primary links variables won't be set up correctly. I seem to recall another issue raised which had a similar problem.
I'm not sure how to go about fixing this... it's hard to know whether to look at the theme_settings toggle or the phptemplate settings toggle... and there could be several different phptemplate settings, one for each installed theme!
It might be best to ignore the toggles and just display the links if any menu items were imported. Some users may need to go to admin/settings/menu and disable the new links.
The attached patch does that.
Comment #12
Richard Archer CreditAttribution: Richard Archer commentedAddition to patch: fixes some warnings when the variable phptemplate_primary_links_more is a string.
Comment #13
Dries CreditAttribution: Dries commentedCommitted to HEAD. Thanks.
Comment #14
(not verified) CreditAttribution: commentedComment #15
joel_guesclin CreditAttribution: joel_guesclin commentedI have just done an upgrade using a test database from 4.6.2 to 4.7.0-rc3. My theme is a phptemplate theme (based on box-grey) with several primary and secondary links defined. I thought from this thread that the problem had been resolved, but apparently not since after upgrading I have lost all my links.
Since I have multiple sites to maintain, all of which make extensive use of both primary and secondary links, this is a major issue for me - and it seems to me that since PHPtemplate has become the standard templating engine for Drupal it should certainly support moving the links during the upgrade (that was one reason I switched to a phptemplate theme in 4.6).
A more minor issue is that the default URL associated with the default "edit primary links" appears to be broken: it is "http://localhost/drupal-4.7.0/%3Fq%3Dadmin/themes/settings%22+class%3D%2..."
Comment #16
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedI've updated a 4.6.x test database to CVS head and cannot reproduce the issue.
I did the following:
install 4.6 phptemplate
install 4.6 box_grey
create primary and secondary links
switch back to bluemarine
update
result:
All links got properly migrated
Comment #17
tenrapid CreditAttribution: tenrapid commentedTo reproduce do the following:
- install 4.6 drupal, phptemplate, box_grey
- go to admin/themes/settings/box_grey
- create primary/secondary links there
- update
-> the phptemplate specific links are gone
Comment #18
tenrapid CreditAttribution: tenrapid commentedHere is a first try.
Responsible for the issue is this line in system_update_151()
$links = array_merge($phptemplate_links, $phptemplate_links_more, $theme_links);
Both arrays $phptemplate_links and $theme_links have the keys 'text' and 'link'. So the phptemplate links are overwritten. $phptemplate_links_more is bogus since it's only a helper variable.
Comment #19
tenrapid CreditAttribution: tenrapid commentedSlightly changed.
Comment #20
adrian CreditAttribution: adrian commentedThat is correct.
phptemplate_links_more is completely bogus.
it was the checkbox underneath the textfield grid that allowed you to get more fields.
I support tenrapid's patch.
Comment #21
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedapplied
Comment #22
Richard Archer CreditAttribution: Richard Archer commentedThanks guys, I thougt there was something fishy with that code.
This solution looks sound and works for me.
Good work!
Comment #23
(not verified) CreditAttribution: commented