util/dcp - support recursion and folders full of photos by importing files singly in separate processes - not yet tested

This commit is contained in:
zotlabs
2017-08-22 18:29:51 -07:00
parent 33528c616a
commit 9f37dbc6dc
3 changed files with 118 additions and 28 deletions

View File

@@ -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']);