Is it possible to replace a file attached to a post so as to keep the download history? If it is, how?
forum sw: how to replace an attachament?
Moderator: Forum moderators
- rockedge
- Site Admin
- Posts: 6539
- Joined: Mon Dec 02, 2019 1:38 am
- Location: Connecticut,U.S.A.
- Has thanked: 2746 times
- Been thanked: 2620 times
- Contact:
Re: forum sw: how to replace an attachament?
@step which download history do you want to retain? Then number of downloads counter?
I could possibly fix that directly in the database. Re-insert the attachment and then modify the download count in the database once I know what it's supposed to be.
-
- Posts: 546
- Joined: Thu Aug 13, 2020 9:55 am
- Has thanked: 57 times
- Been thanked: 198 times
- Contact:
Re: forum sw: how to replace an attachament?
Yes, the counter. Just to make sure I didn't miss something, by "re-insert" you mean I should delete the current attachment, upload a new attachment by the same name, then PM you the amended downloads counter value? I can do that, thank you.
PS I could be mistaken but I remember the old board had "replace attachment" function, which preserved downloads counter, attachment name and comments, separate from the traditional "upload attachment" function.
- rockedge
- Site Admin
- Posts: 6539
- Joined: Mon Dec 02, 2019 1:38 am
- Location: Connecticut,U.S.A.
- Has thanked: 2746 times
- Been thanked: 2620 times
- Contact:
Re: forum sw: how to replace an attachament?
@step yes that is what we could do. I do not recall a "replace" option on the Puppy Linux forum phpBB version 2+ but since the entire attachment feature on that board version was custom installed. Most phpBB boards at that time did not have any attachment functions. It could be that after John Murga added some major custom modifications to enhance the forum there might have been a "replace" option. I can't check at this moment but perhaps later I can fire up a really old machine that has a web server and the old forum running on it from that generation and check that.
Easiest right now is the delete and swap in the new attachment and PM me the count.
I will look into the feasibility of adding a replace attachment feature.
- rockedge
- Site Admin
- Posts: 6539
- Joined: Mon Dec 02, 2019 1:38 am
- Location: Connecticut,U.S.A.
- Has thanked: 2746 times
- Been thanked: 2620 times
- Contact:
Re: forum sw: how to replace an attachament?
@step Another method would be to upload the replacement file if the format and name are exactly the same, which would overwrite the original on the server itself. All the links to it and data around it would be the same in the database only the file itself would change.
-
- Posts: 546
- Joined: Thu Aug 13, 2020 9:55 am
- Has thanked: 57 times
- Been thanked: 198 times
- Contact:
Re: forum sw: how to replace an attachament?
rockedge wrote: ↑Mon Aug 08, 2022 3:52 pm@step Another method would be to upload the replacement file if the format and name are exactly the same, which would overwrite the original on the server itself. All the links to it and data around it would be the same in the database only the file itself would change.
Before I posted my question I tried to do just that and previewed the resulting post but it had two attachments by the same name. You're saying that when I will submit the edited post the db will re-use the existing record, correct? That sounds good. Let me test it.
-
- Posts: 546
- Joined: Thu Aug 13, 2020 9:55 am
- Has thanked: 57 times
- Been thanked: 198 times
- Contact:
Re: forum sw: how to replace an attachament?
No, unfortunately it didn't work the way I read in your message. See https://forum.puppylinux.com/viewtopic. ... 598#p41598. Perhaps by "upload" you meant something that you would do around the forum software. I'm thinking that, your time and interest permitting, if you run cron jobs on your db, a job could scan for this kind of occurrence, and resolve it automatically. Perhaps adding a comment for the replacement file, such as "REPLACEMENT" or similar, to hint the cron job. Trouble is that without some sort of UI to expose this feature very few people would know it is available. Maybe just a text label explaining how to replace an attachment could suffice. Anyway, I can live with the status quo. Thanks for your time.
- rockedge
- Site Admin
- Posts: 6539
- Joined: Mon Dec 02, 2019 1:38 am
- Location: Connecticut,U.S.A.
- Has thanked: 2746 times
- Been thanked: 2620 times
- Contact:
Re: forum sw: how to replace an attachament?
@step I would have to upload the replacement file and overwrite the one that's there now.
Best bet is for you to open the post for editing and delete both attachments with the buttons provided. Then you can put the replacement back into the post. These steps will delete both attachments cleanly and a new upload by you to that post would make a fresh instance. Then I could go manually to the database itself and modify just that record in the database to set the download count.
-
- Posts: 546
- Joined: Thu Aug 13, 2020 9:55 am
- Has thanked: 57 times
- Been thanked: 198 times
- Contact:
Re: forum sw: how to replace an attachament?
I will do as you say, it's good for this particular attachment because it has no external referrers.