forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: netb on March 21, 2014, 09:52:24 pm

Title: Is there a way to find unused junk files in user dir
Post by: netb on March 21, 2014, 09:52:24 pm
Hello, I've stumbled upon an interesting case.

So in some cases where something happens, I can't remember exactly but like the file doesn't upload, the size limit is hit or the resizing isn't finished and something similar -- you or the gallery stops the upload -- and then you decide to re-upload the same file.

I've noticed that sometimes the previous uploading of the file has completed and it is actually in the user directory but the gallery doesn't know and it doesn't exits in the database either, so the gallery of course renames the new file with a suffix like ~0 at the end. But if you don't upload a file with the exact same name again this "unused" file stays in the folder and takes place.

And finally my question is, could you suggest some way to find such leftover unused files (which aren't in the database) in the user folders, so they can be deleted.

My gallery - greatmusclebodies.com
Title: Re: Is there a way to find unused junk files in user dir
Post by: Αndré on March 27, 2014, 02:11:31 pm
There's an (unreleased) plugin "check_files" in our SVN repository: http://sourceforge.net/p/coppermine/code/HEAD/tree/branches/cpg1.5.x/plugins/check_files/

It started as a mod for my private cpg1.4.x gallery a lot of years ago and I converted it to a cpg1.5.x plugin about 2 years ago. If I remember correctly it works as expected, but for some reason I haven't released it (or I simply forgot to release it). However, you still can use it!

You need to create a folder "check_files" in your Coppermine's plugins directory and upload all plugin files into that directory. Then, install the plugin as described in the Coppermine docs. The button "Search for additional files" in the menu is what you're looking for.
Title: Re: Is there a way to find unused junk files in user dir
Post by: netb on March 31, 2014, 11:42:53 pm
Thank you, Αndré!

Works really great and checks for both missing or additional files in the gallery, which I had both and did the manual job to remove them by hand :-\. Didn't find any new ones, but tested the plugin by dropping some new files and it's really useful, it found them. It's a very helpful plugin for maintenance of the files in the gallery.
Title: Re: Is there a way to find unused junk files in user dir
Post by: gmc on October 25, 2016, 08:57:16 pm
Stumbled on this thread looking for a way to deal with large numbers of missing and extra files in albums directory...
It worked as advertised - but needed to extend it a bit.

Changes made:
All changes clearly noted by //*GMC comments.

Αndré - do you want to update the SVN?  or want it released as a formal plugin? or both?
Attached as plugin zip...
Title: Re: Is there a way to find unused junk files in user dir
Post by: Αndré on November 14, 2016, 10:51:14 pm
Greg, I'll have a closer look at your changes as soon as possible and will update the files in the SVN repository accordingly.
Title: Re: Is there a way to find unused junk files in user dir
Post by: netb on June 21, 2017, 04:35:30 pm
I tried the updated version 0.3 with cpg 1.6.03 and PHP 7.1. Just updated these two functions mysqli_free_result and mysqli_fetch_array. But it doesn't seem to work now.
Title: Re: Is there a way to find unused junk files in user dir
Post by: netb on June 21, 2017, 10:30:04 pm
I tried the updated version 0.3 with cpg 1.6.03 and PHP 7.1. Just updated these two functions mysqli_free_result and mysqli_fetch_array. But it doesn't seem to work now.

Okay, I was in haste and now from home it seems to be working perfectly! Maybe there was some sort of a caching problem before. As stated I've just updated the mysql to mysqli. Now it found the test file that I've dropped in and wasn't in the database.  :)
Title: Re: Is there a way to find unused junk files in user dir
Post by: Αndré on July 04, 2017, 06:13:11 pm
I just committed version 0.3 to the SVN repository. Sorry that it took so long.

As there seems to be demand, I'll create a plugin announcement thread soon.