Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'get-objects'
Browse files Browse the repository at this point in the history
  • Loading branch information
juanatgmo committed Mar 12, 2012
2 parents 32a79ac + 4e8d15d commit a37235c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions cloudfiles.php
Expand Up @@ -1471,11 +1471,11 @@ function list_objects($limit=0, $marker=NULL, $prefix=NULL, $path=NULL)
* @return array array of strings
* @throws InvalidResponseException unexpected response
*/
function get_objects($limit=0, $marker=NULL, $prefix=NULL, $path=NULL)
function get_objects($limit=0, $marker=NULL, $prefix=NULL, $path=NULL, $delimiter=NULL)
{
list($status, $reason, $obj_array) =
$this->cfs_http->get_objects($this->name, $limit,
$marker, $prefix, $path);
$marker, $prefix, $path, $delimiter);
#if ($status == 401 && $this->_re_auth()) {
# return $this->get_objects($limit, $marker, $prefix, $path);
#}
Expand All @@ -1485,12 +1485,14 @@ function get_objects($limit=0, $marker=NULL, $prefix=NULL, $path=NULL)
}
$objects = array();
foreach ($obj_array as $obj) {
if(!isset($obj['subdir'])) {
$tmp = new CF_Object($this, $obj["name"], False, False);
$tmp->content_type = $obj["content_type"];
$tmp->content_length = (float) $obj["bytes"];
$tmp->set_etag($obj["hash"]);
$tmp->last_modified = $obj["last_modified"];
$objects[] = $tmp;
}
}
return $objects;
}
Expand Down
5 changes: 4 additions & 1 deletion cloudfiles_http.php
Expand Up @@ -648,7 +648,7 @@ function list_objects($cname,$limit=0,$marker=NULL,$prefix=NULL,$path=NULL)

# GET /v1/Account/Container?format=json
#
function get_objects($cname,$limit=0,$marker=NULL,$prefix=NULL,$path=NULL)
function get_objects($cname,$limit=0,$marker=NULL,$prefix=NULL,$path=NULL,$delimiter=NULL)
{
if (!$cname) {
$this->error_str = "Container name not set.";
Expand All @@ -672,6 +672,9 @@ function get_objects($cname,$limit=0,$marker=NULL,$prefix=NULL,$path=NULL)
if ($path) {
$params[] = "path=".rawurlencode($path);
}
if ($delimiter) {
$params[] = "delimiter=".rawurlencode($delimiter);
}
if (!empty($params)) {
$url_path .= "?" . implode("&", $params);
}
Expand Down

0 comments on commit a37235c

Please sign in to comment.