nokonoko / Pomf

Simple file uploading and sharing, source for the now shut down site Pomf.se
MIT License
463 stars 98 forks source link

[feature request] show amount of files uploaded/hosted on homepage #51

Closed jamiew0w closed 3 years ago

jamiew0w commented 3 years ago

I think the best way of doing this is via counting the rows in the db, rather than counting the files themselves. I'm pretty basic at PHP though and can't figure out the best way of doing it.

Also I'm not sure how much (if any) overhead this would add to the homepage. Could cache it via memcached etc but then we're straying a little from 'lightweight'.

Ideas? Is this worth being added?

nokonoko commented 3 years ago

Best way would be to count rows and periodically update it to reduce DB requests.

Don’t think I’ll add this tho, not really useful and more of a fun thing one could implement themselves.

11 feb. 2021 kl. 01:58 skrev jamiew0w notifications@github.com:

 I think the best way of doing this is via counting the rows, rather than counting the files themselves. I'm pretty basic at PHP though and can't figure out the best way of doing it.

Also I'm not sure how much (if any) overhead this would add to the homepage. Could cache it via memcached etc but then we're straying a little from 'lightweight.

Ideas? Is this worth being added?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

avail commented 3 years ago

as neku said, one should probably implement this for themselves, as it does bring the lightweightedness down slightly, but, here's a simple implementation example:

imagine something like the following: table stats: id, key, value 1, enabled, 0 2, uploads, 69420

one could make it insert into said table on upload rather than use a periodic update script, but provide a script that would just bring the table up to date when ran from cli if it's a freshly updated install

web would just check if enabled is 1 and if so display the data somewhere.

jamiew0w commented 3 years ago

sounds good guys, thanks!