Advertisement:

Author Topic: "Locate attachment in files" or a "Search attachments" mod  (Read 906 times)

Online GigaWatt

  • The Smiley Guy
  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,163
  • Gender: Male
    • Macedonian electronics forum
Is there such a thing? For example, if you edit a post, right next to the attachment there's a link that will lead you to the adequate page in the "Attachments and avatars" admin section.

A search function in the attachments would also suffice, but the previous one would be even better ;).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 17,284
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • aleksi-kilpinen on LinkedIn
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #1 on: May 14, 2018, 12:22:04 AM »
Do not know of such a mod, and for many forums I think it would be of little use because what would you search for? If you already know the filename to search for, why the need to search?  Or did you have something more complex in mind?
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.

How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline shawnb61

  • Support Specialist
  • Sr. Member
  • *
  • Posts: 903
    • sbulen on GitHub
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #2 on: May 14, 2018, 01:21:31 AM »
I think it would be very handy.   Especially if combined with some form of tagging.   

In a forum like mine, folks share patches.   Helpful attribution such as contributor, file type (extension) & number of downloads are buried in the attachments table.   Other attribution is buried in the post &/or board &/or topic info.   

I've created a crude workaround - a query that runs nightly and produces a searchable csv. 

It would be helpful to be able to search & filter this info in a cleaner fashion.

An example:
https://www.vguitarforums.com/smf/index.php?topic=22963.0
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Online GigaWatt

  • The Smiley Guy
  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,163
  • Gender: Male
    • Macedonian electronics forum
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #3 on: May 14, 2018, 07:33:19 AM »
@Aleksi "Lex" Kilpinen: Let's say I've got 400 pages of attachments (I think the default was 15 or 20 attachments per page), all of them small files, not more than a few hundred KB. So, I need to find a particular attachment in those 400 pages and delete it so I could upload a new one (or just delete it). Let's say this file was uploaded 3 years ago. So, the simplest way would be to sort attachments by date and go back 3 years. The problem is, I don't know on what page the 3rd year backwards begins. I could make a rough estimate based on browsing a few pages, but I really have no idea on what page that particular attachment is.

On the other hand, from the topic I'm currently browsing, I could just copy/paste the name of the file in a search field, the search would return the exact file that I need, I'd delete it from the server (attachments directory), upload a new one (or not) and voila, job done :).

As I said, the previous function (a link to the file in the "Attachments and Avatars" admin section) would be even better, but I think the Search function would be easier to implement ;).

EDIT: Or, there could be a link right next to the attachment in the post (that will be shown only if you try to edit the post) that will read "Search in attachments" that will automatically invoke a search function in the Attachments and Avatars section (previously implemented), like in the picture below.



@shawnb61: Yeah, that would also be a nice function (type of extension, info, hash, etc.), but what I'm currently looking for is a simple "Search through attachments" function.

Just to make things clearer, here's my Attachments and Avatars section.



423 pages of attachments and I have to find a single attachment in those 423 pages and delete it ::). Let's say I have to do this on a daily basis. It takes me an average of 5 minutes to find the attachment.

I also think that this should be implemented as a core function in 2.1. It shouldn't be too hard to implement, I guess most of the code could be taken from the regular search function and just adapted ;).
« Last Edit: May 14, 2018, 07:45:11 AM by GigaWatt »
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 17,284
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • aleksi-kilpinen on LinkedIn
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #4 on: May 14, 2018, 07:41:18 AM »
OK, I can see how some sort of search could be a good idea for some.
On the other hand, from the topic I'm currently browsing, I could just copy/paste the name of the file in a search field, the search would return the exact file that I need, I'd delete it from the server (attachments directory), upload a new one (or not) and voila, job done :).

As I said, the previous function (a link to the file in the "Attachments and Avatars" admin section) would be even better, but I think the Search function would be easier to implement ;).
But you can also just delete an attachment, or replace it, by editing the post it is attached to. You know that?
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.

How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Online GigaWatt

  • The Smiley Guy
  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,163
  • Gender: Male
    • Macedonian electronics forum
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #5 on: May 14, 2018, 07:59:22 AM »
But you can also just delete an attachment, or replace it, by editing the post it is attached to. You know that?

Yeah, but it doesn't delete it from the server. If I just untick the tickbox, I just loose the link between the file and the post/topic. The file is still present on the server (in the attachments directory) and it's not listed in the Attachments and Avatars sections either. The script knows that there are files that are not linked to any topic/post, but it's not showing them in the Attachments and Avatars section. It just adds empty pages at the end of the page listing. I have to run the Attachment Integrity Check tool to fix this, and it doesn't report any detailed information, so I have no idea what it is that I'm deleting/fixing.

This search function could be a simple and easy solution to fix this problem. The integrity check tool can only be used in cases where other members (non admins) have manually edited or deleted attachments and the admin just wants to do a little clean up on the forum ;).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 17,284
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • aleksi-kilpinen on LinkedIn
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #6 on: May 14, 2018, 09:13:51 AM »
That behaviour sounds odd, can't say I have tested it much but doesn't sound right.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.

How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Online GigaWatt

  • The Smiley Guy
  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,163
  • Gender: Male
    • Macedonian electronics forum
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #7 on: May 14, 2018, 09:21:52 AM »
This was happening in 1.1.x and is also happening in 2.0.15. If I delete the attachments from the Attachments and Avatars section, no problem, the file is actually deleted on the server. If I just untick the file from the post, the link between the attachment and the actual file is lost, but the file remains on the server.

The previous 1.1.x version of the forum was heavily modified, some custom edits too, but this was also happening on a virgin install of SMF 2.0.15. Got the file hash, checked through FTP if the file was present in the attachments directory before I unticked the box, unticked it, saved the post, the file was still present in the attachments directory :S. Just in case it was caching or something, I waited a while (about an hour) and checked again, the file was still present.

I though that this was the default SMF behavior, that's why I never reported anything.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 17,284
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • aleksi-kilpinen on LinkedIn
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #8 on: May 14, 2018, 09:52:50 AM »
I'll make a few tests on that myself, if it works one way but not other, then it's definitely a bug IMO.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.

How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Online GigaWatt

  • The Smiley Guy
  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,163
  • Gender: Male
    • Macedonian electronics forum
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #9 on: June 03, 2018, 08:38:10 PM »
Just an update on this issue. It seems that you're right. I must've been tired when I did the check the first time. In short, if you untick the attachment from the post and save the post, the attachment is also deleted from the attachments directory (checked with FTP).

So, I'll mark this as solved, although I think a Search function in the Browse Files section in the Admin menu would be welcome ;).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 17,284
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • aleksi-kilpinen on LinkedIn
Re: "Locate attachment in files" or a "Search attachments" mod
« Reply #10 on: June 03, 2018, 11:29:25 PM »
Thanks for the update. I just dumb forgot about this myself, but I'm glad to hear it works. :)
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.

How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas