Skip to content

Commit

Permalink
Merge pull request #86 from nextcloud/openstack-304
Browse files Browse the repository at this point in the history
update php-opencloud/openstack to 3.0.4
  • Loading branch information
MorrisJobke committed Feb 26, 2018
2 parents 600b0a7 + 722bba6 commit 8168fc1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"pear/archive_tar": "1.4.3",
"pear/pear-core-minimal": "^v1.10",
"phpseclib/phpseclib": "2.0.4",
"php-opencloud/openstack": "3.0.2",
"php-opencloud/openstack": "3.0.4",
"pimple/pimple": "3.2.3",
"punic/punic": "^1.6",
"sabre/dav": "^3.2.0",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1974,17 +1974,17 @@
},
{
"name": "php-opencloud/openstack",
"version": "v3.0.2",
"version_normalized": "3.0.2.0",
"version": "v3.0.4",
"version_normalized": "3.0.4.0",
"source": {
"type": "git",
"url": "https://github.com/php-opencloud/openstack.git",
"reference": "1033431aff131cfc4b005758d6baf549026884be"
"reference": "92109146fb6f4168afc5a27dfdc6f2c8317a0e29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-opencloud/openstack/zipball/1033431aff131cfc4b005758d6baf549026884be",
"reference": "1033431aff131cfc4b005758d6baf549026884be",
"url": "https://api.github.com/repos/php-opencloud/openstack/zipball/92109146fb6f4168afc5a27dfdc6f2c8317a0e29",
"reference": "92109146fb6f4168afc5a27dfdc6f2c8317a0e29",
"shasum": ""
},
"require": {
Expand All @@ -2000,7 +2000,7 @@
"sami/sami": "dev-master",
"satooshi/php-coveralls": "~1.0"
},
"time": "2018-02-08T06:45:53+00:00",
"time": "2018-02-16T08:28:10+00:00",
"type": "library",
"extra": {
"branch-alias": {
Expand Down
1 change: 0 additions & 1 deletion patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ Patches:
- Doctrine: fix error handling for not null columns on some mysql servers https://github.com/doctrine/dbal/pull/2422
- SabreDAV: Make sure that files that are children of directories, are reported as files https://github.com/fruux/sabre-dav/issues/982
- SabreXML: Fix invalid PHP docs https://github.com/fruux/sabre-xml/pull/128
- openstack: Add subdir as alias for name https://github.com/php-opencloud/openstack/pull/214
- SabreXML: Prevent infinite loops for empty props element https://github.com/fruux/sabre-xml/pull/132
- ZipStreamer: Fix zip generation for 7zip https://github.com/McNetic/PHPZipStreamer/pull/39
2 changes: 1 addition & 1 deletion php-opencloud/openstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OpenStack services, and versions of services, are supported.

## Links

* [Official documentation](http://docs.os.php-opencloud.com/)
* [Official documentation](https://php-openstack-sdk.readthedocs.io/en/latest/)
* [Reference documentation](http://refdocs.os.php-opencloud.com)
* [Contributing guide](/CONTRIBUTING.md)
* [Code of Conduct](/CODE_OF_CONDUCT.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ public function serialize(): \stdClass
$val = $this->{$name};

$fn = function ($val) {
return ($val instanceof Serializable) ? $val->serialize() : $val;
if ($val instanceof Serializable) {
return $val->serialize();
} elseif ($val instanceof \DateTimeImmutable) {
return $val->format('c');
} else {
return $val;
}
};

if (is_array($val)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class StorageObject extends OperatorResource implements Creatable, Deletable, Ha
protected $aliases = [
'bytes' => 'contentLength',
'content_type' => 'contentType',
'subdir' => 'name',
'subdir' => 'name',
];

/**
Expand Down Expand Up @@ -105,8 +105,22 @@ public function getPublicUri(): Uri
*/
public function create(array $data): Creatable
{
$response = $this->execute($this->api->putObject(), $data + ['containerName' => $this->containerName]);
return $this->populateFromResponse($response);
// Override containerName from input params only if local instance contains containerName attr
if ($this->containerName) {
$data['containerName'] = $this->containerName;
}

$response = $this->execute($this->api->putObject(), $data);
$storageObject = $this->populateFromResponse($response);

// Repopulate data for this newly created object instance
// due to the response from API does not contain object name and containerName
$storageObject = $storageObject->populateFromArray([
'name' => $data['name'],
'containerName' => $data['containerName']
]);

return $storageObject;
}

/**
Expand Down

0 comments on commit 8168fc1

Please sign in to comment.