Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I recently removed a lot of nodes with a lot of votes form a test site and discovered that the calculated results from each one of the nodes was still left in the votingapi tables.
What I did was to duplicate the already existing functionality that removes the votes and made it remove the results as well - through votingapi_select_results and votingapi_delete_results.
Comment | File | Size | Author |
---|---|---|---|
plus1_clean_up_votingapi_results.patch | 540 bytes | voxpelli |
Comments
Comment #1
NancyDruHow do you know those votes came from P1? See #1010890: Change votingapi tag.
Comment #2
voxpelli CreditAttribution: voxpelli commentedDoes it matter? If the node is gone then all of the results related to that node can be deleted - right?
Comment #3
NancyDruRight. Guess I got caught up in those other "unvote" requests. Now that I am corrected, shouldn't all of this be in the VotingApi module?
Comment #4
voxpelli CreditAttribution: voxpelli commentedI don't think the Voting API cares what it removes - and any way - the votes are already removed using the same criteria - but the results has been forgotten - which the patch fixes :)
Comment #5
NancyDruI agree that the results should cleaned up. My question is who should do it. #115322: Delete votes for deleted nodes
Comment #6
voxpelli CreditAttribution: voxpelli commentedJust speculating here (I should probably look at the code instead - but speculating is easier). The Voting API describes itself as an API for "[...] rating of any content (comments, nodes, users, fish, whatever)" - since we have no hook_fishapi() or hook_whateverapi() the Voting API module can't implement any removal of stuff itself - instead I think it has to delegate that to the modules integrating the Voting API with fish or nodes :)
Comment #7
NancyDruComment #8
NancyDruCommitted to 6.x-2.x-dev.