Last active
August 29, 2015 14:19
-
-
Save geraldvillorente/cb994d91c4afdb4c00b9 to your computer and use it in GitHub Desktop.
Find orphaned files in Drupal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT fm.filename | |
FROM file_managed AS fm | |
LEFT OUTER JOIN file_usage AS fu | |
ON ( fm.fid = fu.fid ) | |
LEFT OUTER JOIN node AS n | |
ON ( fu.id = n.nid ) | |
WHERE (fu.TYPE = 'node' OR fu.TYPE IS NULL) | |
AND n.nid IS NULL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Count the number of orphaned files.