public/wordpress/wp-content/plugins/backupbuddy/destinations/dropbox2/lib/Dropbox/Client.php
/**
     * Creates a file on Dropbox using the accumulated contents of the given chunked upload session.
     *
     * See <a href="https://www.dropbox.com/developers/core/docs#commit-chunked-upload">/commit_chunked_upload</a>.
     *
     * @param string $uploadId
     *     The unique identifier for the chunked upload session.  This is obtained via
     *     {@link chunkedUploadStart}.
     *
     * @param string $path
     *    The Dropbox path to save the file to ($path).
     *
     * @param WriteMode $writeMode
     *    What to do if there's already a file at the given path.
     *
     * @return array|null
     *    If <code>null</code>, it means the Dropbox server wasn't aware of the
     *    <code>$uploadId</code> you gave it.
     *    Otherwise, you get back the
     *    <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>
     *    for the newly-created file.
     *
     * @throws Exception
     */
Creates a file on Dropbox using the accumulated contents of the given chunked upload session.

@param string $uploadId
The unique identifier for the chunked upload session.  This is obtained via
chunkedUploadStart.

@param string $path
The Dropbox path to save the file to ($path).

@param WriteMode $writeMode
What to do if there's already a file at the given path.

@return array|null
If null, it means the Dropbox server wasn't aware of the
$uploadId you gave it.
Otherwise, you get back the
metadata object
for the newly-created file.

@throws Exception
Creates a file on Dropbox using the accumulated contents of the given chunked upload session . @param string $uploadId The unique identifier for the chunked upload session . This is obtained via chunkedUploadStart . @param string $path The Dropbox path to save the file to ( $path ) . @param WriteMode $writeMode What to do if there ' s already a file at the given path . @return array|null If null it means the Dropbox server wasn ' t aware of the $uploadId you gave it . Otherwise you get back the metadata object for the newly - created file . @throws Exception
function chunkedUploadFinish($uploadId, $path, $writeMode,$byteOffset) {
		\pb_backupbuddy::status( 'details', 'chunkedUploadFinish start.' );
		Checker::argStringNonEmpty("uploadId", $uploadId);
		Path::checkArgNonRoot("path", $path);
		WriteMode::checkArg("writeMode", $writeMode);
		\pb_backupbuddy::status( 'details', 'Prepping params for chunk finish. Session: `' . $uploadId . '`. Offset: `' . $byteOffset . '`.' );
		$params = $writeMode->getExtraParams();
		$header = "Dropbox-API-Arg: " .
			json_encode(
				array(
					'cursor' => array(
						"session_id" => $uploadId,
						"offset" => $byteOffset,
					),
					'commit' => array(
						"path" => $path,
						"mode" => 'add',
						"autorename" => true,
						"mute" => false
					)
				)
			);
		if ( \pb_backupbuddy::$options['log_level'] == '3' ) { 
			\pb_backupbuddy::status( 'details', 'Dropbox header: `' . $header . '`.' );
		}
		$response = $this->doPost( $this->contentHost, "2/files/upload_session/finish", null, $header, 'application/octet-stream' );
		if ($response->statusCode === 404) return null;
		if ($response->statusCode !== 200) {
			\pb_backupbuddy::status( 'error', 'Error #38494834434: `' . print_r( $response, true ) . '`.' );
			throw RequestUtil::unexpectedStatus($response);
		}
		return RequestUtil::parseResponseJson($response->body);
	}
function chunkedUploadFinish ( $ uploadId , $ path , $ writeMode , $ byteOffset ) { \ pb_backupbuddy :: status ( 'details' , 'chunkedUploadFinish start.' ) ; Checker :: argStringNonEmpty ( " uploadId " , $ uploadId ) ; Path :: checkArgNonRoot ( " path " , $ path ) ; WriteMode :: checkArg ( " writeMode " , $ writeMode ) ; \ pb_backupbuddy :: status ( 'details' , 'Prepping params for chunk finish. Session: `' . $ uploadId . '`. Offset: `' . $ byteOffset . '`.' ) ; $ params = $ writeMode -> getExtraParams ( ) ; $ header = " Dropbox-API-Arg:  " . json_encode ( array ( 'cursor' => array ( " session_id " => $ uploadId , " offset " => $ byteOffset , ) , 'commit' => array ( " path " => $ path , " mode " => 'add' , " autorename " => true , " mute " => false ) ) ) ; if ( \ pb_backupbuddy :: $ options [ 'log_level' ] == '3' ) { \ pb_backupbuddy :: status ( 'details' , 'Dropbox header: `' . $ header . '`.' ) ; } $ response = $ this -> doPost ( $ this -> contentHost , " 2/files/upload_session/finish " , null , $ header , 'application/octet-stream' ) ; if ( $ response -> statusCode === 404 ) return null ; if ( $ response -> statusCode !== 200 ) { \ pb_backupbuddy :: status ( 'error' , 'Error #38494834434: `' . print_r ( $ response , true ) . '`.' ) ; throw RequestUtil :: unexpectedStatus ( $ response ) ; } return RequestUtil :: parseResponseJson ( $ response -> body ) ; }
Creates a file on Dropbox using the accumulated contents of the given chunked upload session.
Creates a file on Dropbox using the accumulated contents of the given chunked upload session .
// Full logging enabled.