sillsdev / webonary

Source code for Webonary and related applications that support it
https://www.webonary.org
MIT License
4 stars 3 forks source link

Method for deleting dictionary data needed #664

Open peteroatley opened 5 months ago

peteroatley commented 5 months ago

At present there is no option in the Webonary Admin interface to delete the data for a Mongo DB dictionary, there is only a button to delete a WordPress dictionary.

This is needed as we may get a request from a dictionary complier to remove their data. It can be done by directly working with the MongoDB and deleting the WP data but it would be good to have an automated procedure that does it and not have to work out each time what needs deleting.

stevendyk commented 5 months ago

@phillip-hopper: webonary-cloud-api/lambda/deleteDictionary.ts appears to have the code for a deleteDictionary API call. Can this be utilized from a WP admin console?

phillip-hopper commented 5 months ago

@peteroatley There is already a button to delete the cloud data for a site. image

peteroatley commented 5 months ago

I tested this on .org and the Cloud data was deleted.

From the text in brackets, I think we weren't sure what was being deleted. Could we update the text to state what is now being deleted or remove it? Does the button delete both posts and cloud data depending on what exists?

When I looked at another test database it didn't have any posts to delete because it is cloud only. I looked at an older database and it had both posts and cloud data.

peteroatley commented 4 months ago

On the Dictionary Webonary Admin page Data (Upload) tab: Delete Data section:

Remove the text: "(deletes all posts in the category "webonary")" Remove the text: "You are not in your testing environment!" Below "Delete Data" add the following text:

"In this section you can delete either the cloud dictionary data or Wordpress posts data.

To delete cloud dictionary data, make sure the "Use cloud backend" box above is checked. To delete Wordpress dictionary data, make sure the "Use cloud backend" box above is unchecked.

Then enter your password and click on Delete.

Older dictionaries which were later uploaded to the cloud may have both types of data."

peteroatley commented 2 months ago

I tested deleting a dictionary and checked the data on MongoDB and it looks like that is working and all data is deleted including the reversal indexes.

Phil says that data from the reversal dictionary is not fully deleted because the table isn't deleted. If we decide we need to fully delete this data Phil gave two options:

  1. Copy the reversal index, delete the data from the copy and then overwrite the original. This is a slow process.

  2. Re-write the reversal indexes so that each dictionary has a table rather than storing all the data in one table. This is the better option but is more work.