Deleting Unused Uploaded Files

Available starting with ManualWorks 6.0.22.

Find and clean up images and files uploaded to ManualWorks that are not used anywhere. Run it in the <Admin | Servers | Unused Uploads> menu.

Cleanup has two stages. First, quarantine the files, which moves them to a reversible state. After you confirm there is no problem, delete them permanently.

Steps

  1. Inspect: See how many unused files there are. Nothing is changed.

  2. Verify: Independently check that the results are correct. Nothing is changed.

  3. Quarantine: Move the files to quarantine and delete their database records. This can be undone.

  4. Delete permanently: Delete the quarantined files. This cannot be undone.

Before you quarantine, run Verify and check that it passes. Quarantine does not proceed if verification fails, but it is safer to check the results yourself before you proceed.

What Counts as In Use

Images and files in the following are all treated as in use.

Even an image removed from the current document is treated as in use if it remains in the edit history. This keeps images from disappearing when you revert to an earlier version.

Files uploaded less than 10 minutes ago are excluded, to protect files that were just uploaded but not yet added to a document.

The Judgment Leans Toward Safety

Some files that are actually unused might be treated as in use. The opposite, treating a file in use as unused, is prevented as much as possible, because a wrong judgment makes images disappear from documents.

So the count and size in the results can be smaller than what you can actually clean up.

Files in the <Resource> Menu Are Excluded

Files managed in the following menus are not deletion targets even if no document uses them, because users uploaded them on purpose.

These files are excluded from the deletion candidates and counted separately.

An inline image becomes a regular image as soon as it is used in content. So if it remains in the inline image explorer, it has not been used yet.

Verify

Checks whether the inspection results are correct. It goes through all live documents and confirms that no image actually in use is on the deletion list.

It finds images in a different way from the inspection and compares the results, so if the two results match, you can trust the judgment.

Verification covers all documents regardless of permissions, including documents the administrator running it cannot see. However, it compares only documents, so images in tasks and comments are checked only in the inspection step.

It checks every document, so it takes longer than the inspection.

Quarantine

Moves the files to quarantine and deletes their database records.

Quarantined files are kept under the data directory, grouped by run. Each run creates a quarantine record that contains the moved files and the information needed to restore them.

Copies in the backup directory are also deleted, so quarantine alone frees up space. If the original file is missing and only a backup copy remains, the backup copy is quarantined, so the file can be restored.

If verification did not pass or some places could not be inspected, quarantine does not proceed and the reason is shown.

Quarantine Records and Restore

Runs are listed in the Quarantine Records list at the bottom of the screen. You can see when, by whom, and how many files were quarantined. Records that have been restored are marked separately.

Restore

Moves quarantined files back to their original locations and recreates their database records. Backup copies, creators, and creation times are also restored, so everything returns to the state before quarantine. However, the following are skipped.

If any file was skipped for exceeding the maximum upload size or failed to restore, the quarantined files are kept. Fix the cause and restore again. If files were skipped only because the same image or file already exists or there was no moved file, the quarantined files are not kept.

If someone reports that an image disappeared from a document, restore the relevant record.

Delete Permanently

Deletes the quarantined files. From this point, they cannot be restored.

Run it only after enough time has passed and you have confirmed there are no problems. Problems usually show up when someone reopens the affected document, so do not rush it within a few days; leave some margin.

If you permanently delete a record that has already been restored, only the record disappears from the list. Restored images and files are not affected.

What to Check in the Results

Whether Any Place Could Not Be Inspected

If even one place that must be checked cannot be read, all images used only there appear as unused. In that case, the results cannot be trusted, and quarantine does not proceed.

Depending on your installation, data for features you do not use never exists. This is not a problem.

The List Shows Up to 1,000 Items

If there are more, only the list is cut off. The count and size reflect the total.

The Size Shown Is an Estimate

It counts only the original files. Backup copies and earlier versions are also deleted, so the space freed is larger than the value shown.

Uses That Cannot Be Found

The following cannot be found by any method. This is why there is a quarantine period.

Tips for Running It

It checks the entire edit history, so it takes time when there are many documents. Progress is shown in a progress bar. We recommend running it when usage is low.

Run Inspect, Verify, Quarantine, and Restore one at a time. Running several at once can make the results inconsistent.