Merge pull request #10680 from helmutschneider/aws-2.6.15
Update AWS sdk to 2.6.15remotes/origin/fix-10825
commit
4669ea3835
@ -0,0 +1,68 @@ |
||||
<?php |
||||
namespace Aws\Common\Credentials; |
||||
|
||||
/** |
||||
* A blank set of credentials. AWS clients must be provided credentials, but |
||||
* there are some types of requests that do not need authentication. This class |
||||
* can be used to pivot on that scenario, and also serve as a mock credentials |
||||
* object when testing |
||||
* |
||||
* @codeCoverageIgnore |
||||
*/ |
||||
class NullCredentials implements CredentialsInterface |
||||
{ |
||||
public function getAccessKeyId() |
||||
{ |
||||
return ''; |
||||
} |
||||
|
||||
public function getSecretKey() |
||||
{ |
||||
return ''; |
||||
} |
||||
|
||||
public function getSecurityToken() |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
public function getExpiration() |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
public function isExpired() |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
public function serialize() |
||||
{ |
||||
return 'N;'; |
||||
} |
||||
|
||||
public function unserialize($serialized) |
||||
{ |
||||
// Nothing to do here. |
||||
} |
||||
|
||||
public function setAccessKeyId($key) |
||||
{ |
||||
// Nothing to do here. |
||||
} |
||||
|
||||
public function setSecretKey($secret) |
||||
{ |
||||
// Nothing to do here. |
||||
} |
||||
|
||||
public function setSecurityToken($token) |
||||
{ |
||||
// Nothing to do here. |
||||
} |
||||
|
||||
public function setExpiration($timestamp) |
||||
{ |
||||
// Nothing to do here. |
||||
} |
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
<?php |
||||
/** |
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"). |
||||
* You may not use this file except in compliance with the License. |
||||
* A copy of the License is located at |
||||
* |
||||
* http://aws.amazon.com/apache2.0 |
||||
* |
||||
* or in the "license" file accompanying this file. This file is distributed |
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
||||
* express or implied. See the License for the specific language governing |
||||
* permissions and limitations under the License. |
||||
*/ |
||||
|
||||
namespace Aws\Common\Exception; |
||||
|
||||
use Guzzle\Http\Exception\CurlException; |
||||
|
||||
/** |
||||
* Transfer request exception |
||||
*/ |
||||
class TransferException extends CurlException implements AwsExceptionInterface {} |
||||
@ -1,102 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"). |
||||
* You may not use this file except in compliance with the License. |
||||
* A copy of the License is located at |
||||
* |
||||
* http://aws.amazon.com/apache2.0 |
||||
* |
||||
* or in the "license" file accompanying this file. This file is distributed |
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
||||
* express or implied. See the License for the specific language governing |
||||
* permissions and limitations under the License. |
||||
*/ |
||||
|
||||
namespace Aws\Common\Signature; |
||||
|
||||
use Aws\Common\Credentials\CredentialsInterface; |
||||
use Aws\Common\Enum\DateFormat; |
||||
use Guzzle\Http\Message\RequestInterface; |
||||
use Guzzle\Http\Message\EntityEnclosingRequestInterface; |
||||
|
||||
/** |
||||
* Implementation of Signature Version 3 |
||||
* @link http://docs.amazonwebservices.com/amazonswf/latest/developerguide/HMACAuth-swf.html |
||||
*/ |
||||
class SignatureV3 extends AbstractSignature |
||||
{ |
||||
/** |
||||
* Get an array of headers to be signed |
||||
* |
||||
* @param RequestInterface $request Request to get headers from |
||||
* |
||||
* @return array |
||||
*/ |
||||
protected function getHeadersToSign(RequestInterface $request) |
||||
{ |
||||
$headers = array(); |
||||
foreach ($request->getHeaders()->toArray() as $k => $v) { |
||||
$k = strtolower($k); |
||||
if ($k == 'host' || strpos($k, 'x-amz-') !== false) { |
||||
$headers[$k] = implode(',', $v); |
||||
} |
||||
} |
||||
|
||||
// Sort the headers alphabetically and add them to the string to sign |
||||
ksort($headers); |
||||
|
||||
return $headers; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function signRequest(RequestInterface $request, CredentialsInterface $credentials) |
||||
{ |
||||
// Refresh the cached timestamp |
||||
$this->getTimestamp(true); |
||||
|
||||
// Add default headers |
||||
$request->setHeader('x-amz-date', $this->getDateTime(DateFormat::RFC1123)); |
||||
|
||||
// Add the security token if one is present |
||||
if ($credentials->getSecurityToken()) { |
||||
$request->setHeader('x-amz-security-token', $credentials->getSecurityToken()); |
||||
} |
||||
|
||||
// Grab the path and ensure that it is absolute |
||||
$path = '/' . ltrim($request->getUrl(true)->normalizePath()->getPath(), '/'); |
||||
|
||||
// Begin building the string to sign |
||||
$sign = $request->getMethod() . "\n" |
||||
. "{$path}\n" |
||||
. $this->getCanonicalizedQueryString($request) . "\n"; |
||||
|
||||
// Get all of the headers that must be signed (host and x-amz-*) |
||||
$headers = $this->getHeadersToSign($request); |
||||
foreach ($headers as $key => $value) { |
||||
$sign .= $key . ':' . $value . "\n"; |
||||
} |
||||
|
||||
$sign .= "\n"; |
||||
|
||||
// Add the body of the request if a body is present |
||||
if ($request instanceof EntityEnclosingRequestInterface) { |
||||
$sign .= (string) $request->getBody(); |
||||
} |
||||
|
||||
// Add the string to sign to the request for debugging purposes |
||||
$request->getParams()->set('aws.string_to_sign', $sign); |
||||
|
||||
$signature = base64_encode(hash_hmac('sha256', |
||||
hash('sha256', $sign, true), $credentials->getSecretKey(), true)); |
||||
|
||||
// Add the authorization header to the request |
||||
$request->setHeader('x-amzn-authorization', sprintf('AWS3 AWSAccessKeyId=%s,Algorithm=HmacSHA256,SignedHeaders=%s,Signature=%s', |
||||
$credentials->getAccessKeyId(), |
||||
implode(';', array_keys($headers)), |
||||
$signature)); |
||||
} |
||||
} |
||||
@ -1,141 +0,0 @@ |
||||
# Apache License |
||||
Version 2.0, January 2004 |
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
||||
|
||||
## 1. Definitions. |
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 |
||||
through 9 of this document. |
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the |
||||
License. |
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled |
||||
by, or are under common control with that entity. For the purposes of this definition, "control" means |
||||
(i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract |
||||
or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial |
||||
ownership of such entity. |
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. |
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software |
||||
source code, documentation source, and configuration files. |
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, |
||||
including but not limited to compiled object code, generated documentation, and conversions to other media |
||||
types. |
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, |
||||
as indicated by a copyright notice that is included in or attached to the work (an example is provided in the |
||||
Appendix below). |
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) |
||||
the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, |
||||
as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not |
||||
include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work |
||||
and Derivative Works thereof. |
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any |
||||
modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to |
||||
Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to |
||||
submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of |
||||
electronic, verbal, or written communication sent to the Licensor or its representatives, including but not |
||||
limited to communication on electronic mailing lists, source code control systems, and issue tracking systems |
||||
that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but |
||||
excluding communication that is conspicuously marked or otherwise designated in writing by the copyright |
||||
owner as "Not a Contribution." |
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been |
||||
received by Licensor and subsequently incorporated within the Work. |
||||
|
||||
## 2. Grant of Copyright License. |
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare |
||||
Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such |
||||
Derivative Works in Source or Object form. |
||||
|
||||
## 3. Grant of Patent License. |
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent |
||||
license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such |
||||
license applies only to those patent claims licensable by such Contributor that are necessarily infringed by |
||||
their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such |
||||
Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim |
||||
or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work |
||||
constitutes direct or contributory patent infringement, then any patent licenses granted to You under this |
||||
License for that Work shall terminate as of the date such litigation is filed. |
||||
|
||||
## 4. Redistribution. |
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without |
||||
modifications, and in Source or Object form, provided that You meet the following conditions: |
||||
|
||||
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and |
||||
|
||||
2. You must cause any modified files to carry prominent notices stating that You changed the files; and |
||||
|
||||
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, |
||||
trademark, and attribution notices from the Source form of the Work, excluding those notices that do |
||||
not pertain to any part of the Derivative Works; and |
||||
|
||||
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that |
||||
You distribute must include a readable copy of the attribution notices contained within such NOTICE |
||||
file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one |
||||
of the following places: within a NOTICE text file distributed as part of the Derivative Works; within |
||||
the Source form or documentation, if provided along with the Derivative Works; or, within a display |
||||
generated by the Derivative Works, if and wherever such third-party notices normally appear. The |
||||
contents of the NOTICE file are for informational purposes only and do not modify the License. You may |
||||
add Your own attribution notices within Derivative Works that You distribute, alongside or as an |
||||
addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be |
||||
construed as modifying the License. |
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license |
||||
terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative |
||||
Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the |
||||
conditions stated in this License. |
||||
|
||||
## 5. Submission of Contributions. |
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by |
||||
You to the Licensor shall be under the terms and conditions of this License, without any additional terms or |
||||
conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate |
||||
license agreement you may have executed with Licensor regarding such Contributions. |
||||
|
||||
## 6. Trademarks. |
||||
|
||||
This License does not grant permission to use the trade names, trademarks, service marks, or product names of |
||||
the Licensor, except as required for reasonable and customary use in describing the origin of the Work and |
||||
reproducing the content of the NOTICE file. |
||||
|
||||
## 7. Disclaimer of Warranty. |
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor |
||||
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
||||
or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, |
||||
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the |
||||
appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of |
||||
permissions under this License. |
||||
|
||||
## 8. Limitation of Liability. |
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless |
||||
required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any |
||||
Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential |
||||
damages of any character arising as a result of this License or out of the use or inability to use the Work |
||||
(including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or |
||||
any and all other commercial damages or losses), even if such Contributor has been advised of the possibility |
||||
of such damages. |
||||
|
||||
## 9. Accepting Warranty or Additional Liability. |
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, |
||||
acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this |
||||
License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole |
||||
responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold |
||||
each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason |
||||
of your accepting any such warranty or additional liability. |
||||
|
||||
END OF TERMS AND CONDITIONS |
||||
@ -1,112 +0,0 @@ |
||||
# AWS SDK for PHP |
||||
|
||||
<http://aws.amazon.com/php> |
||||
|
||||
Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"). |
||||
You may not use this file except in compliance with the License. |
||||
A copy of the License is located at |
||||
|
||||
<http://aws.amazon.com/apache2.0> |
||||
|
||||
or in the "license" file accompanying this file. This file is distributed |
||||
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
||||
express or implied. See the License for the specific language governing |
||||
permissions and limitations under the License. |
||||
|
||||
# Guzzle |
||||
|
||||
<https://github.com/guzzle/guzzle> |
||||
|
||||
Copyright (c) 2011 Michael Dowling, https://github.com/mtdowling |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in |
||||
all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
THE SOFTWARE. |
||||
|
||||
# Symfony |
||||
|
||||
<https://github.com/symfony/symfony> |
||||
|
||||
Copyright (c) 2004-2012 Fabien Potencier |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is furnished |
||||
to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
THE SOFTWARE. |
||||
|
||||
# Doctrine Common |
||||
|
||||
<https://github.com/doctrine/common> |
||||
|
||||
Copyright (c) 2006-2012 Doctrine Project |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of |
||||
this software and associated documentation files (the "Software"), to deal in |
||||
the Software without restriction, including without limitation the rights to |
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
||||
of the Software, and to permit persons to whom the Software is furnished to do |
||||
so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
||||
|
||||
# Monolog |
||||
|
||||
<https://github.com/Seldaek/monolog> |
||||
|
||||
Copyright (c) Jordi Boggiano |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is furnished |
||||
to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
THE SOFTWARE. |
||||
@ -0,0 +1,27 @@ |
||||
<?php |
||||
/** |
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"). |
||||
* You may not use this file except in compliance with the License. |
||||
* A copy of the License is located at |
||||
* |
||||
* http://aws.amazon.com/apache2.0 |
||||
* |
||||
* or in the "license" file accompanying this file. This file is distributed |
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
||||
* express or implied. See the License for the specific language governing |
||||
* permissions and limitations under the License. |
||||
*/ |
||||
|
||||
namespace Aws\S3\Enum; |
||||
|
||||
use Aws\Common\Enum; |
||||
|
||||
/** |
||||
* Contains enumerable EncodingType values |
||||
*/ |
||||
class EncodingType extends Enum |
||||
{ |
||||
const URL = 'url'; |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,73 @@ |
||||
<?php |
||||
/** |
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"). |
||||
* You may not use this file except in compliance with the License. |
||||
* A copy of the License is located at |
||||
* |
||||
* http://aws.amazon.com/apache2.0 |
||||
* |
||||
* or in the "license" file accompanying this file. This file is distributed |
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
||||
* express or implied. See the License for the specific language governing |
||||
* permissions and limitations under the License. |
||||
*/ |
||||
|
||||
namespace Aws\S3; |
||||
|
||||
use Aws\Common\Signature\SignatureV4; |
||||
use Aws\Common\Signature\SignatureInterface; |
||||
use Guzzle\Common\Event; |
||||
use Guzzle\Service\Command\CommandInterface; |
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
||||
|
||||
/** |
||||
* Adds required and optional Content-MD5 headers |
||||
*/ |
||||
class S3Md5Listener implements EventSubscriberInterface |
||||
{ |
||||
/** @var S3SignatureInterface */ |
||||
private $signature; |
||||
|
||||
public static function getSubscribedEvents() |
||||
{ |
||||
return array('command.after_prepare' => 'onCommandAfterPrepare'); |
||||
} |
||||
|
||||
public function __construct(SignatureInterface $signature) |
||||
{ |
||||
$this->signature = $signature; |
||||
} |
||||
|
||||
public function onCommandAfterPrepare(Event $event) |
||||
{ |
||||
$command = $event['command']; |
||||
$operation = $command->getOperation(); |
||||
|
||||
if ($operation->getData('contentMd5')) { |
||||
// Add the MD5 if it is required for all signers |
||||
$this->addMd5($command); |
||||
} elseif ($operation->hasParam('ContentMD5')) { |
||||
$value = $command['ContentMD5']; |
||||
// Add a computed MD5 if the parameter is set to true or if |
||||
// not using Signature V4 and the value is not set (null). |
||||
if ($value === true || |
||||
($value === null && !($this->signature instanceof SignatureV4)) |
||||
) { |
||||
$this->addMd5($command); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private function addMd5(CommandInterface $command) |
||||
{ |
||||
$request = $command->getRequest(); |
||||
$body = $request->getBody(); |
||||
if ($body && $body->getSize() > 0) { |
||||
if (false !== ($md5 = $body->getContentMd5(true, true))) { |
||||
$request->setHeader('Content-MD5', $md5); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,64 @@ |
||||
<?php |
||||
/** |
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"). |
||||
* You may not use this file except in compliance with the License. |
||||
* A copy of the License is located at |
||||
* |
||||
* http://aws.amazon.com/apache2.0 |
||||
* |
||||
* or in the "license" file accompanying this file. This file is distributed |
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
||||
* express or implied. See the License for the specific language governing |
||||
* permissions and limitations under the License. |
||||
*/ |
||||
|
||||
namespace Aws\S3; |
||||
|
||||
use Aws\Common\Signature\SignatureV4; |
||||
use Aws\Common\Credentials\CredentialsInterface; |
||||
use Guzzle\Http\Message\EntityEnclosingRequestInterface; |
||||
use Guzzle\Http\Message\RequestInterface; |
||||
|
||||
/** |
||||
* Amazon S3 signature version 4 overrides. |
||||
*/ |
||||
class S3SignatureV4 extends SignatureV4 implements S3SignatureInterface |
||||
{ |
||||
/** |
||||
* Always add a x-amz-content-sha-256 for data integrity. |
||||
*/ |
||||
public function signRequest(RequestInterface $request, CredentialsInterface $credentials) |
||||
{ |
||||
if (!$request->hasHeader('x-amz-content-sha256')) { |
||||
$request->setHeader('x-amz-content-sha256', $this->getPresignedPayload($request)); |
||||
} |
||||
|
||||
parent::signRequest($request, $credentials); |
||||
} |
||||
|
||||
/** |
||||
* Override used to allow pre-signed URLs to be created for an |
||||
* in-determinate request payload. |
||||
*/ |
||||
protected function getPresignedPayload(RequestInterface $request) |
||||
{ |
||||
$result = parent::getPresignedPayload($request); |
||||
|
||||
// If the body is empty, then sign with 'UNSIGNED-PAYLOAD' |
||||
if ($result === self::DEFAULT_PAYLOAD) { |
||||
$result = hash('sha256', 'UNSIGNED-PAYLOAD'); |
||||
} |
||||
|
||||
return $result; |
||||
} |
||||
|
||||
/** |
||||
* Amazon S3 does not double-encode the path component in the canonical req |
||||
*/ |
||||
protected function createCanonicalizedPath(RequestInterface $request) |
||||
{ |
||||
return '/' . ltrim($request->getPath(), '/'); |
||||
} |
||||
} |
||||
@ -0,0 +1,68 @@ |
||||
<?php |
||||
|
||||
namespace Aws\S3; |
||||
|
||||
use Aws\Common\Exception\RuntimeException; |
||||
use Guzzle\Common\Event; |
||||
use Guzzle\Service\Command\CommandInterface; |
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
||||
|
||||
/** |
||||
* This listener simplifies the SSE-C process by encoding and hashing the key. |
||||
*/ |
||||
class SseCpkListener implements EventSubscriberInterface |
||||
{ |
||||
public static function getSubscribedEvents() |
||||
{ |
||||
return array('command.before_prepare' => 'onCommandBeforePrepare'); |
||||
} |
||||
|
||||
public function onCommandBeforePrepare(Event $event) |
||||
{ |
||||
/** @var CommandInterface $command */ |
||||
$command = $event['command']; |
||||
|
||||
// Allows only HTTPS connections when using SSE-C |
||||
if ($command['SSECustomerKey'] || |
||||
$command['CopySourceSSECustomerKey'] |
||||
) { |
||||
$this->validateScheme($command); |
||||
} |
||||
|
||||
// Prepare the normal SSE-CPK headers |
||||
if ($command['SSECustomerKey']) { |
||||
$this->prepareSseParams($command); |
||||
} |
||||
|
||||
// If it's a copy operation, prepare the SSE-CPK headers for the source. |
||||
if ($command['CopySourceSSECustomerKey']) { |
||||
$this->prepareSseParams($command, true); |
||||
} |
||||
} |
||||
|
||||
private function validateScheme(CommandInterface $command) |
||||
{ |
||||
if ($command->getClient()->getConfig('scheme') !== 'https') { |
||||
throw new RuntimeException('You must configure your S3 client to ' |
||||
. 'use HTTPS in order to use the SSE-C features.'); |
||||
} |
||||
} |
||||
|
||||
private function prepareSseParams( |
||||
CommandInterface $command, |
||||
$isCopy = false |
||||
) { |
||||
$prefix = $isCopy ? 'CopySource' : ''; |
||||
|
||||
// Base64 encode the provided key |
||||
$key = $command[$prefix . 'SSECustomerKey']; |
||||
$command[$prefix . 'SSECustomerKey'] = base64_encode($key); |
||||
|
||||
// Base64 the provided MD5 or, generate an MD5 if not provided |
||||
if ($md5 = $command[$prefix . 'SSECustomerKeyMD5']) { |
||||
$command[$prefix . 'SSECustomerKeyMD5'] = base64_encode($md5); |
||||
} else { |
||||
$command[$prefix . 'SSECustomerKeyMD5'] = base64_encode(md5($key, true)); |
||||
} |
||||
} |
||||
} |
||||
@ -1,93 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* APC cache provider. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.0 |
||||
* @author Benjamin Eberlei <kontakt@beberlei.de> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
* @author Jonathan Wage <jonwage@gmail.com> |
||||
* @author Roman Borschel <roman@code-factory.org> |
||||
* @author David Abdemoulaie <dave@hobodave.com> |
||||
*/ |
||||
class ApcCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return apc_fetch($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return apc_exists($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
return (bool) apc_store($id, $data, (int) $lifeTime); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return apc_delete($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
return apc_clear_cache() && apc_clear_cache('user'); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
$info = apc_cache_info(); |
||||
$sma = apc_sma_info(); |
||||
|
||||
return array( |
||||
Cache::STATS_HITS => $info['num_hits'], |
||||
Cache::STATS_MISSES => $info['num_misses'], |
||||
Cache::STATS_UPTIME => $info['start_time'], |
||||
Cache::STATS_MEMORY_USAGE => $info['mem_size'], |
||||
Cache::STATS_MEMORY_AVAILIABLE => $sma['avail_mem'], |
||||
); |
||||
} |
||||
} |
||||
@ -1,96 +0,0 @@ |
||||
<?php |
||||
/* |
||||
* $Id$ |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* Array cache driver. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.0 |
||||
* @author Benjamin Eberlei <kontakt@beberlei.de> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
* @author Jonathan Wage <jonwage@gmail.com> |
||||
* @author Roman Borschel <roman@code-factory.org> |
||||
* @author David Abdemoulaie <dave@hobodave.com> |
||||
*/ |
||||
class ArrayCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* @var array $data |
||||
*/ |
||||
private $data = array(); |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return (isset($this->data[$id])) ? $this->data[$id] : false; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return isset($this->data[$id]); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
$this->data[$id] = $data; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
unset($this->data[$id]); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
$this->data = array(); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
return null; |
||||
} |
||||
} |
||||
@ -1,102 +0,0 @@ |
||||
<?php |
||||
/* |
||||
* $Id$ |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* Interface for cache drivers. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.0 |
||||
* @author Benjamin Eberlei <kontakt@beberlei.de> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
* @author Jonathan Wage <jonwage@gmail.com> |
||||
* @author Roman Borschel <roman@code-factory.org> |
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com> |
||||
*/ |
||||
interface Cache |
||||
{ |
||||
const STATS_HITS = 'hits'; |
||||
const STATS_MISSES = 'misses'; |
||||
const STATS_UPTIME = 'uptime'; |
||||
const STATS_MEMORY_USAGE = 'memory_usage'; |
||||
const STATS_MEMORY_AVAILIABLE = 'memory_available'; |
||||
|
||||
/** |
||||
* Fetches an entry from the cache. |
||||
* |
||||
* @param string $id cache id The id of the cache entry to fetch. |
||||
* @return mixed The cached data or FALSE, if no cache entry exists for the given id. |
||||
*/ |
||||
function fetch($id); |
||||
|
||||
/** |
||||
* Test if an entry exists in the cache. |
||||
* |
||||
* @param string $id cache id The cache id of the entry to check for. |
||||
* @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise. |
||||
*/ |
||||
function contains($id); |
||||
|
||||
/** |
||||
* Puts data into the cache. |
||||
* |
||||
* @param string $id The cache id. |
||||
* @param mixed $data The cache entry/data. |
||||
* @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime). |
||||
* @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. |
||||
*/ |
||||
function save($id, $data, $lifeTime = 0); |
||||
|
||||
/** |
||||
* Deletes a cache entry. |
||||
* |
||||
* @param string $id cache id |
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. |
||||
*/ |
||||
function delete($id); |
||||
|
||||
/** |
||||
* Retrieves cached information from data store |
||||
* |
||||
* The server's statistics array has the following values: |
||||
* |
||||
* - <b>hits</b> |
||||
* Number of keys that have been requested and found present. |
||||
* |
||||
* - <b>misses</b> |
||||
* Number of items that have been requested and not found. |
||||
* |
||||
* - <b>uptime</b> |
||||
* Time that the server is running. |
||||
* |
||||
* - <b>memory_usage</b> |
||||
* Memory used by this server to store items. |
||||
* |
||||
* - <b>memory_available</b> |
||||
* Memory allowed to use for storage. |
||||
* |
||||
* @since 2.2 |
||||
* @return array Associative array with server's statistics if available, NULL otherwise. |
||||
*/ |
||||
function getStats(); |
||||
} |
||||
@ -1,231 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* Base class for cache provider implementations. |
||||
* |
||||
* @since 2.2 |
||||
* @author Benjamin Eberlei <kontakt@beberlei.de> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
* @author Jonathan Wage <jonwage@gmail.com> |
||||
* @author Roman Borschel <roman@code-factory.org> |
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com> |
||||
*/ |
||||
abstract class CacheProvider implements Cache |
||||
{ |
||||
const DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]'; |
||||
|
||||
/** |
||||
* @var string The namespace to prefix all cache ids with |
||||
*/ |
||||
private $namespace = ''; |
||||
|
||||
/** |
||||
* @var string The namespace version |
||||
*/ |
||||
private $namespaceVersion; |
||||
|
||||
/** |
||||
* Set the namespace to prefix all cache ids with. |
||||
* |
||||
* @param string $namespace |
||||
* @return void |
||||
*/ |
||||
public function setNamespace($namespace) |
||||
{ |
||||
$this->namespace = (string) $namespace; |
||||
} |
||||
|
||||
/** |
||||
* Retrieve the namespace that prefixes all cache ids. |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getNamespace() |
||||
{ |
||||
return $this->namespace; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function fetch($id) |
||||
{ |
||||
return $this->doFetch($this->getNamespacedId($id)); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function contains($id) |
||||
{ |
||||
return $this->doContains($this->getNamespacedId($id)); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function save($id, $data, $lifeTime = 0) |
||||
{ |
||||
return $this->doSave($this->getNamespacedId($id), $data, $lifeTime); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function delete($id) |
||||
{ |
||||
return $this->doDelete($this->getNamespacedId($id)); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function getStats() |
||||
{ |
||||
return $this->doGetStats(); |
||||
} |
||||
|
||||
/** |
||||
* Deletes all cache entries. |
||||
* |
||||
* @return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise. |
||||
*/ |
||||
public function flushAll() |
||||
{ |
||||
return $this->doFlush(); |
||||
} |
||||
|
||||
/** |
||||
* Delete all cache entries. |
||||
* |
||||
* @return boolean TRUE if the cache entries were successfully deleted, FALSE otherwise. |
||||
*/ |
||||
public function deleteAll() |
||||
{ |
||||
$namespaceCacheKey = $this->getNamespaceCacheKey(); |
||||
$namespaceVersion = $this->getNamespaceVersion() + 1; |
||||
|
||||
$this->namespaceVersion = $namespaceVersion; |
||||
|
||||
return $this->doSave($namespaceCacheKey, $namespaceVersion); |
||||
} |
||||
|
||||
/** |
||||
* Prefix the passed id with the configured namespace value |
||||
* |
||||
* @param string $id The id to namespace |
||||
* @return string $id The namespaced id |
||||
*/ |
||||
private function getNamespacedId($id) |
||||
{ |
||||
$namespaceVersion = $this->getNamespaceVersion(); |
||||
|
||||
return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion); |
||||
} |
||||
|
||||
/** |
||||
* Namespace cache key |
||||
* |
||||
* @return string $namespaceCacheKey |
||||
*/ |
||||
private function getNamespaceCacheKey() |
||||
{ |
||||
return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); |
||||
} |
||||
|
||||
/** |
||||
* Namespace version |
||||
* |
||||
* @return string $namespaceVersion |
||||
*/ |
||||
private function getNamespaceVersion() |
||||
{ |
||||
if (null !== $this->namespaceVersion) { |
||||
return $this->namespaceVersion; |
||||
} |
||||
|
||||
$namespaceCacheKey = $this->getNamespaceCacheKey(); |
||||
$namespaceVersion = $this->doFetch($namespaceCacheKey); |
||||
|
||||
if (false === $namespaceVersion) { |
||||
$namespaceVersion = 1; |
||||
|
||||
$this->doSave($namespaceCacheKey, $namespaceVersion); |
||||
} |
||||
|
||||
$this->namespaceVersion = $namespaceVersion; |
||||
|
||||
return $this->namespaceVersion; |
||||
} |
||||
|
||||
/** |
||||
* Fetches an entry from the cache. |
||||
* |
||||
* @param string $id cache id The id of the cache entry to fetch. |
||||
* @return string The cached data or FALSE, if no cache entry exists for the given id. |
||||
*/ |
||||
abstract protected function doFetch($id); |
||||
|
||||
/** |
||||
* Test if an entry exists in the cache. |
||||
* |
||||
* @param string $id cache id The cache id of the entry to check for. |
||||
* @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise. |
||||
*/ |
||||
abstract protected function doContains($id); |
||||
|
||||
/** |
||||
* Puts data into the cache. |
||||
* |
||||
* @param string $id The cache id. |
||||
* @param string $data The cache entry/data. |
||||
* @param bool|int $lifeTime The lifetime. If != false, sets a specific lifetime for this |
||||
* cache entry (null => infinite lifeTime). |
||||
* |
||||
* @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. |
||||
*/ |
||||
abstract protected function doSave($id, $data, $lifeTime = false); |
||||
|
||||
/** |
||||
* Deletes a cache entry. |
||||
* |
||||
* @param string $id cache id |
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. |
||||
*/ |
||||
abstract protected function doDelete($id); |
||||
|
||||
/** |
||||
* Deletes all cache entries. |
||||
* |
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. |
||||
*/ |
||||
abstract protected function doFlush(); |
||||
|
||||
/** |
||||
* Retrieves cached information from data store |
||||
* |
||||
* @since 2.2 |
||||
* @return array An associative array with server's statistics if available, NULL otherwise. |
||||
*/ |
||||
abstract protected function doGetStats(); |
||||
} |
||||
@ -1,123 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
use \Couchbase; |
||||
|
||||
/** |
||||
* Couchbase cache provider. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.4 |
||||
* @author Michael Nitschinger <michael@nitschinger.at> |
||||
*/ |
||||
class CouchbaseCache extends CacheProvider |
||||
{ |
||||
|
||||
/** |
||||
* @var Couchbase |
||||
*/ |
||||
private $couchbase; |
||||
|
||||
/** |
||||
* Sets the Couchbase instance to use. |
||||
* |
||||
* @param Couchbase $couchbase |
||||
*/ |
||||
public function setCouchbase(Couchbase $couchbase) |
||||
{ |
||||
$this->couchbase = $couchbase; |
||||
} |
||||
|
||||
/** |
||||
* Gets the Couchbase instance used by the cache. |
||||
* |
||||
* @return Couchbase |
||||
*/ |
||||
public function getCouchbase() |
||||
{ |
||||
return $this->couchbase; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return $this->couchbase->get($id) ?: false; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return (null !== $this->couchbase->get($id)); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
if ($lifeTime > 30 * 24 * 3600) { |
||||
$lifeTime = time() + $lifeTime; |
||||
} |
||||
return $this->couchbase->set($id, $data, (int) $lifeTime); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return $this->couchbase->delete($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
return $this->couchbase->flush(); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
$stats = $this->couchbase->getStats(); |
||||
$servers = $this->couchbase->getServers(); |
||||
$server = explode(":", $servers[0]); |
||||
$key = $server[0] . ":" . "11210"; |
||||
$stats = $stats[$key]; |
||||
return array( |
||||
Cache::STATS_HITS => $stats['get_hits'], |
||||
Cache::STATS_MISSES => $stats['get_misses'], |
||||
Cache::STATS_UPTIME => $stats['uptime'], |
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'], |
||||
Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'], |
||||
); |
||||
} |
||||
|
||||
} |
||||
@ -1,132 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* Base file cache driver. |
||||
* |
||||
* @since 2.3 |
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com> |
||||
*/ |
||||
abstract class FileCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* @var string Cache directory. |
||||
*/ |
||||
protected $directory; |
||||
|
||||
/** |
||||
* @var string Cache file extension. |
||||
*/ |
||||
protected $extension; |
||||
|
||||
/** |
||||
* Constructor |
||||
* |
||||
* @param string $directory Cache directory. |
||||
* @param string $directory Cache file extension. |
||||
* |
||||
* @throws \InvalidArgumentException |
||||
*/ |
||||
public function __construct($directory, $extension = null) |
||||
{ |
||||
if ( ! is_dir($directory) && ! @mkdir($directory, 0777, true)) { |
||||
throw new \InvalidArgumentException(sprintf( |
||||
'The directory "%s" does not exist and could not be created.', |
||||
$directory |
||||
)); |
||||
} |
||||
|
||||
if ( ! is_writable($directory)) { |
||||
throw new \InvalidArgumentException(sprintf( |
||||
'The directory "%s" is not writable.', |
||||
$directory |
||||
)); |
||||
} |
||||
|
||||
$this->directory = realpath($directory); |
||||
$this->extension = $extension ?: $this->extension; |
||||
} |
||||
|
||||
/** |
||||
* Gets the cache directory. |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getDirectory() |
||||
{ |
||||
return $this->directory; |
||||
} |
||||
|
||||
/** |
||||
* Gets the cache file extension. |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getExtension() |
||||
{ |
||||
return $this->extension; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
protected function getFilename($id) |
||||
{ |
||||
$path = implode(str_split(md5($id), 12), DIRECTORY_SEPARATOR); |
||||
$path = $this->directory . DIRECTORY_SEPARATOR . $path; |
||||
|
||||
return $path . DIRECTORY_SEPARATOR . $id . $this->extension; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return @unlink($this->getFilename($id)); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
$pattern = '/^.+\\' . $this->extension . '$/i'; |
||||
$iterator = new \RecursiveDirectoryIterator($this->directory); |
||||
$iterator = new \RecursiveIteratorIterator($iterator); |
||||
$iterator = new \RegexIterator($iterator, $pattern); |
||||
|
||||
foreach ($iterator as $name => $file) { |
||||
@unlink($name); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
return null; |
||||
} |
||||
} |
||||
@ -1,114 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* Filesystem cache driver. |
||||
* |
||||
* @since 2.3 |
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com> |
||||
*/ |
||||
class FilesystemCache extends FileCache |
||||
{ |
||||
const EXTENSION = '.doctrinecache.data'; |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected $extension = self::EXTENSION; |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
$data = ''; |
||||
$lifetime = -1; |
||||
$filename = $this->getFilename($id); |
||||
|
||||
if ( ! is_file($filename)) { |
||||
return false; |
||||
} |
||||
|
||||
$resource = fopen($filename, "r"); |
||||
|
||||
if (false !== ($line = fgets($resource))) { |
||||
$lifetime = (integer) $line; |
||||
} |
||||
|
||||
if ($lifetime !== 0 && $lifetime < time()) { |
||||
fclose($resource); |
||||
|
||||
return false; |
||||
} |
||||
|
||||
while (false !== ($line = fgets($resource))) { |
||||
$data .= $line; |
||||
} |
||||
|
||||
fclose($resource); |
||||
|
||||
return unserialize($data); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
$lifetime = -1; |
||||
$filename = $this->getFilename($id); |
||||
|
||||
if ( ! is_file($filename)) { |
||||
return false; |
||||
} |
||||
|
||||
$resource = fopen($filename, "r"); |
||||
|
||||
if (false !== ($line = fgets($resource))) { |
||||
$lifetime = (integer) $line; |
||||
} |
||||
|
||||
fclose($resource); |
||||
|
||||
return $lifetime === 0 || $lifetime > time(); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
if ($lifeTime > 0) { |
||||
$lifeTime = time() + $lifeTime; |
||||
} |
||||
|
||||
$data = serialize($data); |
||||
$filename = $this->getFilename($id); |
||||
$filepath = pathinfo($filename, PATHINFO_DIRNAME); |
||||
|
||||
if ( ! is_dir($filepath)) { |
||||
mkdir($filepath, 0777, true); |
||||
} |
||||
|
||||
return file_put_contents($filename, $lifeTime . PHP_EOL . $data); |
||||
} |
||||
} |
||||
@ -1,121 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
use \Memcache; |
||||
|
||||
/** |
||||
* Memcache cache provider. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.0 |
||||
* @author Benjamin Eberlei <kontakt@beberlei.de> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
* @author Jonathan Wage <jonwage@gmail.com> |
||||
* @author Roman Borschel <roman@code-factory.org> |
||||
* @author David Abdemoulaie <dave@hobodave.com> |
||||
*/ |
||||
class MemcacheCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* @var Memcache |
||||
*/ |
||||
private $memcache; |
||||
|
||||
/** |
||||
* Sets the memcache instance to use. |
||||
* |
||||
* @param Memcache $memcache |
||||
*/ |
||||
public function setMemcache(Memcache $memcache) |
||||
{ |
||||
$this->memcache = $memcache; |
||||
} |
||||
|
||||
/** |
||||
* Gets the memcache instance used by the cache. |
||||
* |
||||
* @return Memcache |
||||
*/ |
||||
public function getMemcache() |
||||
{ |
||||
return $this->memcache; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return $this->memcache->get($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return (bool) $this->memcache->get($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
if ($lifeTime > 30 * 24 * 3600) { |
||||
$lifeTime = time() + $lifeTime; |
||||
} |
||||
return $this->memcache->set($id, $data, 0, (int) $lifeTime); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return $this->memcache->delete($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
return $this->memcache->flush(); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
$stats = $this->memcache->getStats(); |
||||
return array( |
||||
Cache::STATS_HITS => $stats['get_hits'], |
||||
Cache::STATS_MISSES => $stats['get_misses'], |
||||
Cache::STATS_UPTIME => $stats['uptime'], |
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'], |
||||
Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'], |
||||
); |
||||
} |
||||
} |
||||
@ -1,124 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
use \Memcached; |
||||
|
||||
/** |
||||
* Memcached cache provider. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.2 |
||||
* @author Benjamin Eberlei <kontakt@beberlei.de> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
* @author Jonathan Wage <jonwage@gmail.com> |
||||
* @author Roman Borschel <roman@code-factory.org> |
||||
* @author David Abdemoulaie <dave@hobodave.com> |
||||
*/ |
||||
class MemcachedCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* @var Memcached |
||||
*/ |
||||
private $memcached; |
||||
|
||||
/** |
||||
* Sets the memcache instance to use. |
||||
* |
||||
* @param Memcached $memcached |
||||
*/ |
||||
public function setMemcached(Memcached $memcached) |
||||
{ |
||||
$this->memcached = $memcached; |
||||
} |
||||
|
||||
/** |
||||
* Gets the memcached instance used by the cache. |
||||
* |
||||
* @return Memcached |
||||
*/ |
||||
public function getMemcached() |
||||
{ |
||||
return $this->memcached; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return $this->memcached->get($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return (false !== $this->memcached->get($id)); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
if ($lifeTime > 30 * 24 * 3600) { |
||||
$lifeTime = time() + $lifeTime; |
||||
} |
||||
return $this->memcached->set($id, $data, (int) $lifeTime); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return $this->memcached->delete($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
return $this->memcached->flush(); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
$stats = $this->memcached->getStats(); |
||||
$servers = $this->memcached->getServerList(); |
||||
$key = $servers[0]['host'] . ':' . $servers[0]['port']; |
||||
$stats = $stats[$key]; |
||||
return array( |
||||
Cache::STATS_HITS => $stats['get_hits'], |
||||
Cache::STATS_MISSES => $stats['get_misses'], |
||||
Cache::STATS_UPTIME => $stats['uptime'], |
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'], |
||||
Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'], |
||||
); |
||||
} |
||||
} |
||||
@ -1,108 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* Php file cache driver. |
||||
* |
||||
* @since 2.3 |
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com> |
||||
*/ |
||||
class PhpFileCache extends FileCache |
||||
{ |
||||
const EXTENSION = '.doctrinecache.php'; |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected $extension = self::EXTENSION; |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
$filename = $this->getFilename($id); |
||||
|
||||
if ( ! is_file($filename)) { |
||||
return false; |
||||
} |
||||
|
||||
$value = include $filename; |
||||
|
||||
if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) { |
||||
return false; |
||||
} |
||||
|
||||
return $value['data']; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
$filename = $this->getFilename($id); |
||||
|
||||
if ( ! is_file($filename)) { |
||||
return false; |
||||
} |
||||
|
||||
$value = include $filename; |
||||
|
||||
return $value['lifetime'] === 0 || $value['lifetime'] > time(); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
if ($lifeTime > 0) { |
||||
$lifeTime = time() + $lifeTime; |
||||
} |
||||
|
||||
if (is_object($data) && ! method_exists($data, '__set_state')) { |
||||
throw new \InvalidArgumentException( |
||||
"Invalid argument given, PhpFileCache only allows objects that implement __set_state() " . |
||||
"and fully support var_export(). You can use the FilesystemCache to save arbitrary object " . |
||||
"graphs using serialize()/deserialize()." |
||||
); |
||||
} |
||||
|
||||
$filename = $this->getFilename($id); |
||||
$filepath = pathinfo($filename, PATHINFO_DIRNAME); |
||||
|
||||
if ( ! is_dir($filepath)) { |
||||
mkdir($filepath, 0777, true); |
||||
} |
||||
|
||||
$value = array( |
||||
'lifetime' => $lifeTime, |
||||
'data' => $data |
||||
); |
||||
|
||||
$value = var_export($value, true); |
||||
$code = sprintf('<?php return %s;', $value); |
||||
|
||||
return file_put_contents($filename, $code); |
||||
} |
||||
} |
||||
@ -1,119 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
use Redis; |
||||
|
||||
/** |
||||
* Redis cache provider. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.2 |
||||
* @author Osman Ungur <osmanungur@gmail.com> |
||||
*/ |
||||
class RedisCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* @var Redis |
||||
*/ |
||||
private $redis; |
||||
|
||||
/** |
||||
* Sets the redis instance to use. |
||||
* |
||||
* @param Redis $redis |
||||
*/ |
||||
public function setRedis(Redis $redis) |
||||
{ |
||||
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); |
||||
$this->redis = $redis; |
||||
} |
||||
|
||||
/** |
||||
* Gets the redis instance used by the cache. |
||||
* |
||||
* @return Redis |
||||
*/ |
||||
public function getRedis() |
||||
{ |
||||
return $this->redis; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return $this->redis->get($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return $this->redis->exists($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
$result = $this->redis->set($id, $data); |
||||
if ($lifeTime > 0) { |
||||
$this->redis->expire($id, $lifeTime); |
||||
} |
||||
return $result; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return $this->redis->delete($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
return $this->redis->flushDB(); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
$info = $this->redis->info(); |
||||
return array( |
||||
Cache::STATS_HITS => false, |
||||
Cache::STATS_MISSES => false, |
||||
Cache::STATS_UPTIME => $info['uptime_in_seconds'], |
||||
Cache::STATS_MEMORY_USAGE => $info['used_memory'], |
||||
Cache::STATS_MEMORY_AVAILIABLE => false |
||||
); |
||||
} |
||||
} |
||||
@ -1,93 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* WinCache cache provider. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.2 |
||||
* @author Benjamin Eberlei <kontakt@beberlei.de> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
* @author Jonathan Wage <jonwage@gmail.com> |
||||
* @author Roman Borschel <roman@code-factory.org> |
||||
* @author David Abdemoulaie <dave@hobodave.com> |
||||
*/ |
||||
class WinCacheCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return wincache_ucache_get($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return wincache_ucache_exists($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
return (bool) wincache_ucache_set($id, $data, (int) $lifeTime); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return wincache_ucache_delete($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
return wincache_ucache_clear(); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
$info = wincache_ucache_info(); |
||||
$meminfo = wincache_ucache_meminfo(); |
||||
|
||||
return array( |
||||
Cache::STATS_HITS => $info['total_hit_count'], |
||||
Cache::STATS_MISSES => $info['total_miss_count'], |
||||
Cache::STATS_UPTIME => $info['total_cache_uptime'], |
||||
Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'], |
||||
Cache::STATS_MEMORY_AVAILIABLE => $meminfo['memory_free'], |
||||
); |
||||
} |
||||
} |
||||
@ -1,110 +0,0 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* Xcache cache driver. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.0 |
||||
* @author Benjamin Eberlei <kontakt@beberlei.de> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
* @author Jonathan Wage <jonwage@gmail.com> |
||||
* @author Roman Borschel <roman@code-factory.org> |
||||
* @author David Abdemoulaie <dave@hobodave.com> |
||||
*/ |
||||
class XcacheCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return $this->doContains($id) ? unserialize(xcache_get($id)) : false; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return xcache_isset($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
return xcache_set($id, serialize($data), (int) $lifeTime); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return xcache_unset($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
$this->checkAuthorization(); |
||||
|
||||
xcache_clear_cache(XC_TYPE_VAR, 0); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* Checks that xcache.admin.enable_auth is Off |
||||
* |
||||
* @throws \BadMethodCallException When xcache.admin.enable_auth is On |
||||
* @return void |
||||
*/ |
||||
protected function checkAuthorization() |
||||
{ |
||||
if (ini_get('xcache.admin.enable_auth')) { |
||||
throw new \BadMethodCallException('To use all features of \Doctrine\Common\Cache\XcacheCache, you must set "xcache.admin.enable_auth" to "Off" in your php.ini.'); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
$this->checkAuthorization(); |
||||
|
||||
$info = xcache_info(XC_TYPE_VAR, 0); |
||||
return array( |
||||
Cache::STATS_HITS => $info['hits'], |
||||
Cache::STATS_MISSES => $info['misses'], |
||||
Cache::STATS_UPTIME => null, |
||||
Cache::STATS_MEMORY_USAGE => $info['size'], |
||||
Cache::STATS_MEMORY_AVAILIABLE => $info['avail'], |
||||
); |
||||
} |
||||
} |
||||
@ -1,84 +0,0 @@ |
||||
<?php |
||||
/* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
* This software consists of voluntary contributions made by many individuals |
||||
* and is licensed under the MIT license. For more information, see |
||||
* <http://www.doctrine-project.org>. |
||||
*/ |
||||
|
||||
namespace Doctrine\Common\Cache; |
||||
|
||||
/** |
||||
* Zend Data Cache cache driver. |
||||
* |
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
||||
* @link www.doctrine-project.org |
||||
* @since 2.0 |
||||
* @author Ralph Schindler <ralph.schindler@zend.com> |
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||||
*/ |
||||
class ZendDataCache extends CacheProvider |
||||
{ |
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFetch($id) |
||||
{ |
||||
return zend_shm_cache_fetch($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doContains($id) |
||||
{ |
||||
return (false !== zend_shm_cache_fetch($id)); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doSave($id, $data, $lifeTime = 0) |
||||
{ |
||||
return zend_shm_cache_store($id, $data, $lifeTime); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doDelete($id) |
||||
{ |
||||
return zend_shm_cache_delete($id); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doFlush() |
||||
{ |
||||
$namespace = $this->getNamespace(); |
||||
if (empty($namespace)) { |
||||
return zend_shm_cache_clear(); |
||||
} |
||||
return zend_shm_cache_clear($namespace); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
protected function doGetStats() |
||||
{ |
||||
return null; |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@ |
||||
{ |
||||
"name": "guzzle/batch", |
||||
"description": "Guzzle batch component for batching requests, commands, or custom transfers", |
||||
"homepage": "http://guzzlephp.org/", |
||||
"keywords": ["batch", "HTTP", "REST", "guzzle"], |
||||
"license": "MIT", |
||||
"authors": [ |
||||
{ |
||||
"name": "Michael Dowling", |
||||
"email": "mtdowling@gmail.com", |
||||
"homepage": "https://github.com/mtdowling" |
||||
} |
||||
], |
||||
"require": { |
||||
"php": ">=5.3.2", |
||||
"guzzle/common": "self.version" |
||||
}, |
||||
"autoload": { |
||||
"psr-0": { "Guzzle\\Batch": "" } |
||||
}, |
||||
"suggest": { |
||||
"guzzle/http": "self.version", |
||||
"guzzle/service": "self.version" |
||||
}, |
||||
"target-dir": "Guzzle/Batch", |
||||
"extra": { |
||||
"branch-alias": { |
||||
"dev-master": "3.7-dev" |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
{ |
||||
"name": "guzzle/cache", |
||||
"description": "Guzzle cache adapter component", |
||||
"homepage": "http://guzzlephp.org/", |
||||
"keywords": ["cache", "adapter", "zf", "doctrine", "guzzle"], |
||||
"license": "MIT", |
||||
"authors": [ |
||||
{ |
||||
"name": "Michael Dowling", |
||||
"email": "mtdowling@gmail.com", |
||||
"homepage": "https://github.com/mtdowling" |
||||
} |
||||
], |
||||
"require": { |
||||
"php": ">=5.3.2", |
||||
"guzzle/common": "self.version" |
||||
}, |
||||
"autoload": { |
||||
"psr-0": { "Guzzle\\Cache": "" } |
||||
}, |
||||
"target-dir": "Guzzle/Cache", |
||||
"extra": { |
||||
"branch-alias": { |
||||
"dev-master": "3.7-dev" |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
{ |
||||
"name": "guzzle/common", |
||||
"homepage": "http://guzzlephp.org/", |
||||
"description": "Common libraries used by Guzzle", |
||||
"keywords": ["common", "event", "exception", "collection"], |
||||
"license": "MIT", |
||||
"require": { |
||||
"php": ">=5.3.2", |
||||
"symfony/event-dispatcher": ">=2.1" |
||||
}, |
||||
"autoload": { |
||||
"psr-0": { "Guzzle\\Common": "" } |
||||
}, |
||||
"target-dir": "Guzzle/Common", |
||||
"extra": { |
||||
"branch-alias": { |
||||
"dev-master": "3.7-dev" |
||||
} |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue