Is there a way to find unused junk files in user dir Is there a way to find unused junk files in user dir
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Is there a way to find unused junk files in user dir

Started by netb, March 21, 2014, 09:52:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

netb

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

Αndré

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.

netb

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.

gmc

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:

  • Added support to view of additional files to report if the same filename exists elsewhere in the gallery.
  • Excluded 'no_FTP-uploads...' file and files beginning with '.' (like .htaccess) from additional file reporting
  • Added delete support for additional files - choice of all or 'duplicate' (same filename elsewhere in gallery) - and just main file or all related.
    See pic attached. This was the piece I really needed...
  • Added support for cleaning up favpics when deleting missing files from CPG.
    (favpics stored as base64 encoded serialized array that each need to be retrieved, reviewed, and updated if needed...)
  • Changed all mysql references to CPG functions for 1.6 compatibility
    (raised MIN level of CPG required to 1.5.42 where these functions were added)
  • Updated version to 0.3
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...
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Αndré

Greg, I'll have a closer look at your changes as soon as possible and will update the files in the SVN repository accordingly.

netb

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.

netb

Quote from: 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.

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.  :)

Αndré

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.