X-Git-Url: https://git.cweiske.de/shpub.git/blobdiff_plain/d5dbb7068eeeee3ae5e92cee77763c1e70e28c97..9f81b10b061382886a9c7e21ca941c11a6e4bee1:/src/shpub/Command/AbstractProps.php diff --git a/src/shpub/Command/AbstractProps.php b/src/shpub/Command/AbstractProps.php index b581f3c..d939aa7 100644 --- a/src/shpub/Command/AbstractProps.php +++ b/src/shpub/Command/AbstractProps.php @@ -40,6 +40,15 @@ class Command_AbstractProps 'default' => [], ) ); + $cmd->addOption( + 'direct_upload', + array( + 'long_name' => '--direct-upload', + 'description' => 'Ignore media endpoint at file upload', + 'action' => 'StoreTrue', + 'default' => false, + ) + ); $cmd->addOption( 'name', array( @@ -170,6 +179,7 @@ class Command_AbstractProps ); } + $req->setDirectUpload($cmdRes->options['direct_upload']); $this->handleFiles($cmdRes, $req); if (count($cmdRes->options['x'])) { @@ -232,24 +242,15 @@ class Command_AbstractProps if ($type == 'image') { $type = 'photo'; } - if (count($urls) == 1) { - $req->req->addPostParameter($type, reset($urls)); - } else if (count($urls) > 1) { - $n = 0; - foreach ($urls as $url) { - $req->req->addPostParameter( - $type . '[' . $n++ . ']', $url - ); - } + if (count($urls) > 0) { + $req->addProperty($type, $urls); } } foreach ($fileList as $type => $filePaths) { if ($type == 'image') { $type = 'photo'; } - if (count($filePaths) == 1) { - $req->addUpload($type, reset($filePaths)); - } else if (count($filePaths) > 0) { + if (count($filePaths) > 0) { $req->addUpload($type, $filePaths); } }