Duplicate file fixer
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
The Duplicate file fixer module for Drupal 6 finds and, optionally, fixes duplicate file entries on your Drupal database.
Background
Drupal 6 uses a database table to keep track of the files used on your site. In this table, file paths are supposed to be unique but, for some unknown reasons, two or more file entries may be generated in the database with the same file path.
Usually, this does not pose any problem to a Drupal 6 or below site. Your can run your D6 site forever without encountering any problem related to those duplicated entries.
But beginning with Drupal 7, file paths must be unique on the database. This will pose a problem if your try to upgrade your site to Drupal 7, and it happens to have duplicated file entries. In fact, the Drupal 7 upgrade script will fail badly when handling this situation, leaving you with a half baked upgrade.
See #1260938: d6 to d7 update fails on file duplicates '#7061 Integrity constraint violation' for a more in-depth discussion of this problem.
What this module does
This module provides a report in Reports > Duplicate file entries (admin/reports/d6dupfix) that list all file entries that were found to be duplicated, along with additional information that may be useful to manually fix the issue (for example, you can delete an old node revision to get rid of a duplicate).
You are also offered a chance to let the module fix the issues. If you choose to let the module fix things for you, then for every file to be fixed, the following operations are done:
- All duplicate entries are collected. The first entry is not touched, so that the original file is left unchanged.
- For all subsequent entries, a new uniquely file name is generated, and a hard link is created, pointing to the first entry.
- The database record of the duplicated entry is updated to point to the new (unique) file name.
Watch out!
- Windows users should be using PHP 5.3 or above. Also, PHP should be running in elevated mode or with UAC disabled. These requirements come from PHP — the module was never tested on a Window machine (but if you happen to use it on Windows and it proves to work, please drop me a message!).
- Files are not copied in the de-dup process, but hard linked instead. This mean that the file system that you put your Drupal files on must support hard links.
Download
Visit the releases page to download the module.
