The hook_node_info() prototype doesn't include any arguments. However, there is one for uc_product_node_info($reset = FALSE).

uc_product_node_info() saves its data in a static function variable so that if it is called twice, it doesn't need to reload its data.

Unfortunately, if an Ubercart node type changes in {node_type} between calls to uc_product_node_info(), the second call will return the static (incorrect) information. This causes Drupal's _node_types_build() to think that the modified record is not attached to any module, so it marks the modified record as disabled, which causes all sorts of problems.

Fortunately, the solution is simple. Just change

<?php
function uc_product_node_info($reset = FALSE) {
?>

to

<?php
function uc_product_node_info($reset = TRUE) {
?>

This causes the function to re-generate its info every time it is invoked from outside Ubercart. Calls within Ubercart can pass the FALSE.

I'll see if I can make a patch.

Files: 
CommentFileSizeAuthor
#3 1833812-node-type-cache-test-only.patch1.15 KBlongwave
FAILED: [[SimpleTest]]: [MySQL] 2,461 pass(es), 2 fail(s), and 0 exception(s).
[ View ]
#3 1833812-node-type-cache.patch1.55 KBlongwave
PASSED: [[SimpleTest]]: [MySQL] 2,463 pass(es).
[ View ]
#1 1833812.patch460 bytesDan Z
PASSED: [[SimpleTest]]: [MySQL] 2,453 pass(es).
[ View ]
#2 1833812-1.patch384 bytesDan Z
PASSED: [[SimpleTest]]: [MySQL] 2,453 pass(es).
[ View ]

Comments

Version:7.x-3.x-dev» 7.x-3.2
StatusFileSize
new460 bytes
PASSED: [[SimpleTest]]: [MySQL] 2,453 pass(es).
[ View ]

Ok, here's a patch.

To reproduce the problem.

To test the patch, just restore your database and repeat the above, and note that admin/structure/types now shows correct node type info and the DB record is correct and not disabled..

Now, let's see if this patch works.

Version:7.x-3.2» 7.x-3.x-dev
Status:Active» Needs review
StatusFileSize
new384 bytes
PASSED: [[SimpleTest]]: [MySQL] 2,453 pass(es).
[ View ]

A more performance-friendly (but riskier) way to do this is to put a call to uc_product_node_info(TRUE) into uc_product_node_type_update() after it updates {uc_product_classes}. That will force it to reload its static data when the node type changes. My test shows that this works.

I'm switching this to -dev to pick up #1831900, so this might make the testbot fail on the patch in #1. It's currently showing that it passed.

Version:7.x-3.2» 7.x-3.x-dev
StatusFileSize
new1.55 KB
PASSED: [[SimpleTest]]: [MySQL] 2,463 pass(es).
[ View ]
new1.15 KB
FAILED: [[SimpleTest]]: [MySQL] 2,461 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

Added a test that covers the manual steps in #1.

Status:Needs review» Fixed

Committed, thanks for tracking this down and providing the patch.

Status:Fixed» Closed (fixed)

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