diff options
author | redmatrix <git@macgirvin.com> | 2016-04-07 18:54:48 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-04-07 18:54:48 -0700 |
commit | 279f32b13deb45f3fe0ab2d32f6d2a0ea6e224e5 (patch) | |
tree | 02bc7d1b90498b585102f9c9f84afc19aba0b585 /include | |
parent | 3a6187af3dba16bcada988593d5faabe62231651 (diff) | |
download | volse-hubzilla-279f32b13deb45f3fe0ab2d32f6d2a0ea6e224e5.tar.gz volse-hubzilla-279f32b13deb45f3fe0ab2d32f6d2a0ea6e224e5.tar.bz2 volse-hubzilla-279f32b13deb45f3fe0ab2d32f6d2a0ea6e224e5.zip |
send file sync packets for all known file operations
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. |