summaryrefslogtreecommitdiffstats
path: root/filefield_meta
diff options
context:
space:
mode:
authorDarrel O\'Pry2009-02-04 10:19:38 +0000
committerDarrel O\'Pry2009-02-04 10:19:38 +0000
commit2a9ee3eb8405b344e50ab346747b0c7af2596b23 (patch)
treec6757ccf793e94601b63e5bd647cf816c6cbb7dd /filefield_meta
parent4960a37b83d130a4d22bebefbd7aafddd12aa710 (diff)
#364352 by markus_petrux and dopry, delete orphaned files in filefield_meta table.6.x-3.0-alpha7
Diffstat (limited to 'filefield_meta')
-rw-r--r--filefield_meta/filefield_meta.module12
1 files changed, 12 insertions, 0 deletions
diff --git a/filefield_meta/filefield_meta.module b/filefield_meta/filefield_meta.module
index f616f64..c2ac5dd 100644
--- a/filefield_meta/filefield_meta.module
+++ b/filefield_meta/filefield_meta.module
@@ -17,6 +17,17 @@ function filefield_meta_theme() {
}
/**
+ * Implementation of hook_cron().
+ */
+function filefield_meta_cron() {
+ $result = db_query('SELECT fm.fid FROM {filefield_meta} fm LEFT JOIN {files} f ON fm.fid=f.fid WHERE f.fid IS NULL');
+ while ($file = db_fetch_object($result)) {
+ db_query('DELETE FROM {filefield_meta} WHERE fid = %d', $file->fid);
+ }
+}
+
+
+/**
* Implementation of filefield's hook_file_insert().
*/
function filefield_meta_file_insert(&$file) {
@@ -73,3 +84,4 @@ function theme_filefield_meta_duration($duration) {
}
return intval($minutes).':'.str_pad($seconds, 2, 0, STR_PAD_LEFT);
}
+