Class: CF_Connection
Source Location: /cloudfiles.php
Class for establishing connections to the Cloud Files storage system.
|
|
|
Class Details
Class Variables
Class Methods
constructor __construct [line 380]
CF_Connection __construct(
obj
$cfs_auth, [boolean
$servicenet = False])
|
|
Pass in a previously authenticated CF_Authentication instance. Example: # Create the authentication instance
#
# Perform authentication request
#
$auth->authenticate();
# Create a connection to the storage/cdn system(s) and pass in the
# validated CF_Authentication instance.
#
# If you are connecting via Rackspace servers and have access
# to the servicenet network you can set the $servicenet to True
# like this.
If the environement variable RACKSPACE_SERVICENET is defined it will force to connect via the servicenet.
Tags:
Parameters:
method close [line 419]
Close a connection Example:
Will close all current cUrl active connections.
Tags:
method create_container [line 478]
CF_Container create_container(
[string
$container_name = NULL])
|
|
Create a Container Given a Container name, return a Container instance, creating a new remote Container if it does not exit. Example: # ... authentication code excluded (see previous examples) ...
#
Tags:
Parameters:
method delete_container [line 535]
boolean delete_container(
[string|obj
$container = NULL])
|
|
Delete a Container Given either a Container instance or name, remove the remote Container. The Container must be empty prior to removing it. Example: # ... authentication code excluded (see previous examples) ...
#
Tags:
Parameters:
method get_container [line 597]
container get_container(
[string
$container_name = NULL])
|
|
Return a Container instance For the given name, return a Container instance if the remote Container exists, otherwise throw a Not Found exception. Example: # ... authentication code excluded (see previous examples) ...
#
print "Number of Objects: " . $images->count . "\n";
print "Bytes stored in container: " . $images->bytes . "\n";
Tags:
Parameters:
method get_containers [line 639]
array get_containers(
[
$limit = 0], [
$marker = NULL])
|
|
Return array of Container instances Return an array of CF_Container instances on the account. The instances will be fully populated with Container attributes (bytes stored and Object count) Example: # ... authentication code excluded (see previous examples) ...
#
foreach ($clist as $cont) {
print "Container name: " . $cont->name . "\n";
print "Number of Objects: " . $cont->count . "\n";
print "Bytes stored in container: " . $cont->bytes . "\n";
}
Tags:
Parameters:
method get_info [line 444]
Cloud Files account information Return an array of two floats (since PHP only supports 32-bit integers); number of containers on the account and total bytes used for the account. Example: # ... authentication code excluded (see previous examples) ...
#
list ($quantity, $bytes) = $conn->get_info();
print "Number of containers: " . $quantity . "\n";
print "Bytes stored in container: " . $bytes . "\n";
Tags:
method list_containers [line 683]
array list_containers(
[integer
$limit = 0], [string
$marker = NULL])
|
|
Return list of remote Containers Return an array of strings containing the names of all remote Containers. Example: # ... authentication code excluded (see previous examples) ...
#
Array
(
[0] => "my photos",
[1] => "my docs"
)
Tags:
Parameters:
method list_containers_info [line 731]
array list_containers_info(
[integer
$limit = 0], [string
$marker = NULL])
|
|
Return array of information about remote Containers Return a nested array structure of Container info. Example: # ... authentication code excluded (see previous examples) ...
#
Array
(
["my photos"] =>
Array
(
["bytes"] => 78,
["count"] => 2
)
["docs"] =>
Array
(
["bytes"] => 37323,
["count"] => 12
)
)
Tags:
Parameters:
method list_public_containers [line 773]
array list_public_containers(
[bool
$enabled_only = False])
|
|
Return list of Containers that have been published to the CDN. Return an array of strings containing the names of published Containers. Note that this function returns the list of any Container that has ever been CDN-enabled regardless of it's existence in the storage system. Example: # ... authentication code excluded (see previous examples) ...
#
Array
(
[0] => "images",
[1] => "css",
[2] => "javascript"
)
Tags:
Parameters:
method setDebug [line 400]
void setDebug(
boolean
$bool)
|
|
Toggle debugging of instance and back-end HTTP module
Parameters:
method set_read_progress_function [line 823]
void set_read_progress_function(
string
$func_name)
|
|
Set a user-supplied callback function to report download progress The callback function is used to report incremental progress of a data download functions (e.g. $container->list_objects(), $obj->read(), etc). The specified function will be periodically called with the number of bytes transferred until the entire download is complete. This callback function can be useful for implementing "progress bars" for large downloads. The specified callback function should take a single integer parameter. function read_callback($bytes_transferred) {
print ">> downloaded " . $bytes_transferred . " bytes.\n";
# ... do other things ...
return;
}
# output would look like this:
#
>> downloaded 10 bytes.
>> downloaded 11 bytes.
Array
(
[0] => fuzzy.txt
[1] => space name
)
Parameters:
method set_write_progress_function [line 859]
void set_write_progress_function(
string
$func_name)
|
|
Set a user-supplied callback function to report upload progress The callback function is used to report incremental progress of a data upload functions (e.g. $obj->write() call). The specified function will be periodically called with the number of bytes transferred until the entire upload is complete. This callback function can be useful for implementing "progress bars" for large uploads/downloads. The specified callback function should take a single integer parameter. function write_callback($bytes_transferred) {
print ">> uploaded " . $bytes_transferred . " bytes.\n";
# ... do other things ...
return;
}
$obj = $container->create_object("foo");
$obj->write("The callback function will be called during upload.");
# output would look like this:
# >> uploaded 51 bytes.
#
Parameters:
method ssl_use_cabundle [line 885]
void ssl_use_cabundle(
[string
$path = NULL])
|
|
Use the Certificate Authority bundle included with this API Most versions of PHP with cURL support include an outdated Certificate Authority (CA) bundle (the file that lists all valid certificate signing authorities). The SSL certificates used by the Cloud Files storage system are perfectly valid but have been created/signed by a CA not listed in these outdated cURL distributions. As a work-around, we've included an updated CA bundle obtained directly from cURL's web site (http://curl.haxx.se). You can direct the API to use this CA bundle by calling this method prior to making any remote calls. The best place to use this method is right after the CF_Authentication instance has been instantiated. You can specify your own CA bundle by passing in the full pathname to the bundle. You can use the included CA bundle by leaving the argument blank.
Parameters:
|
|