diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/attach.php | 16 | ||||
-rw-r--r-- | include/import.php | 5 | ||||
-rw-r--r-- | include/reddav.php | 3 |
3 files changed, 17 insertions, 7 deletions
diff --git a/include/attach.php b/include/attach.php index 8d8cfe65f..ae4681994 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1820,7 +1820,7 @@ function filepath_macro($s) { } -function attach_export_data($channel,$resource_id) { +function attach_export_data($channel, $resource_id, $deleted = false) { $ret = array(); @@ -1828,6 +1828,15 @@ function attach_export_data($channel,$resource_id) { $hash_ptr = $resource_id; + $ret['fetch_url'] = z_root() . '/getfile'; + $ret['original_channel'] = $channel['channel_address']; + + + if($deleted) { + $ret['attach'] = array(array('hash' => $resource_id, 'deleted' => 1)); + return $ret; + } + do { $r = q("select * from attach where hash = '%s' and uid = %d limit 1", dbesc($hash_ptr), @@ -1836,16 +1845,15 @@ function attach_export_data($channel,$resource_id) { if(! $r) break; - if($hash_ptr === $resource_id) + if($hash_ptr === $resource_id) { $attach_ptr = $r[0]; + } $hash_ptr = $r[0]['folder']; $paths[] = $r[0]; } while($hash_ptr); - $ret['fetch_url'] = z_root() . '/getfile'; - $ret['original_channel'] = $channel['channel_address']; $paths = array_reverse($paths); diff --git a/include/import.php b/include/import.php index 3525ee948..f15dedfe0 100644 --- a/include/import.php +++ b/include/import.php @@ -890,6 +890,11 @@ function sync_files($channel,$files) { $attachment_stored = false; foreach($f['attach'] as $att) { + if($att['deleted']) { + attach_delete($channel,$att['hash']); + continue; + } + $attach_exists = false; $x = attach_by_hash($att['hash']); diff --git a/include/reddav.php b/include/reddav.php index a0bd1b1fc..abf21b86d 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -23,9 +23,6 @@ use Zotlabs\Storage; require_once('vendor/autoload.php'); require_once('include/attach.php'); -//require_once('Zotlabs/Storage/File.php'); -//require_once('Zotlabs/Storage/Directory.php'); -//require_once('Zotlabs/Storage/BasicAuth.php'); /** * @brief Returns an array with viewable channels. |