Blog module was removed without any upgrade path, we should add a basic one in core:
- Update the {node_type} table so that the blog node type is owned by node module
(i.e. as if it's created by node_type_save() instead of blog module)Necessary to allow blog posts to be displayed properly and keep any field configuration intact.
- Migrate the 'create blog content' and etc. permissions
Might require updating the permissions tables since these are supposed to be associated with modules now.
We can't actually test 7.x-8.x upgrade paths until #1182290: Add boilerplate upgrade path tests is in, that issue is already critical though.
Comment | File | Size | Author |
---|---|---|---|
#87 | blog-upgrade-path-1263208-87-test-only.patch | 448.5 KB | Berdir |
#87 | blog-upgrade-path-1263208-87.patch | 449.91 KB | Berdir |
#75 | 1263208.patchonly.patch | 10.69 KB | BTMash |
#75 | 1263208.combined.patch | 449.55 KB | BTMash |
#74 | 1263208.patchonly.patch | 9.75 KB | BTMash |
Comments
Comment #1
catchComment #2
sunTodo list looks complete to me, can't see any other glitches or tasks.
Comment #3
catchActually one more but not for this issue.
If #1210366: Per-bundle node listing pages, blocks, feeds. gets in, we could enable blog node listings in the upgrade path, then alias /blog to /content/blog or wherever the blog node type is listed at.
That leaves contrib to add the blog/%uid path, links to someone's blog, and breadcrumbs.
Comment #4
xmacinfoWas the plan to direct the user to the contrib version of the blog module?
https://drupal.org/project/blog
Comment #5
catchWe should ensure the node type exists in core so people's nodes don't gt broken. For breadcrumbs and content listings I don't think we need to mention specifics in core but it'd be good to have in a change notification on d.o.
Comment #6
yeti22 CreditAttribution: yeti22 commentedHow will new individual users in a multiuser blog site be able to create individual blogs in a site upgraded from 6 to 8 - the contributed blog module will have "blog" content type as well as there will be existing "blog" content type? The users who were using individual themes in a multiuser blog site will be able to do so in the upgraded site?
Comment #7
xmacinfo@yeti22: I fear that all those things will be harder to create in D8, unless you follow this issue closely and help us out.
Comment #8
aiwata55 CreditAttribution: aiwata55 commentedI just started working on this issue. I seem to have succeeded in handling the {node_type} table update. Now after running update.php, the node type is associated with the node module in the {node_type} table.
However, I am now struggling with the permission issue. After running update.php following update of the code from D7 to D8, all the blog node type related permissions are gone.
I'm guessing the following:
- node_permission() returns all the node-related permissions such as 'create foo content' and 'edit own foo content'.
- The strings such as 'create foo content' and 'edit own foo content' are generated by node_list_permissions().
- The list of node types which are passed to node_list_permissions() are obtained by node_permissions_get_configured_types().
- node_permissions_get_configured_types() calls node_type_get_types() to obtain the list of node types.
- node_type_get_types() calls _node_types_build() to find available node types. In fact, I guess _node_types_rebuild() is called here.
- _node_types_build() checks what modules calls hook_node_info().
- Because the node module doesn't define the blog node type, all the blog node type-related permissions are ignored, although these permissions in fact remain in the {role_permission} table.
How to address this issue? Any idea?
Comment #9
catchCould you post the patch so far for changes to the node_type table?
The permissions issue sounds like the entry there might not be quite right, base should be 'node_content' I think. Maybe post a dump of that table as well?
Comment #10
aiwata55 CreditAttribution: aiwata55 commentedHere is my patch. I think it solved the two original problems.
Comment #11
BerdirI think this isn't necessary, just use {node_type} directly.
Arguments are usually passed directly to the function too, but this is fine too I guess.
$result usually indicates that this is a result resource, not an actual result. So it's better to use something like $blog_type, or whatever.
Trailing spaces on the line above the comment, one space too much on the second comment line after the //.
Actually, all you need to do is execute this query unconditionally. If there is no blog content type, it simply will not do anything.
Also, the '=' is the default argument and it is not necessary to make this explicit.
10 days to next Drupal core point release.
Comment #12
aiwata55 CreditAttribution: aiwata55 commented@11
Berdir, thank you for your comments. As you point out, I understand we don't need to "check" if a blog node type record exists in the node_type table, because after all my update function has a condition which does the same thing basically. Thus, I shortened my patch almost by half.
Comment #13
BerdirYes, exactly.
Comment #14
aiwata55 CreditAttribution: aiwata55 commentedLong break since my last update. My next goal is to write a test for the upgrade, and I tried to start working on it from scratch.
It turned out that the patch at #12 was not applicable, so I rewrote it. Basically I wrapped my code in a new system update function.
But because /includes/bootstrap.inc calls includes/entity.inc, which doesn't exist on D8, on the line 3009, we cannot easily upgrade D7 site to D8 at this moment. I would love to come back when the entity.inc issue is addressed.
Comment #15
Dries CreditAttribution: Dries commentedThis comment reads a bit cryptic. Otherwise this looks good to me.
Comment #16
adamdicarlo CreditAttribution: adamdicarlo commentedWhy are there curly braces { } in the table name string? Is this new for Drupal 8? It definitely isn't used for DBTNG queries in 7...
Comment #17
aiwata55 CreditAttribution: aiwata55 commentedMy understanding is that the curly braces are used to allow users to use table name prefix. With curly braces, Drupal's Database abstraction layer checks if the current Drupal installation is using any table name prefix. If it is, then the db abstraction layer adds the prefix to the table name just provided as a parameter. If it is not, then the db abstraction layer does nothing and execute db related functions.
But I can be wrong. Hope someone with more knowledge of Drupal programming adds his/her comments.
Comment #18
sunThe curly braces are only needed when doing plain SQL statements with db_query(). When using abstracted DBTNG functions and methods, they need to be omitted.
Comment #19
Dries CreditAttribution: Dries commentedI'm adding the 'Novice' tag because taking the existing patch and implementing the feedback shouldn't be too hard.
Comment #20
Dave ReidSo question - how the heck is http://drupal.org/project/blog supposed to work if this lands?
Comment #21
BerdirWe're not dropping the blog type, we just change it so that node.module is reponsible for rendering the view, forms and stuff so that it is possible to view and change existing blogs on your site.
If you then install blog.module from contrib, it should be able to easily set module and base back to blog for that type in update hook (assuming that we're keeping the info in the system table if you had blog.module installed and the install/enable hook if not).
Comment #22
kathyh CreditAttribution: kathyh commentedUpdates per #15 and #18 in addition to d8 /core update.
Comment #23
kathyh CreditAttribution: kathyh commented#22 has been re-attached with correct comment # in patchname.
Comment #24
catchThanks for the re-rolls.
The next thing here is populating the d7-filled database dump with blog module enabled and at least one blog node, along with a testing addition to make sure that node continues to function after upgrade.
@Dave Reid, if the contrib blog module still uses hook_node_type then it should be fine to put this back to being owned by that if the module is installed. If it switches to node_type_save() then I don't think this would impact anything?
Comment #25
BTMash CreditAttribution: BTMash commented@xjm asked me to chime in on getting a populated dump and the shell script I use is the following (please note that you need drush installed on your system)
This will help speed up the process in generating dumps. However, what needs to be edited is the generate-d7-content.sh file so we need to save another type of content which we can then test against. I think the change would be
Yes, it needs to be rolled into the patch and tested.
Comment #26
joachim CreditAttribution: joachim commented> So question - how the heck is http://drupal.org/project/blog supposed to work if this lands?
Well that would put you in the situation at #468976: Module-defined bundle is not installed when a custom with same name already exists.
Comment #27
ZenDoodles CreditAttribution: ZenDoodles commentedComment #28
xjmThis doc should help:
http://drupal.org/node/1429136
Also, for comparison:
#1280792-55: Trigger upgrade path: Node triggers removed when upgrading to 7-dev from 6.25
Comment #29
BerdirOk, here we go. Removing Novice tag, it wasn't that easy :p
The attached patch updates the gzipped filled database structure and adds a simple check to verify that the upgrade did what it's supposed to. Also updates the generate script to generate some blog nodes. I noticed that there seem to have been made a bunch of cleanup changes to that script which are only in the 7.x branch. No idea why.
The patch has been generated with "git diff 8.x -c > upgrade_blog_with_tests.patch", never made a patch with binary changes before, tell me if I need to change anything.
Comment #31
xjmThanks Berdir! Unfortunately the patch seems to be full of gobbletygook. :) Did you use --binary?
Comment #33
BerdirLet's try again with binary.
Comment #35
BerdirLooking at the diff, I guess the problem is that my filled dump installed *all* (the previous one did not) modules and then the language dump tries to install locale on top of it.
Will look into it later.
Comment #36
BTMash CreditAttribution: BTMash commentedAh, I see. In #1352000: Forward-port upgrade test clean-ups from 7.x to 8.x, the goal was for its structure to be similar to how things were set up for 7.x. We'd have 2 sets of dump (one on minimal profile with bare/filled dumps, the other with a standard profile + all modules also with bare/filled dumps). That issue needs to get fixed up and hopefully it can help out with this one as well (I imagine you might be able to use your dumps with a minimal profile?)
Comment #37
BerdirUnassign myself until the blocking issue is dealt with :)
Comment #38
xjmI don't think it's blocking this one... we just need to look a bit more closely in what we're putting in the dumps.
I'll try to look at it this weekend as well; not assigning to myself though in case I don't. :)
Comment #39
BTMash CreditAttribution: BTMash commentedI haven't looked at this patch or tried to roll anything with this. But I did make some changes to the language.database.php.patch file so it doesn't act so rudely. It either needs to get rolled in here or in the forward-port issue (but posting here for now so someone will take a look).
Comment #40
BTMash CreditAttribution: BTMash commentedSetting to needs review.
Comment #42
BTMash CreditAttribution: BTMash commentedAck, this should get combined with #33. Try again.
Comment #44
BTMash CreditAttribution: BTMash commentedChanging the update number so its not conflicting with a function update number in core.
Comment #46
cosmicdreams CreditAttribution: cosmicdreams commentedPatch in #44 forgot to add the database that the #42 had. That's why the files sizes are so dramatically different.
Comment #47
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedRebased, updated upgrade function counter, redumped the database. Not sure if I did the latter right.
Comment #48
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedComment #50
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedThis time really with "updated upgrade function counter".
Since Node module is now optional, should we check the table exists, in case someone does this update D8 to D8?
Comment #51
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedComment #53
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedOh dear: old patch, wrong patch, accidantely changing component, cross posting with testbot. Right patch, this time.
Comment #55
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedOk. We're back to #35. Not sure how to solve it, but the patch applies again. This is the error when running the test locally:
Comment #56
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedAlright, yes. Instead of enabling all modules, enable only those that were enabled for the old dump.
Now were getting real fails for this blog module upgrade test.Or real fails because I forgot to enable the Blog module before dumping.Comment #58
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedOk. With that it passes locally.
What else needs to happen?
Comment #59
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedNotes to myself: Rewrite this
and remove the empty line:
Comment #60
Lars Toomre CreditAttribution: Lars Toomre commentedRegarding #58.1, I would recommend that a version of the upgrade tests should be run with a profile that includes "only" the required Drupal modules enabled (ie with the node module disabled since it is intended to be optional).
Comment #61
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedThanks to @xjm for helping with the doxygen.
Edit: Crosspost with #60: I asked in IRC: Since Node module was required in D7 the question is basically: Do we support D8 -> D8 upgrades yet? The answer is no. (Once we have an unstable release that answer would depend on #1333898: Support unstable2unstable upgrades? [policy, no patch].) So for now, we can go with the patch as is.
Comment #62
BTMash CreditAttribution: BTMash commented@Lars Toomre, what you asked for belongs in http://drupal.org/node/1352000 which requires 4 dumps to be created.
Comment #63
Berdir#61: 1263208-blog-upgrade-60.patch queued for re-testing.
Comment #65
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedReroll after #1352000: Forward-port upgrade test clean-ups from 7.x to 8.x.
Comment #67
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedNone of the module combinations are working for me. New instructions to create the dumps needed ;)
Comment #68
BTMash CreditAttribution: BTMash commentedSorry I did not take a look at this sooner.
The changes from the last 'forward port D7 upgrade path test changes to D8' is likely to have messed around with this issue. I'll make some time for it this and next week to see what needs to change back.
Comment #69
BTMash CreditAttribution: BTMash commentedSorry for not being able to get to this sooner than I would have liked. First, I want to separate out the patch from the dump. So in the event we need to do a reroll in the future, it is easier to work with.
Comment #70
BTMash CreditAttribution: BTMash commentedI'm revising the patchonly portion as there were a few fixes needed in there:
node_type_get_type
no longer exists. The most suitable equivalent seems to benode_type_load
.And I am attaching the combined patch with the new db dump based on the new generate-d7-script (which will also need to be updated for D7 when we create any dumps in the future. As such, we will need to create a backport patch only for the script once this is in D8).
Finally, unassigned :)
Comment #72
BTMash CreditAttribution: BTMash commentedWow, that is a pretty messed up failure - I wonder if adding the new nodes had anything to do with it? Also...I see it asks for uid 6 in the testbase...I'll take a look into when that uid gets added in.
Comment #73
BTMash CreditAttribution: BTMash commentedI tried by changing the uid to 1 in drupal-7.language.database.php and it seems to work correctly. So it does seem to be tied to the uid being non-existent in the new dump. I'll do some further debugging in the dumps if a user with uid 6 exists.
Comment #74
BTMash CreditAttribution: BTMash commentedAnother update - the tests were failing because I had not generated the content. I found that even after I had created the content, however, the tests failed. That is because of conflicting nids. When poll module exists, nodes of type 'poll' get created as well - since we are now creating blog posts, the same happens. I've adjusted the nids of the i18n content. But I do see there is some other fail happening. I need to figure it out but I'm uploading the updated patch on its own + the zips.
Comment #75
BTMash CreditAttribution: BTMash commentedAha! It had to do with not updating the tnid to the new values. Attaching new patchonly version (which has the language.php change) and the combined.
Comment #76
tstoecklerI read some of the comments above and it is not entirely clear to me why we need to change the nids etc. around. It seems at first glance that only the first and last hunks are needed for this patch. Can you elaborate, please?
Comment #77
aspilicious CreditAttribution: aspilicious commentedThe nids are probably incremented because of a longer for loop (12 instances).
Dunno why the vid is incremented by 20
22 days to next Drupal core point release.
Comment #78
BTMash CreditAttribution: BTMash commentedYep, the nids are incremented due to the longer loop - same goes for the vid. I'm not completely sure on what the vid increases by (atleast 12 is certain, but it doesn't seem to be harmful given that we are increasing the vids by 5 in between each nid). I can try and figure out what the vid should be though if that would be better.
Comment #79
BTMash CreditAttribution: BTMash commentedI'm not sure which order this issue should be in, but perhaps we should wait for any further work on this until #1619898: Convert upgrade tests to PSR-0 gets in?
Comment #80
tstoecklerWell this one is marked critical, so when it's ready I think it should have first priority.
So far, the patch without tests has never successfully failed. Otherwise this would be RTBC.
(BTW thanks for #77/#78, that makes sense.)
Comment #81
aspilicious CreditAttribution: aspilicious commentedThis can go in first. If it's done before the other one. I can reroll.
Comment #82
BTMash CreditAttribution: BTMash commentedHmm, that would mean our tests need to be more robust :)
The patch that would just be the test would be all the stuff without the update in system.install. Looking at this...it might be more worthwhile to have another test case so we can flesh out testing for the blog move. How does that sound?
Comment #83
tstoecklerWell, as far as I can see, the tests-only patch so far never successfully applied. I don't know if it would actually pass (which would be bad in that case).
Comment #84
BTMash CreditAttribution: BTMash commentedAre you referring to the patch-only version? My guess is that would be because of the binary diff chunks that are in there. I'll look into this sometime tomorrow in any case :)
Comment #85
webchick#75: 1263208.combined.patch queued for re-testing.
Comment #87
BerdirOk, re-rolled.
The test-only patches now also contains the binary diff of the dump files and should therefor apply and the language tests should pass. I could leave them out but then would the language tests fail.
The complete patch also contains the changes in the generate script and system.install.
I don't know if there have been any changes to these dumps in other issues. I hope not.
Comment #88
aspilicious CreditAttribution: aspilicious commentedDoes this need manual testing? If yes please provide me with a test plan and I'll do it :)
Comment #89
BerdirManual testing should involve something like this I guess:
- Create Drupal 7 site
- Enable blog module
- Create some blog posts
- Upgrade to Drupal 8
- Make sure that you can still view and edit your blog posts.
Comment #90
aspilicious CreditAttribution: aspilicious commentedOK I tested the upgrade path and it works :)
I reviewed the changes and they are prety simple, so marking this rtbc!
Comment #91
chx CreditAttribution: chx commentedI am not removing the RTBC yet but why do we patch the base dump? In D7 we used to add small dumps for invidual tests.
Comment #92
sunFWIW: The only actual upgrade path change in this patch is:
This looks correct to me.
We do not seem to provide a upgrade path for the remainder of the Blog module functionality; e.g., per-user blog views, also containing a per-user link to create a new blog post on that view. But of course, there's hope that Views in core will be able to replace + provide just that.
And yes, the upgrade path dump diffs are still a PITA. But for now, I couldn't care less. We have a completely different approach in the pipeline for some time already in #1364798: Impossible to generate meaningful diffs of upgrade db dumps, but even though I initiated that approach myself, I deferred/ignored it recently, because it involves quite some advanced usage of our current test framework, and I want/need to figure out the future of our test framework first, before possibly entering a path/direction that might be incompatible (or not).
In short: Another +1 on this. Time to finally get rid of this issue.
Thanks everyone who has worked on this! :)
Comment #93
Dries CreditAttribution: Dries commentedCommitted to 8.x. Thanks. I think this is done now.
Comment #94
cweagansFixing tags per http://drupal.org/node/1517250
Comment #95
catchThis one doesn't need a D7 backport for anything fortunately.
Comment #96
BerdirFrom comment #70:
If that is still true then there is something to backport?
Comment #97
catchOK let's move it back just in case!
Comment #98.0
(not verified) CreditAttribution: commentedUpdated issue summary.