News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

"Locate attachment in files" or a "Search attachments" mod

Started by GigaWatt, May 13, 2018, 06:24:30 PM

Previous topic - Next topic

GigaWatt

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?"..."

Aleksi "Lex" Kilpinen

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?
Slava
Ukraini!
"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

How you can help SMF

shawnb61

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

GigaWatt

@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 ;).
"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?"..."

Aleksi "Lex" Kilpinen

OK, I can see how some sort of search could be a good idea for some.
Quote from: GigaWatt on May 14, 2018, 07:33:19 AM
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?
Slava
Ukraini!
"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

How you can help SMF

GigaWatt

Quote from: Aleksi "Lex" Kilpinen on May 14, 2018, 07:41:18 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?"..."

Aleksi "Lex" Kilpinen

That behaviour sounds odd, can't say I have tested it much but doesn't sound right.
Slava
Ukraini!
"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

How you can help SMF

GigaWatt

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?"..."

Aleksi "Lex" Kilpinen

I'll make a few tests on that myself, if it works one way but not other, then it's definitely a bug IMO.
Slava
Ukraini!
"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

How you can help SMF

GigaWatt

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?"..."

Aleksi "Lex" Kilpinen

Thanks for the update. I just dumb forgot about this myself, but I'm glad to hear it works. :)
Slava
Ukraini!
"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

How you can help SMF

Advertisement: