Skip to content

Commit 5cf4361

Browse files
author
Jamie Hannaford
committed
Adding new changes
2 parents 20af479 + 355d84c commit 5cf4361

31 files changed

+757
-91
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ php:
33
- "5.6"
44
- "5.5"
55
- "5.4"
6-
- "5.3"
76
- hhvm
87

98
sudo: false

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ so that you can still use the SDK with a pure OpenStack instance
1616

1717
Requirements
1818
------------
19-
* PHP >=5.3.3
19+
* PHP >=5.4
2020
* cURL extension for PHP
2121

22+
**Note**: Since PHP 5.3 has reached [end of life](http://php.net/eol.php) and is no longer officially supported, we are moving to 5.4 as a minimum requirement. If upgrading is not an option and you still need a stable version of the SDK for 5.3, please follow [this guide](http://docs.php-opencloud.com/en/latest/using-php-5.3.html).
23+
2224
Installation
2325
------------
2426
You must install this library through Composer:

doc/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ Read the :doc:`getting-started-with-openstack` or
3030
:doc:`getting-started-with-rackspace` to help you get started with basic
3131
Compute operations.
3232

33+
.. note::
34+
35+
If you are running PHP 5.3, please see our :doc:`using-php-5.3` guide.
36+
3337
Services
3438
--------
3539

doc/services/common/service-args.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
default will be provided if you pass in ``null``.
44

55
* ``{region}`` is the region the service will operate in. For Rackspace
6-
users, you can select one of the following from the `supported regions page
7-
</regions>`_.
6+
users, you can select one of the following from the :doc:`supported regions page
7+
</regions>`.
88

9-
* ``{urlType}`` is the `type of URL </url-types>`_ to use, depending on which
9+
* ``{urlType}`` is the :doc:`type of URL </url-types>` to use, depending on which
1010
endpoints your catalog provides. If omitted, it will default to the public
1111
network.

doc/services/dns/domains.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ Modify domain
268268

269269
Only the TTL, email address and comment attributes of a domain can be modified.
270270
Records cannot be added, modified, or removed through this API operation - you
271-
will need to use the `add records <records#add-record>`__, `modify records
272-
<records#modify-record>`__ or `remove records <records#delete-record>`__
271+
will need to use the `add records <records.html#add-record>`__, `modify records
272+
<records.html#modify-record>`__ or `remove records <records.html#delete-record>`__
273273
operations respectively.
274274

275275
.. code-block:: php

doc/services/object-store/migrating-containers.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ Requirements
3737
3838
use Guzzle\Plugin\Backoff\BackoffPlugin;
3939
40-
// set timeout in secs
41-
$timeout = 10;
40+
// maximum number of retries
41+
$maxRetries = 10;
4242
4343
// set HTTP error codes
4444
$httpErrors = array(500, 503, 408);
4545
46-
$backoffPlugin = BackoffPlugin::getExponentialBackoff($timeout, $httpErrors);
46+
$backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, $httpErrors);
4747
$client->addSubscriber($backoffPlugin);
4848
4949
@@ -68,12 +68,12 @@ You can access all this functionality by executing:
6868
6969
7070
It's advisable to do this process in a Cloud Server in one of the two
71-
regions you're migrating to/from. This allows you to use ``privateURL``
71+
regions you're migrating to/from. This allows you to use ``internalURL``
7272
as the third argument in the ``objectStoreService`` methods like this:
7373

7474
.. code-block:: php
7575
76-
$client->objectStoreService('cloudFiles', 'IAD', 'privateURL');
76+
$client->objectStoreService('cloudFiles', 'IAD', 'internalURL');
7777
7878
7979
This will ensure that traffic between your server and your new IAD

doc/services/object-store/objects.rst

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,42 @@ docs <http://docs.openstack.org/api/openstack-object-storage/1.0/content/list-ob
177177
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/list-objects.php>`_
178178

179179

180+
List over 10,000 objects
181+
------------------------
182+
183+
To retrieve more than 10,000 objects (the default limit), you'll need to use
184+
the built-in paging which uses a 'marker' parameter to fetch the next page of data.
185+
186+
.. code-block:: php
187+
188+
$containerObjects = array();
189+
$marker = '';
190+
191+
while ($marker !== null) {
192+
$params = array(
193+
'marker' => $marker,
194+
);
195+
196+
$objects = $container->objectList($params);
197+
$total = $objects->count();
198+
$count = 0;
199+
200+
if ($total == 0) {
201+
break;
202+
}
203+
204+
foreach ($objects as $object) {
205+
/** @var $object OpenCloud\ObjectStore\Resource\DataObject **/
206+
$containerObjects[] = $object->getName();
207+
$count++;
208+
209+
$marker = ($count == $total) ? $object->getName() : null;
210+
}
211+
}
212+
213+
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/list-objects-over-10000.php>`_
214+
215+
180216
Get object
181217
----------
182218

@@ -223,7 +259,7 @@ Get content of file
223259
.. code-block:: php
224260
225261
/** @param $content Guzzle\Http\EntityBody */
226-
$content = $object->getContainer();
262+
$content = $object->getContent();
227263
228264
229265
Get type of file
@@ -326,6 +362,41 @@ the name of the object inside the container that does not exist yet.
326362
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/copy-object.php>`_
327363

328364

365+
Symlinking to this object from another location
366+
-----------------------------------------------
367+
368+
To create a symlink to this file in another location you need to specify
369+
a string-based source
370+
371+
.. code-block:: php
372+
373+
$object->createSymlinkFrom('/container_2/new_object_name');
374+
375+
Where ``container_2`` is the name of the container, and ``new_object_name`` is
376+
the name of the object inside the container that either does not exist yet or
377+
is an empty file.
378+
379+
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/symlink-object.php>`_
380+
381+
382+
Setting this object to symlink to another location
383+
--------------------------------------------------
384+
385+
To set this file to symlink to another location you need to specify
386+
a string-based destination
387+
388+
.. code-block:: php
389+
390+
$object->createSymlinkTo('/container_2/new_object_name');
391+
392+
Where ``container_2`` is the name of the container, and ``new_object_name`` is
393+
the name of the object inside the container.
394+
395+
The object must be an empty file.
396+
397+
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/master/samples/ObjectStore/symlink-object.php>`_
398+
399+
329400
Get object metadata
330401
-------------------
331402

doc/using-php-5.3.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Using the SDK with PHP v5.3
2+
===========================
3+
4+
Since PHP 5.3 has entered EOL and no longer receives security updates, we have bumped the minimum requirement to 5.4. Using 5.3 is still possible, however, but you will need to use an older stable version of the SDK. There are two ways to do this.
5+
6+
The first way is by requiring it through the command line:
7+
8+
.. code-block:: bash
9+
10+
composer require rackspace/php-opencloud:1.12
11+
12+
The second way is by updating your composer.json file, and specifying the appropriate version of the SDK:
13+
14+
.. code-block:: json
15+
16+
"require": {
17+
"rackspace/php-opencloud": "~1.12"
18+
}
19+
20+
Note that **1.12** is the last minor release supporting PHP 5.3. Version 1.13 and above has shifted to PHP 5.4.

lib/OpenCloud/Common/Constants/Header.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ class Header
7070
const USER_AGENT = 'User-Agent';
7171
const VARY = 'Vary';
7272
const VIA = 'Via';
73+
const X_OBJECT_MANIFEST = 'X-Object-Manifest';
7374
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright 2012-2014 Rackspace US, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
namespace OpenCloud\Common\Exceptions;
19+
20+
class DomainNotFoundException extends \Exception
21+
{
22+
}

0 commit comments

Comments
 (0)