MyBB Community Forums

Full Version: Attachment Downloads Limit Per Day
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone here have experience with this template? https://community.mybb.com/mods.php?action=view&pid=855

I've already edited it to include viewing attachments. Upon reviewing the code though, it doesn't look like the SQL table tracking attachment/file downloads is cleared -- it simply balloons for perpetuity.

Is there any easy way to alter this plugin to generate a task which clears the table every 48 hours?

Edit: Just to be clear, I don't mean restricting downloads to a period of 48 hours instead of 24. I mean keeping it at X downloads per 24 hours and then clearing the table every 48 hours. It looks like the database just grows and grows and grows without being cleared by a task or the script.
(2018-12-08, 06:24 PM)mrdeltoid Wrote: [ -> ](48 instead of 24)?


Sorry, I don't really have the free time at the moment to look at this much further but, hopefully, I understood you correctly that you merely want the plugin to do 48 hours rather than 24?? The attachment below is the plugin file editted and changed to 48 hours as well as the language files changed from per day to per 48 hours.
(2018-12-08, 09:57 PM)vintagedaddyo Wrote: [ -> ]
(2018-12-08, 06:24 PM)mrdeltoid Wrote: [ -> ](48 instead of 24)?


Sorry, I don't really have the free time at the moment to look at this much further but, hopefully, I understood you correctly that you merely want the plugin to do 48 hours rather than 24?? The attachment below is the plugin file editted and changed to 48 hours as well as the language files changed from per day to per 48 hours.

Oh sorry, I may not have been clear (I might be misunderstanding you). I don't mean restricting downloads to a period of 48 hours versus 24. I mean keeping it at X per 24 hours and then clearing the table every 48 hours. It looks like the database just grows and grows and grows without being cleared by a task or the script.

My forum is basically an image board running MyBB so the table gets really big really fast.

Thanks for taking the time to look into this. I'll take a look at your edit.
I guess I am still not understanding why you need this? The dateline is per download click. So in theory if you set max download at 5 then 5 datelines per 5 clicks will be present per uid during the 24 hour or in this case 48 hour
period. Then further per click datelines will be present during new time period, etc, etc. I get what you mean by wanting datelines removed after 2 days but are you wanting the entire dateline list removed thus potentially breaking the plugin functioning or only datelines after 2 days have expired. And that is where I am curious as to why?  Why do you need to clear each individual dateline? All datelines are cleared on deactivation. I guess not only was I confused thinking you needed a 48 hour version of the plugin of which I already did and provided. Yes to answer your question,  you could write a query to delete datelines after 2 days but I perhaps am confused on your need to do so and currently as I stated before do not have the free time at this moment to focus on doing so for you.
Just to clarify: I'm not talking about the timeframe for allowable downloads. I'm talking about the preservation of download data longer than it's actually needed. Download entries from months ago don't go away and the SQL table bloats up. My board is image intensive and has 500,000 attachments or so. The average member views tens of images per day.

Doesn't the table maintain download entries permanently and just keep getting larger? It's not cleared after 24 hours or whatever. I want to keep the script functioning but old entries should be cleared (MyAlerts automatically deletes old alerts, for instance).

I could be wrong here. Is the table ever cleared by a task generated by the plugin? I want the table to clear so it doesn't bloat. I don't need download logs to stay after a couple of days.
You may need to create your own task and schedule it.
Take a look at inc/dailycleanup.php to see how you can create a task with a delete_query.
I have not installed that plugin, so I have no knowledge of the table you are referring to.
Can you prune the table manually in your servers phpMyAdmin?
Hello
I need enable and disable download limit per day for a specific forum ID . Can you update this plugin?