Advanced search  

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

Pages: [1]   Go Down

Author Topic: Is there a way to find unused junk files in user dir  (Read 7068 times)

0 Members and 1 Guest are viewing this topic.

netb

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 82
Is there a way to find unused junk files in user dir
« 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Is there a way to find unused junk files in user dir
« Reply #1 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.
Logged

netb

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 82
Re: Is there a way to find unused junk files in user dir
« Reply #2 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.
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Is there a way to find unused junk files in user dir
« Reply #3 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:
  • 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...
« Last Edit: October 25, 2016, 09:31:24 pm by gmc »
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Is there a way to find unused junk files in user dir
« Reply #4 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.
Logged

netb

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 82
Re: Is there a way to find unused junk files in user dir
« Reply #5 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.
Logged

netb

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 82
Re: Is there a way to find unused junk files in user dir
« Reply #6 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.  :)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Is there a way to find unused junk files in user dir
« Reply #7 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.