Post Ratings - taking likes to the next level [Deleted]

This is an experiment that I decided to make today to import likes from this addon to XF2.1.

WARNING!! THIS IS AN EXPERIMENT AND THE CODE IS NOT FULLY TESTED. YOU SHOULD ONLY RUN IT ON A TEST BOARD OR AFTER MAKING A FULL BACKUP OF YOUR SITE.

It will try to import content from two tables:

dark_postrating_ratings: which includes the Title, Image URL, Display Order, Sprite Dimensions and Positions and Rating Type.
dark_postrating: which includes the actual ratings.

The titles of the imported reactions will have an 'Imported' suffix to help you identify them. It is highly recommended to close your forum before the import and edit the imported reactions afterwards to make sure everything looks good.

Instructions (read the whole post)

MAKE A FULL BACKUP OF YOUR SITE, THIS CODE IS AN EXPERIMENT.

The process is simple: Upload the file to the root of your forum and run it from your console (by running php import_post_ratings.php in your SSH console). You can also try to open the script in your browser but it will probably timeout unless you increase the PHP timeout limit. The script can take several minutes depending of the size of your database. Mine took like 10 minutes to import ~75k likes.

The final output should be something like:

76341 reactions imported. 300 errors.

If it does't show this at the end of the output it means that something happened and the script was terminated. This is why it is recommended to try it first on a test site or after making a full backup of your forum.

