As a followup to #1280792: Trigger upgrade path: Node triggers removed when upgrading to 7-dev from 6.25, we discovered that changes in hooks have resulted in missing enabled triggers during the upgrade from 6.x to 7.x. An example of this was with the node module where hook_nodeapi($op)
was changed to hook_node_op<operation>
. However, there may be other core modules which implement triggers that also run into the same issue (hook_comment($op)
was changed into hook_comment_op
). So we need to:
- Create additional tests. We are currently doing the testing for node operations. We should test for all other core triggers and make sure they are there when enabled. See the patch at http://drupal.org/node/1280792#comment-5801758 for how is should be done
- Implement whatever fixes are necessary to convert the old trigger hooks from 6.x into the new variant for 7.x
Comment | File | Size | Author |
---|---|---|---|
#24 | 1515212-14-trigger-path-24.patch | 18.39 KB | vijaycs85 |
#22 | 1515212-22-reroll.patch | 1.14 KB | welly |
#15 | interdiff.txt | 1.01 KB | xjm |
#14 | 1515212-14-complete.patch | 18.36 KB | xjm |
#14 | interdiff.txt | 1.01 KB | xjm |
Comments
Comment #1
BTMash CreditAttribution: BTMash commentedLooking through core, these are the following hooks/operations we should try and test on (this is based on a quick search for hook_action_info():
nodeapi(view, insert, update, delete)
comment(view, insert, update, delete)
user(view, insert, update, delete, login)
taxonomy(insert, update, delete)
Comment #2
BTMash CreditAttribution: BTMash commentedAlright, I'm adding a patch that consists solely of the tests. As an FYI, it fails on taxonomy. So something changed there. I don't know if there are other things I have missed, however. But this seemed like the easiest path to take and if someone could take a read through the tests to see if they make sense, that would be awesome.
Comment #3
BTMash CreditAttribution: BTMash commentedAnd here is a patch that should fix the trigger issue. Note: anyone else that is good with str_replace and the like is welcome to change it up. We just have to account for both 6.x and 7.x (so we need to also update the trigger update tests from 7.0 to 7.x)
Comment #4
BTMash CreditAttribution: BTMash commentedAck...forgot patch.
Comment #5
BTMash CreditAttribution: BTMash commentedAnd bumping this to major since trigger upgrade path for taxonomy triggers is currently broken.
Comment #6
BTMash CreditAttribution: BTMash commentedOk, I ended up finding some more hooks, and I fleshed out the update path tests for trigger from 7.0 -> 7.x as well. However, I can't figure out why the cron task does not update. Any help would be greatly appreciated.
Comment #7
BTMash CreditAttribution: BTMash commentedFinally figured out that the reasons for the fail were because I misspelled 'system'. Latest patch should pass.
Comment #8
xjmI think this is a bug since the upgrade is destroying data.
At first glance the test coverage looks great. I'd like to see the latest results of the test by themselves exposed on QA, so I'll try to upload a patch for that shortly.
Couple minor notes:
I think "Update path" should be capitalized here.
This is user-facing text, so I'd say something a little clearer. (Also update hooks get imperative verbs for the same reason; see http://drupal.org/node/1354#hookimpl.)
Perhaps "Update taxonomy hooks to new names." Something along those lines?
Leaving at NR since I haven't looked at the tests closely yet.
Comment #9
xjmAttached just cleans up the minor points above and includes the latest tests separately to expose the taxonomy failures.
Comment #10
xjmOh, for the next reroll, the inline comments also need to end in periods. :)
Comment #11
aspilicious CreditAttribution: aspilicious commentedTaxonomy vs trigger
Comment #12
xjmNo, actually. This is the trigger module updating the names of the taxonomy hooks in its database records to their Drupal 7 names. So the doc is correct.
Comment #13
catchTagging.
Comment #14
xjmAttached just tweaks the update hook doc slightly to avoid confusion like @aspilicious's in #11.
Comment #15
xjmNot sure what happened to the interdiff upload; one more time.
Comment #16
xjmHrm. I was about to update the doc here to mention cron too, but there is no
hook_cron_run()
in D6 or D7, nor can I find this grepping D6. Can you clarify where the value'cron_run'
would be coming from?Comment #17
BerdirThat's not a Drupal hook, it's a trigger hook, see http://api.drupal.org/api/drupal/modules%21trigger%21trigger.module/func... and http://api.drupal.org/api/drupal/modules%21system%21system.module/functi....
Yes, the hook is defined in system.module but called in trigger.module ;)
Comment #18
BTMash CreditAttribution: BTMash commented@xjm, This is actually initiated via
trigger_cron
(see http://api.drupal.org/api/drupal/modules!trigger!trigger.module/function... and http://api.drupal.org/api/drupal/modules!trigger!trigger.module/function...).As far as the update hook names...even though it is coming from the trigger module (hence the updates would be groups with trigger updates), it made sense to say what hook names in the db were being updated.
Comment #19
catchDowngrading this.
While some data gets lost during the upgrade path it's easy to just configure the triggers again - there's nothing irreversible here.
Also it's fairly minor compared to the configuration changes that usually need to be made when doing a major version upgrade.
Comment #20
readyman CreditAttribution: readyman commentedDrupalcon Sydney
Comment #21
readyman CreditAttribution: readyman commentedToo adventurous for our first attempt. Needs re-roll due to PSR-0
Comment #22
welly CreditAttribution: welly commentedHave re-rolled the patch. Please review!
Comment #23
ZenDoodles CreditAttribution: ZenDoodles commentedThank you @welly
Thanks for your patch, but it looks like there are some missing changes in other files?
We need the complete patch including the changes made in:
modules/simpletest/tests/upgrade/drupal-6.trigger.database.php
modules/simpletest/tests/upgrade/drupal-7.trigger.database.php
modules/simpletest/tests/upgrade/update.trigger.test
modules/simpletest/tests/upgrade/upgrade.trigger.test
modules/trigger/trigger.install b/modules/trigger/trigger.install
(Note: credit no_angel and damienwhaley too? http://core.drupalofficehours.org/task/1471)
Comment #24
vijaycs85Another re-roll...
Comment #25
Deciphered CreditAttribution: Deciphered commented@vijaycs84,
If possible, could you add an interdiff.txt (http://drupal.org/node/1488712, http://xjm.drupalgardens.com/blog/interdiffs-how-make-them-and-why-they-...) so the patch can be reviewed a little easier?