Feature #3189
closed
Feature #3177: Upgrade bbPress to 2.x
Migrate forum attachments to bbPress 2.x / GD attachments
Added by Boone Gorges over 10 years ago.
Updated almost 10 years ago.
Category name:
Group Files
Description
Our current bbPress (1.x) implementation uses the following homegrown plugin to store forum post attachments: http://wordpress.org/plugins/forum-attachments-for-buddypress/ As part of the migration to bbPress 2.x, we'll need to migrate this content. Brief outline of the approach:
- Reverse engineer how the GD plugin stores attachments
- Ensure that our bbPress 1.x-2.x migration keeps track of old post IDs, so we have the necessary data to do the migration (Ray, maybe you know off the top of your head whether this is the case)?
- Write a script to do the necessary migration. This will involve both moving the files themselves (from the current bb-attachments directory), as well as recording the attachment metadata. Hopefully the GD plugin has good API-level functions we can use
- Ideally, we'll maintain backward compatibility with permalinks. Old attachment URLs look like this: commons.gc.cuny.edu/wp-content/plugins/forum-attachments-for-buddypress/download.php?filenum=2948. Probably the simplest idea is to rewrite that download.php script so that it looks up old file attachment 2948 and then redirects to the proper URL. To make it a bit prettier and more portable, I could couple it with a .htaccess rewrite rule that would direct these download.php requests to a handler that doesn't depend on the old plugin file being there, and then do the redirect. Note that this technique will require keeping track somewhere (postmeta?) of the old "filenum" data.
- Tracker changed from Bug to Feature
- Ensure that our bbPress 1.x-2.x migration keeps track of old post IDs, so we have the necessary data to do the migration (Ray, maybe you know off the top of your head whether this is the case)?
bbPress 2 is smart enough during conversion to record a new post meta entry called '_bbp_post_id'
for forum replies and '_bbp_old_topic_id'
for forum topics, which references bbPress 1's post IDs. These can then be used by a migration script to do their thang.
You might want to take a look at a similar plugin I wrote to migrate attachments from u BP Forum Attachments to bbPress 2. I didn't copy the attachments over to WordPress or a bbPress forum attachment plugin because at the time, we didn't decide whether GD was good enough.
In particular, the migration and admin tool code should be handy to look at.
Thanks for linking to your repo, Ray - it was a helpful data point.
https://github.com/castiron/cac/commit/e59be24140493a9700c2b4511530dd0b8f4280f9 contains the following:
- the GD bbPress Attachments plugin
- my cac-bbpress-attachments-bridge plugin, which contains a migrator as well as a backward compatibility fix for old URLs
- a change to .htaccess that allows us to remove forum-attachments-for-buddypress
I'll deploy to cdev for testing as soon as it's back up.
- Status changed from Assigned to Resolved
- Status changed from Resolved to Assigned
- Assignee changed from Boone Gorges to Raymond Hoh
Ray - One last note about this. GD was being kinda greedy about when it displayed its content, and was putting it into the bbp-live-preview AJAX request. I fixed it like this https://github.com/cuny-academic-commons/cac/commit/8c6bb7f1439f8a6e40d791064b367b07ca4f5e9a. I think it would probably be harmless to put this into the bbp-live-preview plugin (this is a fairly popular add-on, I think), but if not, maybe you could put a do_action() right there, so I can avoid touching the GD plugin. Let me know what you think, and I'll reclose this ticket.
Thanks Boone! I've added your GD bbPress Attachment changes into the bbp-live-preview plugin.
- Status changed from Assigned to Resolved
Also available in: Atom
PDF