From 9f37dbc6dc1798b9b56a683ed1975adc318ff931 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 22 Aug 2017 18:29:51 -0700 Subject: util/dcp - support recursion and folders full of photos by importing files singly in separate processes - not yet tested --- include/attach.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/attach.php b/include/attach.php index 79a38590b..78e133b03 100644 --- a/include/attach.php +++ b/include/attach.php @@ -460,6 +460,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { // By default remove $src when finished $remove_when_processed = true; + $import_replace = false; if($options === 'import') { $src = $arr['src']; @@ -476,6 +477,9 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { if($arr['preserve_original']) $remove_when_processed = false; + if($arr['replace']) + $import_replace = true; + // if importing a directory, just do it now and go home - we're done. if(array_key_exists('is_dir',$arr) && intval($arr['is_dir'])) { @@ -617,8 +621,10 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { dbesc($folder_hash) ); if($r) { - $overwrite = get_pconfig($channel_id,'system','overwrite_dup_files'); + $overwrite = (($import_replace || get_pconfig($channel_id,'system','overwrite_dup_files')) ? true : false); if(($overwrite) || ($options === 'import')) { + if(! array_key_exists('edited',$arr)) + $arr['edited'] = datetime_convert(); $options = 'replace'; $existing_id = $x[0]['id']; $existing_size = intval($x[0]['filesize']); -- cgit v1.2.3