jacob-grahn/platform-racing-2-server

Recovering Lost Levels

fourst4r opened this issue · 1 comments

A little bit ago some inactive accounts were deleted, some of which had beloved levels to their name. Fortunately the deleted accounts' levels remain on the server, but they are only accessible through direct link, which requires you to know their level id.

I suggest a solution to allow a user to access the lost levels of a deleted account either by:

  • inheriting the levels by remaking the deleted account
  • an alternative search-by-username method that does not ensure that the username belongs to an account

or if neither of the above are possible:

  • links to all the levels not tied to an existing account, so they can be re-uploaded if someone wants to

This is potentially a huge problem. I'm concerned that the script is not working as it should be if it's deleting accounts with more than 1000 cumulative plays across all of its levels.

I can manually recreate the accounts and recover the levels if you have the level IDs, but this brings up another issue. IMO, the way that levels are just orphaned when an account is deleted is also very sloppy. They're still present on the server, but inaccessible by any means of search via the database. It's problematic for exactly this reason.

Here's how it works. When a level is saved:

  • It's entered into the database with all of its information-- creator, title, description, etc. (to be easily located when level lists are built, e.g. campaign, atb, tb, newest, search)
  • It's uploaded to the server as a text file

When a user is deleted:

  • All of their assets are deleted from all tables of the database (e.g. users, pr2, epic_upgrades, tokens, levels, etc)
  • Level text files are left on the server with only a user ID within to identify the creator

That's why there are all these orphaned level text files. I would like to have a script go through every level text file on the server and find the orphaned ones. Then, make a list of those and the user IDs associated. The end goal would be something similar to uploading the level information back into the database from the text file. That way, if an account was deleted by mistake, it could be recovered by recreating the user and setting their user ID back to the deleted one.

Of course, the first step is to identify why in the world this account was deleted.