Code doesn't easily allow smarter plugins to take over (I think that's probably a reason why there are no stats plugin)
This page is pulling every info from the DB in a few queries then doing PHP stuff to rearrange and display. While this is fine for a couple thousand hits, it quickly becomes completely unpractical, if not just failing, when days and/or hits add up.
This page displays just everything. Again, why not for a couple hits, but this has probably no value to anyone:
Maybe we should have a more simple page and have the "details" loaded on demand by ajax.
Any suggestion or PR welcome.
The text was updated successfully, but these errors were encountered:
The DB schema regarding stats is weak, but it's not imaginable to have a web based upgrade script (dozens of thousands of rows to migrate by chunk - nope).
Plan B : have two log table coexisting, one legacy and one current
introduce new schema table(s)
migrate by chunk, keyword by keyword, every time a stat page is requested
How I'd approach this is in separate stages, updating everything at once is a great way to lose track of what's going on.
First the backend should be cleaned up by moving everything into separate functions or classes. A repository pattern would work well here. Then you could opt to use data classes to organize the data.
Then I'd recommend to start cleaning up the frontend by using a combination of a templating engine like Twig or Blade and a JS library like Vue or Alpine.
Stat pages are a complete shitshow exposing how bad I was at mysqling things 10 years ago (not saying I've really improved in that area :)
Problems:
Code has been ugly for years
Code doesn't easily allow smarter plugins to take over (I think that's probably a reason why there are no stats plugin)
This page is pulling every info from the DB in a few queries then doing PHP stuff to rearrange and display. While this is fine for a couple thousand hits, it quickly becomes completely unpractical, if not just failing, when days and/or hits add up.
This page displays just everything. Again, why not for a couple hits, but this has probably no value to anyone:

Maybe we should have a more simple page and have the "details" loaded on demand by ajax.
Any suggestion or PR welcome.
The text was updated successfully, but these errors were encountered: