Holger wrote: ↑Tue Apr 21, 2020 5:54 pm
Hi, I am using the ext gfksx/thanksforposts
I would love to switch to Reactions. But I dont want to loose the thanks. A migrator/converter would be great!
For anyone who wants to migrate from the "gfksx/thanksforposts" extension, as of version 3.2.15, to version 0.6.0-dev of this extension, the following worked for me. Your mileage may vary. I recommend trying this on a local dev copy of your forum to make sure it worked before you do it on your live database. I will take
no responsibility if your board gets messed up after following these steps. Proceed at your own risk.
The following query worked for me to convert all "thanks" from
Thanks for Posts to the default "Like" reaction type added by this extension. If you know how, you can modify the query so that it converts all thanks to a different reaction type; otherwise, just leave it as is.
(Note: It ran virtually instantly for about 19k 'thanks', but depending on the size of your board and how many thanks there are, it may take longer.)
Code: Select all
INSERT INTO phpbb_reactions (
reaction_user_id, poster_id,
post_id, topic_id,
reaction_type_id, reaction_file_name,
reaction_type_title, reaction_time
)
SELECT user_id, poster_id, post_id, topic_id, 1, '1f44d.png', 'Like', thanks_time FROM phpbb_thanks;
After running that, you will also need to resync the reactions for all posts. Out of the box the extension lets you resync the reactions per post if that post already has a reaction on it, but I didn't see a way to do that for all posts en-mass. So I added a console command that borrows code from the resync_reactions controller that does this for me.
I've attached the console command file here, and you will need to upload it to
ext/steve/postreactions/command/resync.php.
[The extension php has been deactivated and can no longer be displayed.]
You will also need to add the following service to the
ext/steve/postreactions/config/services.yml file and then clear the cache using the phpBB CLI:
Code: Select all
console.command.steve.postreactions.resync:
class: steve\postreactions\command\resync
arguments:
- '@user'
- '@dbal.conn'
- '%steve.postreactions.tables.reactions_table%'
tags:
- { name: console.command }
You can run the command using the phpBB CLI took as follows, from your board root:
php bin/phpbbcli.php cache:purge
php bin/phpbbcli.php reactions:resync-all
This command's runtime was almost exactly 1 minute per 1000 posts. I had roughly 6300 posts that had reactions, so it took roughly 6 and a half minutes. Your mileage may vary.
You should probably either put your board in maintenance mode while running this, or disable the Thanks for Posts extension before doing so, so that your users don't add new thanks after the fact that get lost.
Do not delete the data for the Thanks for Posts extension until the above SQL query is run, or you will
lose all thanks. So only
disable that extension until after you finish all of this.