As per #1216094: We call too many things 'language', clean that up we are converting schemas and parallel APIs to use 'langcode' instead of 'language' where a language code is involved. The use of 'language' inconsistently for language objects and language codes in Drupal 7 keeps throwing people off the cliff and makes understanding the API much harder. The attach patch is for comment module and is a possibly rough start. Let's see how it fairs with a complete test suite.
No upgrade path yet.
Comment | File | Size | Author |
---|---|---|---|
#75 | 1410096-75.patch | 526 bytes | andypost |
#69 | 1410096-69.patch | 14.05 KB | Gábor Hojtsy |
#67 | 1410096-67.patch | 14.05 KB | kalman.hosszu |
#61 | 1410096-61.patch | 13.96 KB | Gábor Hojtsy |
#58 | 1410096-58.patch | 13.99 KB | Gábor Hojtsy |
Comments
Comment #2
Gábor HojtsyChanges based on test failures. locale.test referred still to $comment->language in its tests and language form altering also used 'language' in place of 'langcode'. Let's see this one.
Comment #3
Gábor HojtsyPatch still needs update path and testing in the update, since it seems like it is certainly not tested given that it passes without the update path.
Comment #4
fastangel CreditAttribution: fastangel commentedAttached patch with update path. Lack testing the update.I'm still working on test it.
Comment #6
fastangel CreditAttribution: fastangel commentedSorry
Comment #8
fastangel CreditAttribution: fastangel commentedWork to pass the tests of update.
Comment #9
Gábor HojtsyThanks for working on this! Regarding the added update code:
- we should drop the index first and then change the column name to be fully compatible with all databases supported; some databases don't like if you drop a column that takes part in an index :)
- I think this would be fine in a comment_update_8000() in comment.install, unless there is any special reason to do it in the bootstrap early; I don't think comments need to be loaded at that stage (unlike languages and path aliases), so we are fine running this update later as part of the standard update procedure; the bootstrap prepare updates are really special cases that we need to do early to even start up Drupal to update itself
Comment #10
fastangel CreditAttribution: fastangel commentedNew patch with comments of @gábor
Comment #11
fastangel CreditAttribution: fastangel commentedSorry. I have included change en robots.txt :D
Comment #12
Gábor Hojtsy@fastangel: all right, the update function looks right. Update path testing is still missing unfortunately. Here are some tips to get going with that:
1. core/modules/simpletest/tests/upgrade/ has database dumps and test files to test the update
2. drupal-7.filled.database.php.gz is the dump for a filled Drupal 7 database to test with
3. If you ungzip the file, you'll notice it has PHP code to produce the Drupal 7 database setup, it has several nodes but it does not have comments
4. Edit the file and add a dump of a comment in the Drupal 7 database form (you can use core/scripts/dump-database-d7.sh to generate a dump of a comment table and copy-paste the relevant data into the dump)
5. Create a diff of the ungzipped original version and the new version (for posting your changes)
6. gzip the new version
7. Change the test in the upgrade_filled.test code to drupalGet() the node that you've attached the comment to, and check if the comment displayed. Also do a comment_load() on the comment to ensure that it loads and has the expected langcode value.
8. Enable the Testing module and run only the filled upgrade test (from under the Upgrade tests on Admin » Configuration » Testing), ensure it passes.
9. Do a git diff with
git diff --binary
so you get the diff of the gzip file as well to post.This is about it to complete this patch. Can you try and look into making this addition? (Without update testing the patch is not committable because it does change the schema and ensuring it worked on an updated site would be important).
Comment #13
fastangel CreditAttribution: fastangel commentedOk perfect. I'm working on it.
Comment #14
Gábor HojtsyTagging as current focus.
Comment #15
fastangel CreditAttribution: fastangel commentedAdapted patch to the latest version. Modified binary with comments. Missing perform the test.
Comment #16
fastangel CreditAttribution: fastangel commentedChanged a needs review for testing. In my machine I always get error with path update :(
Comment #18
fastangel CreditAttribution: fastangel commentedAttached new patch with pass test.
Comment #20
Gábor Hojtsy#comment-1 is not needed here, the URL path is absolutely enough.
You can just put comment-1 right there in place of :comment_id.
The t() in the assertTrue() should have a message that applies to the *success*. So it should say "Comment 1 found after update." or something like that.
The t() is almost good here. Since we are checking for the langcode property specifically, we can say t('Comment 2 has a language code.')
I also don't see why you'd need $this->commentExists()? You can just do !empty($comment->langcode).
Comment #21
fastangel CreditAttribution: fastangel commentedNew patch attached
Comment #23
fastangel CreditAttribution: fastangel commentedSorry.
Comment #24
fastangel CreditAttribution: fastangel commentedComment #26
fastangel CreditAttribution: fastangel commentedSorry. Today not is my day.
Comment #28
Gábor HojtsyI ran the tests. They seem to result in
Which seems to be a stock case of the class registry not being refreshed on the D8 update as far as I see or at least the test is not getting refreshed data when it attempts to run the comment API function. If you don't call the comment API directly from the test (ie. you only do the /node/28 drupalGet() test, NOT the comment_load() test), it is not an issue, so I suspect a local registry cache is the culprit.
So let's work with drupalGet() for now instead of trying to work around the particularities of the test system.
Then the second problem seems to be that node/38 does not exist. If you run the tests, i.e unable Testin module locally, go to Admin > Config > Testing an pick the Filled upgrade test from under the Upgrade tests, you get this at the end https://skitch.com/gabor.hojtsy/gh9t2/test-result-d8x.localhost. This basically says the node/38 is a 404. Looking at the DB dump, node 38 seems to be testing a node without a body field which is not in fact updated. That sounds reasonable IMHO. So let's pick a node that actually appears after the update and test with that!
Let me know if you need more help!
Comment #29
Gábor Hojtsy@fastangel: do you intend to keep working on this or should I try and find someone else to help?
Comment #30
fastangel CreditAttribution: fastangel commentedHi @Gábor,
I am working in this issue. This afternoon I will attach new patch. For now I don't need help.
Regards.
Comment #31
fastangel CreditAttribution: fastangel commented@gábor Then For the first problem "cache in comment". I try get comment with other form?. For second problem. Do you prefer that I add body to node 38 or use other node?
Regards.
Comment #32
Gábor Hojtsy@fastangel: 1. To directlyy get a comment, you can invoke its edit page too, at least to check it works. 2. Lets pick a different node that has a body (and does not have comments turned off). Thanks for your work!
Comment #33
fastangel CreditAttribution: fastangel commentedI attach new patch.
Comment #35
Gábor Hojtsy@fastangel: I think we discussed above that comment_load() would hardly work in this update environment without a lot further tweaking. Can you please re-read my suggestions in #28? Also, it would be superb if you could write a few notes on what have you changed instead of just stating you upload a new patch. That you did upload a new patch we can see anyway from the attachment! More communication can help push issues along a great deal. Thanks!
Comment #36
fastangel CreditAttribution: fastangel commentedOk. I have a one question. For second test (I will check the language of comment). I get the page for find the langcode?. About the last patch I attached:
Sorry for attached a lot of patch. You are right that is spreading much without comment.
Comment #37
Gábor Hojtsy@fastangel: I think we also agreed above that you'd pick another existing node instead of changing the database dump for nodes. The nodes represented there are supposed to give a variety of update scenarios, and if you modify them at will, their test coverage will weaken. There must be a node among the 38 that can have comments and is published, right? Why mess around with what you have when you can pick a different one. I suggested this above in #28 and #32, now I'm suggesting it a third time.
On the comment_load() we figured out above that we are better off not trying to fix the whole testing environment but just read a different data source to verify it worked. I'd say the node test in the first place would pretty well ensure the langcode is there since the new code uses langcode all around and would spit out various notices if it would not work. If you want to be very specific to test if the right language code is used, you can write a direct DB query to avoid the update issues as well. That way the node test would test the whole cycle of attachment to nodes with language and then the db query would test for the langcode. Something like:
(Instead of the comment_load()). And then check the langcode as with the existing assert() that is in your patch.
Comment #38
fastangel CreditAttribution: fastangel commented@gábor: For one test. I thought use the exist node but all nodes en database have field comment is 0 (not active) Hence, I considered creating a new node. I change a node that has the active comments?. Or leave them closed and add the comment?.
Ok for second test I change the comment load for one query to database.
Sorry to make you lose so much time with these questions.
Comment #39
Gábor Hojtsy@fastangel: if all nodes are marked to not allow comments, it sounds fine to add a whole new node to test this to make sure we are not stepping on other toes.
Comment #40
clemens.tolboomI cannot apply the patch from #33.
Trying to follow the spirit of http://xjm.drupalgardens.com/blog/rerolling-drupal-8-core-patches I tried
I guess the commit hash is the wrong one.
Comment #41
fastangel CreditAttribution: fastangel commentedI review the path and works with the latest checkout of 8.x. I am currently working on changes spoken with Gabor in the previous comments.
Comment #42
Gábor HojtsyI think this fails due to recent changes in the DB dump. I looked into how the DB dumps are managed in D7 and there seem to be great componentization there that we could leverage there, with the smaller dumps not even gz-ed, so we can patch them better. See http://drupalcode.org/project/drupal.git/tree/refs/heads/7.x:/modules/si...
To me it looks like we should migrate to that model sooner than later to avoid this continued need to reroll the update dumps (and post them as binary patches). We can either do it here or in #1357918: Missing update for language_default in language langcode update and then work with that setup for further language tests. Clemens, would you be interested to help out with that?
Comment #43
fastangel CreditAttribution: fastangel commentedI attached new patch. The changes of patch:
Passing the test (upgrade) locally I have a problem: "The test did not complete due to a fatal error.". I think this has to do with what @gábor speaks at # 42. If you enlighten me a bit I think I can help.
Comment #45
clemens.tolboom@Gábor ... the componentization of db dumps still in gz format only helps a little.
I added a comment to #1182296: Add tests for 7.0->7.x upgrade path (random test failures) http://drupal.org/node/1182296#comment-5560684 as I don't understand the gz dumps for db files. There is probably a motivation for this so hope to hear more about that.
This http://drupalcode.org/project/drupal.git/commit/730f77f2f9ed5030f392d7d8... is the initial git addition of the test files.
Comment #46
Gábor Hojtsy@clemens: the D7 dumps I linked mostly dont use gz and are easier to diff/patch.
Comment #47
clemens.tolboom@Gábor regarding the 'Can you help with that?' question.
I have no clue yet how to do this. In #12 you put the steps about what to do. I'm happy to make a book page for that. Any clue where to put that page?
Checking http://drupal.org/simpletest the http://drupal.org/book/export/html/29571 to find out it does not contain the word 'upgrade' :(
Comment #48
clemens.tolboom@Gábor: what link you are refering as http://drupalcode.org/project/drupal.git/tree/refs/heads/7.x:/modules/si... contains for D7 only gz files like drupal-7.bare.standard_all.database.php.gz ... or am I missing something.
Comment #49
Gábor Hojtsy@clemens: well, there are various non-gz files there, like http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/modules/si.... If you look at how they are used (http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/modules/si...), you'll see they are loaded on top of the filled database and then used for testing. In effect, the filled database is a common default for all kinds of update test, where the actual sub-feature tests are componentized into their own add-on database dumps. I'm working on that to introduce in #1357918: Missing update for language_default in language langcode update hopefully later today. Stay tuned :)
Comment #50
clemens.tolboomLol ... so *.test are also db containers ... tnx
Regarding #47 : do you have a book page for this upgrade testing?
Comment #51
Gábor Hojtsy@clemens: I wrote this doc page based on your excellent questions: http://drupal.org/node/1429136. Also introduced easier to diff componentized language test files in #1357918: Missing update for language_default in language langcode update, so I think we should postpone this on that change. I hope it will be in quick, so we can move on with this.
Comment #52
Gábor HojtsyTagging for the content handling leg of D8MI.
Comment #53
Gábor HojtsyGreat, #1357918: Missing update for language_default in language langcode update landed, so now we can continue fixing the tests. @fastangel: can you continue work on this?
1. Good new is that you should not touch drupal-7.filled.database.php.gz anymore. Leave that alone.
2. All the db dumps you added to that gz before now should be added to the drupal-7.language.database.php file in the same directory. This is not gziped so we should be able to review your changes much easier, it should be easier to roll the patch itself and it will result in much smaller patches.
3. All other things we discussed above should still be fine.
Thanks for helping with this!
Comment #54
Gábor HojtsyNeeds tests as in test cleanups.
Comment #55
Gábor HojtsyWorking on fixing that update test, since @fastangel apparently dropped the ball.
Comment #56
fastangel CreditAttribution: fastangel commentedSorry. I've been very busy these days. If it's okay, I can get to work on it tomorrow.
Comment #57
Gábor HojtsyWith tests that actually pass. The test now uses the uncompressed dump, so we can have a full reviewable diff.
- added node 38 to the dump
- added comment 1 and comment 2 to the dump
- extended test to check for node 38 and both comments on the node page and checking the comment schema directly too
Passes upgrade tests on my machine. Please review!
Comment #58
Gábor HojtsyMinor code comment update.
Comment #59
Gábor Hojtsy@fastangel: please use your available time to review the patch and if you think it properly tests the upgrade functionality! Let's move this forward finally!
Comment #60
fastangel CreditAttribution: fastangel commentedHi,
To verify that there is the first comment. It would be best to check the route comment / 1?
for everything else it all works perfectly and I checked all cases.
Regards
Comment #61
Gábor Hojtsy@fastangel: We use these to check for the unique comment titles. What would comment/1 give us on top of that?
(Attached patch fixes only the missing newline at the end of the DB dump PHP file, no other change).
Comment #62
fastangel CreditAttribution: fastangel commentedI meant to know if accessing the url of the comment gives no problem. But of course if it is found in the node would not make much sense.
Comment #63
kalman.hosszu CreditAttribution: kalman.hosszu commented@Gábor: I think the patch works well. If fastangel has the same opinion, the issue's status would change to RTBC.
Best
Comment #64
fastangel CreditAttribution: fastangel commentedHi,
For me and would be correct. :D
Regards
Comment #65
Gábor HojtsyRTBC based on both feedback comments above.
Comment #66
Dries CreditAttribution: Dries commentedThe patch in #61 does no longer seem to apply.
Comment #67
kalman.hosszu CreditAttribution: kalman.hosszu commentedI resolved the conflict, the new patch attached.
Comment #68
Gábor HojtsyComment #69
Gábor HojtsyFixed one minor typo. Interdiff would be:
Should not change RTBC status.
Comment #70
Dries CreditAttribution: Dries commentedCommitted to 8.x. Thanks.
Comment #71
Gábor HojtsyChange notice added at http://drupal.org/node/1450144, removing outdated tags.
Comment #72
andypostunder sqlite update does not works on one of testing sites...
will check latter, probably my testing site has some errors
Comment #73
Gábor HojtsyThe D7 schema has the language column, so that error sounds like it is an issue in your system. Also the code does attempt to add a comment_nid_langcode index, not a comment_nid_language index.
Comment #74
andypoststeps to reproduce
this happens only on sqlite
git log core/modules/comment/comment.install
details
Comment #75
andypostwe should drop comment_nid_language not comment_nid_langcode
Comment #76
Gábor HojtsyRight! So that is why it was looking for the old index. Duh. Trivial.
Comment #77
Gábor HojtsyTag again for sprint.
Comment #78
Dries CreditAttribution: Dries commentedCommitted to 8.x. Thanks!
Comment #79
Gábor HojtsySuperb, thank you.
We are closing in on having everything standardized like this. Fields are being worked on at #1439692: Rename field language properties to langcode, help welcome there!