Jump to content

Cleaning tools: How remove all orphan file (recursively) ?


Recommended Posts

We had made a back-up but didn't immediately realize that some files were missing. On another product I have several functions to clean up the database or remnants files. It should be possible to reset a comparison between database and storage.

  •     Find and delete all orphan (unused) tags - BD only.
  •     Find all posts not attached to a valid category + optional deletion with attached objects - BD only.
  •     Find all slugs not attached to an Item + optional deletion - BD only.
  •     Find and delete all orphaned comments (not attached to an Item) - Disc & BD.
  •     Find and delete all orphaned comment attachments - Disk & DB.
  •     Find and delete all orphaned File objects (not corresponding to a file on disk) - BD only.
  •     Find and delete all orphaned file roots (not attached to a Collection or User) and their contents (recursively) - Disk & DB.
  •     Recreate all item slugs (change canonical title slugs-[0-9] to a slug generated from the current title). The old slugs will still work, but will redirect to the new ones.

I've noticed that there's a big information gap in the SQL database, which still has tables that shouldn't exist anymore. 

Link to comment
Share on other sites

With regard database, please dont be trying to delete tables out of there unless you are 100% sure on what you are doing. This could cause you more issues than you are trying to solve, and at present I note from your other ticket, you already have issues with your mysql setup.

In terms of the items above, some of these are simply not an option, such as deleting tags that are no longer used. They are always retained. Other items I would need an example of, such as slugs not attached to an item, as there shouldnt be any.

In terms of content items such as comments and posts, there wouldnt be any that dont have a category, as they have to belong somewhere. 

This leaves attachments. I understand you may wish to clean up attachments which have been orphaned from older releases, but please bear in mind this is an issue from older releases and shouldnt need a tool for them, as the situation itself no longer occurs. 

I would ask yourself what issue you are trying to solve here, as you appear to be causing yourself more problems than you are resolving at present. This is certainly not a dig in any way, but more of an observation. 

Link to comment
Share on other sites

  • 1 month later...
1 hour ago, NoSpy said:

It doesn't work completely, once again I have data loss, for example imageproxy and gallery are not transferred to the new location.

As mentioned above, you need to ensure you are backing up before performing any large scale actions such as these. I will get a ticket created for you on this so we can share more private information relating to locations, but I cannot stress enough the importance of backups when performing actions which move files en-masse.

Link to comment
Share on other sites

18 minutes ago, NoSpy said:

I finished the full backup.

Sorry, I am a little confused by your statement here as we did not ask you to run one but rather it was an advisement to make sure you have one before any attempt at moving files or impacting elements like this. 

There is a ticket my colleague made but we have not yet heard back from you.

Link to comment
Share on other sites

When I move a category, I make a backup between each interaction.

I've had to restore the website more than 12 times because the moves don't finish, some images are moved while others are still in the old folder like imageproxy.

For gallery it's more problematic, your script modifies the CHMOD of the folders making them inaccessible requiring you to contact the host so that he can modify the rights and finally realize that the root folder of gallery has been corrupted, resulting in a partial loss of documents and files requiring you to restore the website.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...