Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added parameter $delimiter to the methods CF_Container::get_objects a…

…nd CF_Http::get_objects. This parameter will enable the Container get_objects call to return files and "application/directory" objects in the base/root level.
  • Loading branch information...
commit 4e8d15d22d791d779bfd954ceb0d9f533bfec127 1 parent 32a79ac
@juanatgmo juanatgmo authored
Showing with 8 additions and 3 deletions.
  1. +4 −2 cloudfiles.php
  2. +4 −1 cloudfiles_http.php
View
6 cloudfiles.php
@@ -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);
#}
@@ -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;
}
View
5 cloudfiles_http.php
@@ -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.";
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.