Page MenuHomePhabricator

D13038.id31440.diff
No OneTemporary

D13038.id31440.diff

diff --git a/src/upload/ArcanistFileDataRef.php b/src/upload/ArcanistFileDataRef.php
--- a/src/upload/ArcanistFileDataRef.php
+++ b/src/upload/ArcanistFileDataRef.php
@@ -33,6 +33,13 @@
/**
+ * Set a human-readable display filename, like "file.jpg".
+ *
+ * This name does not correspond to a path on disk, and is purely for
+ * human consumption.
+ *
+ * @param string Filename.
+ * @return this
* @task config
*/
public function setName($name) {
@@ -50,6 +57,13 @@
/**
+ * Set the data to upload as a single raw blob.
+ *
+ * You can specify file data by calling this method with a single blob of
+ * data, or by calling @{method:setPath} and providing a path to a file on
+ * disk.
+ *
+ * @param bytes Blob of file data.
* @task config
*/
public function setData($data) {
@@ -67,6 +81,16 @@
/**
+ * Set the data to upload by pointing to a file on disk.
+ *
+ * You can specify file data by calling this method with a path, or by
+ * providing a blob of raw data to @{method:setData}.
+ *
+ * The path itself only provides data. If you want to name the file, you
+ * should also call @{method:setName}.
+ *
+ * @param string Path on disk to a file containing data to upload.
+ * @return this
* @task config
*/
public function setPath($path) {
diff --git a/src/upload/ArcanistFileUploader.php b/src/upload/ArcanistFileUploader.php
--- a/src/upload/ArcanistFileUploader.php
+++ b/src/upload/ArcanistFileUploader.php
@@ -33,6 +33,10 @@
/**
+ * Provide a Conduit client to choose which server to upload files to.
+ *
+ * @param ConduitClient Configured client.
+ * @return this
* @task config
*/
public function setConduitClient(ConduitClient $conduit) {
@@ -45,6 +49,10 @@
/**
+ * Add a file to the list of files to be uploaded.
+ *
+ * You can optionally provide an explicit key which will be used to identify
+ * the file. After adding files, upload them with @{method:uploadFiles}.
*
* @param ArcanistFileDataRef File data to upload.
* @param null|string Optional key to use to identify this file.
@@ -74,10 +82,19 @@
/**
+ * Upload files to the server.
+ *
+ * This transfers all files which have been queued with @{method:addFiles}
+ * over the Conduit link configured with @{method:setConduitClient}.
+ *
* This method returns a map of all file data references. If references were
* added with an explicit key when @{method:addFile} was called, the key is
* retained in the result map.
*
+ * On return, files are either populated with a PHID (indicating a successful
+ * upload) or a list of errors. See @{class:ArcanistFileDataRef} for
+ * details.
+ *
* @return map<string, ArcanistFileDataRef> Files with results populated.
* @task upload
*/
@@ -192,6 +209,9 @@
/**
+ * Upload missing chunks of a large file by calling `file.uploadchunk` over
+ * Conduit.
+ *
* @task internal
*/
private function uploadChunks(ArcanistFileDataRef $file, $file_phid) {
@@ -253,6 +273,8 @@
/**
+ * Upload an entire file by calling `file.upload` over Conduit.
+ *
* @task internal
*/
private function uploadData(ArcanistFileDataRef $file) {
@@ -270,10 +292,12 @@
/**
+ * Write a status message.
+ *
* @task internal
*/
private function writeStatus($message) {
- echo $message."\n";
+ fwrite(STDERR, $message."\n");
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 5:28 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7659450
Default Alt Text
D13038.id31440.diff (3 KB)

Event Timeline