Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prune user_project_info upon project archive #625

Open
cpeel opened this issue Apr 25, 2021 · 1 comment
Open

Prune user_project_info upon project archive #625

cpeel opened this issue Apr 25, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@cpeel
Copy link
Member

cpeel commented Apr 25, 2021

user_project_info maps some high-level user actions to a project and powers things like the My Projects page and project notifications. It also has an interesting feature where when users visits project pages their last visit time for the project is stored in this table as well. This table is not currently archived, grows unbounded, and is the 3rd largest table on pgdp.net (after page_events and past_tallies). We should prune this table upon project archive (with certain restrictions) and prevent new rows from being created for archived projects.

Addressing this will include:

  • Updating pinc/archive.inc to deleted user_project_info rows for projects being archived where user_project_info.t_latest_page_event == 0
  • Updating projects.php to not call upi_set_t_latest_home_visit() if the project is archived.
  • Creating an upgrade script to delete the necessary rows for projects that have already been archived.

When archiving, it is import not to simply delete all project-related rows in the table as doing so will break My Projects. Instead, we should delete all project-related rows where user_project_info.t_latest_page_event == 0. This will remove rows for a project except those where the user has saved a page. Note that it will also remove records of users who have subscribed to project events, but after a project is archived that data is irrelevant.

@cpeel cpeel added the enhancement New feature or request label Apr 25, 2021
@srjfoo
Copy link
Member

srjfoo commented Apr 25, 2021

I'm somewhat uncomfortable with completely deleting the rows, because there are rare occasions on which archived projects are unarchived. I definitely agree that it would be good to be able to trim the user_project_info table, though, so I could be convinced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants