When creating a new revision for a question node (manually), the ->save() method for the question controller is being called, which executes a drupal_goto(). Effectively none of the code after line 1173 of the node.module (as well as any other hook_node_update/hook_update implementations) is being executed due to the redirect. This includes a resetCache call to the node entity controller - the new node revision is never being cached, so subsequent load-calls are loading the old vid of the question. Other issues could also arise due to other modules (as well as node core) code not being executed.
There's a risk for loss of data, due to hooks with a weight higher than quiz not being called, and the following code from node.module NEVER being called when creating revisions for questions:
// Save fields.
$function = "field_attach_$op";
$function('node', $node);
module_invoke_all('node_' . $op, $node); // << This is where the redirect takes place in the latest dev, code below this line isn't called
module_invoke_all('entity_' . $op, $node, 'node');
// Update the node access table for this node.
node_access_acquire_grants($node);
// Clear internal properties.
unset($node->is_new);
unset($node->original);
// Clear the static loading cache.
entity_get_controller('node')->resetCache(array($node->nid));
// Ignore slave server temporarily to give time for the
// saved node to be propagated to the slave.
db_ignore_slave();
}
catch (Exception $e) {
$transaction->rollback();
watchdog_exception('node', $e);
throw $e;
}
Comment | File | Size | Author |
---|---|---|---|
#3 | drupal_goto_called_form_submit-2423363-3.patch | 2.59 KB | FreekVR |
Comments
Comment #1
FreekVR CreditAttribution: FreekVR commentedComment #2
FreekVR CreditAttribution: FreekVR commentedComment #3
FreekVR CreditAttribution: FreekVR commentedThe attached patch moves the redirect to the form_state array, resolving the issue.
Comment #5
djdevinGreat, this is the better way to do it. Fixed.