(The reported errors are usually deleted posts that doesn't exist in the database.)

Once the script is done check that the reactions were imported successfully and please report any problem you may have encountered. I will try to fix them for you.

IMPORTANT NOTE: you cannot run this script twice in the same database. It will reimport reactions and you will end up with duplicated likes. If something goes wrong, restore your database backup and try again.

Custom request and Import Services.

If you want me to perform the import for you or if you need a specific modification to this script, feel free to contact me and request a quote.

Feedback is always welcome.
 

Attachments

This is an experiment that I decided to make today to import likes from this addon to XF2.1.

WARNING!! THIS IS AN EXPERIMENT AND THE CODE IS NOT FULLY TESTED. YOU SHOULD ONLY RUN IT ON A TEST BOARD OR AFTER MAKING A FULL BACKUP OF YOUR SITE.

It will try to import content from two tables:

dark_postrating_ratings: which includes the Title, Image URL, Display Order, Sprite Dimensions and Positions and Rating Type.
dark_postrating: which includes the actual ratings.

The titles of the imported reactions will have an 'Imported' suffix to help you identify them. It is highly recommended to close your forum before the import and edit the imported reactions afterwards to make sure everything looks good.

Instructions

MAKE A FULL BACKUP OF YOUR SITE, THIS CODE IS AN EXPERIMENT.

The process is simple: Upload the file to the root of your forum and run it from your console (by running php import_post_ratings.php in your SSH console). You can also try to open the script in your browser but it will probably timeout unless you increase the PHP timeout limit. The script can take several minutes depending of the size of your database. Mine took like 10 minutes to import ~75k likes.

The final output should be something like:



If it does't show this at the end of the output it means that something happened and the script was terminated. This is why it is recommended to try it first on a test site or after making a full backup of your forum.

(The reported errors are usually deleted posts that doesn't exist in the database.)

Once the script is done check that the reactions were imported successfully and please report any problem you may have encountered. I will try to fix them for you.

Custom request and Import Services.

If you want me to perform the import for you or if you need a specific modification to this script, feel free to contact me and request a quote.

Feedback is always welcome.
Thanks a lot. I don't have a test forum so I can't test. Someone please try and update here of the outcome. Thanks
 
If you decide to test it yourself, please please make a backup of your forum in case something goes wrong. Good luck! :)
I mean, I would love to buy it's risky. Got 3m posts and no test forum. So I'll wait until it goes through some bug fixes and tweaking. Thanks again.
 
This is an experiment that I decided to make today to import likes from this addon to XF2.1.

WARNING!! THIS IS AN EXPERIMENT AND THE CODE IS NOT FULLY TESTED. YOU SHOULD ONLY RUN IT ON A TEST BOARD OR AFTER MAKING A FULL BACKUP OF YOUR SITE.

It will try to import content from two tables:

dark_postrating_ratings: which includes the Title, Image URL, Display Order, Sprite Dimensions and Positions and Rating Type.
dark_postrating: which includes the actual ratings.

The titles of the imported reactions will have an 'Imported' suffix to help you identify them. It is highly recommended to close your forum before the import and edit the imported reactions afterwards to make sure everything looks good.

Instructions (read the whole post)

MAKE A FULL BACKUP OF YOUR SITE, THIS CODE IS AN EXPERIMENT.

The process is simple: Upload the file to the root of your forum and run it from your console (by running php import_post_ratings.php in your SSH console). You can also try to open the script in your browser but it will probably timeout unless you increase the PHP timeout limit. The script can take several minutes depending of the size of your database. Mine took like 10 minutes to import ~75k likes.

The final output should be something like:



If it does't show this at the end of the output it means that something happened and the script was terminated. This is why it is recommended to try it first on a test site or after making a full backup of your forum.

(The reported errors are usually deleted posts that doesn't exist in the database.)

Once the script is done check that the reactions were imported successfully and please report any problem you may have encountered. I will try to fix them for you.

IMPORTANT NOTE: you cannot run this script twice in the same database. It will reimport reactions and you will end up with duplicated likes. If something goes wrong, restore your database backup and try again.

Custom request and Import Services.

If you want me to perform the import for you or if you need a specific modification to this script, feel free to contact me and request a quote.

Feedback is always welcome.
tried it on a xf2.1 install.

received the following error when running the command stated in SSH:
Like Imported created with id #7

<br>

An exception occurred: [ErrorException] [E_NOTICE] Undefined variable: newReactionContent in import_post_ratings.php on line 45

#0 import_post_ratings.php(45): XF::handlePhpError(8, '[E_NOTICE] Unde...', '/home/tajhay/pu...', 45, Array)

#1 {main}
 
tried it on a xf2.1 install.

received the following error when running the command stated in SSH:
Like Imported created with id #7

<br>

An exception occurred: [ErrorException] [E_NOTICE] Undefined variable: newReactionContent in import_post_ratings.php on line 45

#0 import_post_ratings.php(45): XF::handlePhpError(8, '[E_NOTICE] Unde...', '/home/tajhay/pu...', 45, Array)

#1 {main}
Redownload the script, restore your backup and run it again.
 
I don't have a backup as it's already a test site. Possible for me to delete records via phpmyadmin perhaps? Did you update the script?

If it is a test site, you can delete the imported reactions (it's easy to spot them in the admin panel) and run the script again to see if it works correctly.

And yes, I did upload a new version of the script to the original post.
 
If it is a test site, you can delete the imported reactions (it's easy to spot them in the admin panel) and run the script again to see if it works correctly.

And yes, I did upload a new version of the script to the original post.
Get a lot of errors for duplicate entry...im assuming because post ratings like = reaction like.
also a few "
<br>-- ERROR importing postrating #50797 ([E_NOTICE] Undefined offset: 9)"

Ends up abending with memory issues:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /home/tajhay/public_html/www.xyz.com/xf2/src/XF/Db/Mysqli/Statement.php on line 86



Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /home/tajhay/public_html/www.xyz.com/xf2/src/XF/Error.php on line 1
 
Get a lot of errors for duplicate entry...im assuming because post ratings like = reaction like.
also a few "
<br>-- ERROR importing postrating #50797 ([E_NOTICE] Undefined offset: 9)"

Ends up abending with memory issues:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /home/tajhay/public_html/www.xyz.com/xf2/src/XF/Db/Mysqli/Statement.php on line 86



Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /home/tajhay/public_html/www.xyz.com/xf2/src/XF/Error.php on line 1
It's probably because of the failed import. I will try it in a couple hours and see if I can check for duplicates.
 
I had a banned member come back with three new usernames. He gave "Disagrees" to several members who have asked if I could remove the "Xs" in their ratings. I have not been able to find a way to do that. Can it be done?
 
This is an experiment that I decided to make today to import likes from this addon to XF2.1.

WARNING!! THIS IS AN EXPERIMENT AND THE CODE IS NOT FULLY TESTED. YOU SHOULD ONLY RUN IT ON A TEST BOARD OR AFTER MAKING A FULL BACKUP OF YOUR SITE.

It will try to import content from two tables:

dark_postrating_ratings: which includes the Title, Image URL, Display Order, Sprite Dimensions and Positions and Rating Type.
dark_postrating: which includes the actual ratings.

The titles of the imported reactions will have an 'Imported' suffix to help you identify them. It is highly recommended to close your forum before the import and edit the imported reactions afterwards to make sure everything looks good.

Instructions (read the whole post)

MAKE A FULL BACKUP OF YOUR SITE, THIS CODE IS AN EXPERIMENT.

The process is simple: Upload the file to the root of your forum and run it from your console (by running php import_post_ratings.php in your SSH console). You can also try to open the script in your browser but it will probably timeout unless you increase the PHP timeout limit. The script can take several minutes depending of the size of your database. Mine took like 10 minutes to import ~75k likes.

The final output should be something like:



If it does't show this at the end of the output it means that something happened and the script was terminated. This is why it is recommended to try it first on a test site or after making a full backup of your forum.

(The reported errors are usually deleted posts that doesn't exist in the database.)

Once the script is done check that the reactions were imported successfully and please report any problem you may have encountered. I will try to fix them for you.

IMPORTANT NOTE: you cannot run this script twice in the same database. It will reimport reactions and you will end up with duplicated likes. If something goes wrong, restore your database backup and try again.

Custom request and Import Services.

If you want me to perform the import for you or if you need a specific modification to this script, feel free to contact me and request a quote.

Feedback is always welcome.
Has anyone successfully used this to import the post ratings to reactions?
 
Top Bottom