Consider two modules, dummy1 and dummy2, with the following update functions:
function dummy1_update_6001() {
$ret = array();
if (!variable_get('dummy2_update_6001', 0)) {
$ret['#abort'] = array('success' => FALSE,
'query' => 'Dummy2 must be updated first');
return $ret;
}
variable_set('dummy1_update_6001', 1);
return $ret;
}
function dummy1_update_6002() {
$ret = array();
variable_set('dummy1_update_6002', 1);
return $ret;
}
function dummy2_update_6001() {
$ret = array();
variable_set('dummy2_update_6001', 1);
return $ret;
}
If you run update.php, the dummy1_update_6001 aborts and only dummy2_update_6001 runs. Then, rerunning the dummy1 updates succeeds - all three variables are set.
If you run drush updatedb, it should do both updates and all three variables are set. However, after dummy1_update_6001 aborts, dummy1_update_6002 is run immediately, setting the schema_version to 6002, then dummy2_update_6001 is run - it never goes back to dummy1_update_6001, and that variable never gets set.
I believe the problem is in _update_do_one() - the update function returns into $ret, but $context['results'][$module] is what's being checked for the #abort.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | drush_abort.patch | 1.56 KB | mikeryan |
Comments
Comment #1
mikeryanHere's a patch, seems pretty simple...
Comment #2
moshe weitzman commentedcommitted