diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-10-18 09:31:31 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-10-18 09:31:31 +0200 |
commit | 80f7dc77d430774192b929d780f96260066df2ee (patch) | |
tree | 102eaae7fc9ec567f2af76e96da3de2d1e83afcf /vendor/ruflin/elastica/lib/Elastica/Transport/Memcache.php | |
parent | cccd7bb4d819334c07e0dadaf16cbfdef31880e1 (diff) |
Update to MediaWiki 1.25.3
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Transport/Memcache.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Transport/Memcache.php | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Transport/Memcache.php b/vendor/ruflin/elastica/lib/Elastica/Transport/Memcache.php deleted file mode 100644 index cf047b58..00000000 --- a/vendor/ruflin/elastica/lib/Elastica/Transport/Memcache.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -namespace Elastica\Transport; - -use Elastica\Exception\InvalidException; -use Elastica\Exception\PartialShardFailureException; -use Elastica\Exception\ResponseException; -use Elastica\JSON; -use Elastica\Request; -use Elastica\Response; - -/** - * Elastica Memcache Transport object - * - * @category Xodoa - * @package Elastica - * @author Nicolas Ruflin <spam@ruflin.com> - */ -class Memcache extends AbstractTransport -{ - /** - * Makes calls to the elasticsearch server - * - * @param \Elastica\Request $request - * @param array $params Host, Port, ... - * @throws \Elastica\Exception\ResponseException - * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Response Response object - */ - public function exec(Request $request, array $params) - { - $memcache = new \Memcache(); - $memcache->connect($this->getConnection()->getHost(), $this->getConnection()->getPort()); - - // Finds right function name - $function = strtolower($request->getMethod()); - - $data = $request->getData(); - - $content = ''; - - if (!empty($data) || '0' === $data) { - if (is_array($data)) { - $content = JSON::stringify($data); - } else { - $content = $data; - } - - // Escaping of / not necessary. Causes problems in base64 encoding of files - $content = str_replace('\/', '/', $content); - } - - $responseString = ''; - - switch ($function) { - case 'post': - case 'put': - $memcache->set($request->getPath(), $content); - break; - case 'get': - $responseString = $memcache->get($request->getPath() . '?source=' . $content); - break; - case 'delete': - break; - default: - throw new InvalidException('Method ' . $function . ' is not supported in memcache transport'); - - } - - $response = new Response($responseString); - - if ($response->hasError()) { - throw new ResponseException($request, $response); - } - - if ($response->hasFailedShards()) { - throw new PartialShardFailureException($request, $response); - } - - return $response; - } -} |