diff options
Diffstat (limited to 'Zotlabs/Daemon/Importdoc.php')
-rw-r--r-- | Zotlabs/Daemon/Importdoc.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Zotlabs/Daemon/Importdoc.php b/Zotlabs/Daemon/Importdoc.php index c5a81e50c..de571848e 100644 --- a/Zotlabs/Daemon/Importdoc.php +++ b/Zotlabs/Daemon/Importdoc.php @@ -11,6 +11,21 @@ class Importdoc { self::update_docs_dir('doc/*'); + $sys = get_sys_channel(); + + // remove old files that weren't updated (indicates they were most likely deleted). + $i = q("select id from item where uid = %d and item_type = 5 and edited < %s - INTERVAL %s", + intval($sys['channel_id']), + db_utcnow(), + db_quoteinterval('14 DAY') + ); + + if ($i) { + foreach ($i as $iv) { + drop_item($iv['id'], uid: $sys['channel_id']); + } + } + return; } @@ -18,9 +33,13 @@ class Importdoc { static public function update_docs_dir($s) { $f = basename($s); $d = dirname($s); - if ($s === 'doc/html') + + if ($s === 'doc/html') { return; + } + $files = glob("$d/$f"); + if ($files) { foreach ($files as $fi) { if ($fi === 'doc/html') { |