aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-08-22 20:32:02 -0700
committerzotlabs <mike@macgirvin.com>2017-08-22 20:32:02 -0700
commit41ff8fdd375fcf395b547dd02f3bdcbb198ec0c1 (patch)
tree78ea5aea7fb6a7250f803a9012fb8caa47a3bdb4
parent182f94a9ac8cfcd414d6f5899fbeb7a8e65284da (diff)
downloadvolse-hubzilla-41ff8fdd375fcf395b547dd02f3bdcbb198ec0c1.tar.gz
volse-hubzilla-41ff8fdd375fcf395b547dd02f3bdcbb198ec0c1.tar.bz2
volse-hubzilla-41ff8fdd375fcf395b547dd02f3bdcbb198ec0c1.zip
test recursive dav copy
-rw-r--r--Zotlabs/Daemon/Importfile.php2
-rwxr-xr-xutil/dcp22
2 files changed, 19 insertions, 5 deletions
diff --git a/Zotlabs/Daemon/Importfile.php b/Zotlabs/Daemon/Importfile.php
index 5f15b811d..c68ed21cf 100644
--- a/Zotlabs/Daemon/Importfile.php
+++ b/Zotlabs/Daemon/Importfile.php
@@ -6,6 +6,8 @@ class Importfile {
static public function run($argc,$argv){
+ logger('Importfile: ' . print_r($argv,true));
+
if($argc < 3)
return;
diff --git a/util/dcp b/util/dcp
index 672117f4e..2817ad4f1 100755
--- a/util/dcp
+++ b/util/dcp
@@ -36,8 +36,20 @@ if($argc <= 3) {
if(! $channel)
return;
+ for($x = 1; $x < ($argc - 1); $x ++) {
+ if(($argv[$x] === '-r') || ($argv[$x] === '-R')) {
+ $recursive = true;
+ break;
+ }
+ }
+
+
$isadir = false;
+ if(($recursive) || ($argc > 3))
+ $isadir = true;
+
+
$r = q("select * from attach where display_path = '%s' and uid = %d limit 1",
dbesc($dstfile),
intval($channel['channel_id'])
@@ -49,8 +61,9 @@ if($argc <= 3) {
$folder = $r[0]['hash'];
}
else {
+ $pathname = (($isadir) ? $dstfile : dirname($dstfile));
$arr = [
- 'pathname' => dirname($dstfile),
+ 'pathname' => $pathname,
'allow_cid' => $channel['channel_allow_cid'],
'allow_gid' => $channel['channel_allow_gid'],
'deny_cid' => $channel['channel_deny_cid'],
@@ -58,7 +71,7 @@ if($argc <= 3) {
];
$folder = '';
- if(dirname($dstfile)) {
+ if($pathname && $isadir) {
$x = attach_mkdirp($channel,$channel['channel_hash'],$arr);
if($x['success'])
$folder = $x['data']['hash'];
@@ -67,7 +80,6 @@ if($argc <= 3) {
for($x = 1; $x < ($argc - 1); $x ++) {
if(($argv[$x] === '-r') || ($argv[$x] === '-R')) {
- $recursive = true;
continue;
}
@@ -93,6 +105,7 @@ if($argc <= 3) {
while(($entry = readdir($dir)) !== false) {
if($entry === '.' || $entry === '..')
continue;
+
$dstfile = $basepath . '/' . $entry;
if(is_dir($src . '/' . $entry)) {
$r = q("select * from attach where display_path = '%s' and uid = %d limit 1",
@@ -118,8 +131,7 @@ if($argc <= 3) {
if($x['success'])
$folder = $x['data']['hash'];
}
- $basepath = $dstfile;
- dcp_recurse($channel,$src . '/' . $entry,$basepath,$folder);
+ dcp_recurse($channel,$src . '/' . $entry,$dstfile,$folder);
}
else {
$cmd = [ 'Importfile', $channel['channel_id'], $src . '/' . $entry, $folder ];