Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Correct spelling of function getMajorVersion #4830

Merged
merged 4 commits into from

2 participants

@Rockstar04

Corrected the name of the function and provide a proxy for backwards compatibility. Refs #4804

@Rockstar04 Rockstar04 Correct spelling of function getMajorVersion
Corrected the name of the function and provide a proxy for backwards compatibility. Refs #4804
1fc6046
@Rockstar04

I will review this pull request when I get home, I submitted this rough version from my phone at a family gathering.

I will try to add tests and review the addition after I get home tonight.

Rockstar04 added some commits
@Rockstar04 Rockstar04 Corrected trailing spaces in docBlock of GetMayorVersion
Updated existing docblock to be more inline with other depricated functions and added the deprecation version
40855eb
@Rockstar04 Rockstar04 Update unit tests to test the new function, and not the old incorrect…
… spelling
2b87131
@Maks3w
Collaborator

Nice, just change the calls to the old method (3 calls) in https://github.com/zendframework/zf2/blob/master/library/Zend/Cache/Storage/Adapter/Redis.php#L229 and go

@Rockstar04 Rockstar04 Use corrected function name in Cache\Storage\Adapter\Redis
Update the Redis cache adapter to use the corrected function name getMajorVersion from the RedisResourceManager
64a4e48
@Rockstar04

Thanks for the help with my first contribution @Maks3w ! Hopefully everything is ready to go now.

@Maks3w Maks3w was assigned
@Maks3w Maks3w merged commit 64a4e48 into zendframework:master
@Rockstar04 Rockstar04 deleted the unknown repository branch
@gianarb gianarb referenced this pull request from a commit in zendframework/zend-cache
@Maks3w Maks3w Merge pull request zendframework/zf2#4830. Fix zendframework/zf2#4804 d25dc7a
@gianarb gianarb referenced this pull request from a commit in zendframework/zend-cache
@Maks3w Maks3w Merge pull request zendframework/zf2#4830. Fix zendframework/zf2#4804
…in develop
0c9c87e
@gianarb gianarb referenced this pull request from a commit in zendframework/zend-cache
@Maks3w Maks3w Merge pull request zendframework/zf2#4830. Fix zendframework/zf2#4804
…in master
77fe406
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 14, 2013
  1. @Rockstar04

    Correct spelling of function getMajorVersion

    Rockstar04 authored
    Corrected the name of the function and provide a proxy for backwards compatibility. Refs #4804
Commits on Jul 15, 2013
  1. @Rockstar04

    Corrected trailing spaces in docBlock of GetMayorVersion

    Rockstar04 authored
    Updated existing docblock to be more inline with other depricated functions and added the deprecation version
  2. @Rockstar04
  3. @Rockstar04

    Use corrected function name in Cache\Storage\Adapter\Redis

    Rockstar04 authored
    Update the Redis cache adapter to use the corrected function name getMajorVersion from the RedisResourceManager
This page is out of date. Refresh to see the latest.
View
6 library/Zend/Cache/Storage/Adapter/Redis.php
@@ -226,7 +226,7 @@ protected function internalSetItem(& $normalizedKey, & $value)
try {
if ($ttl) {
- if ($this->resourceManager->getMayorVersion($this->resourceId) < 2) {
+ if ($this->resourceManager->getMajorVersion($this->resourceId) < 2) {
throw new Exception\UnsupportedMethodCallException("To use ttl you need version >= 2.0.0");
}
$success = $redis->setex($this->namespacePrefix . $normalizedKey, $ttl, $value);
@@ -260,7 +260,7 @@ protected function internalSetItems(array & $normalizedKeyValuePairs)
try {
if ($ttl > 0) {
//check if ttl is supported
- if ($this->resourceManager->getMayorVersion($this->resourceId) < 2) {
+ if ($this->resourceManager->getMajorVersion($this->resourceId) < 2) {
throw new Exception\UnsupportedMethodCallException("To use ttl you need version >= 2.0.0");
}
//mSet does not allow ttl, so use transaction
@@ -402,7 +402,7 @@ protected function internalGetCapabilities()
{
if ($this->capabilities === null) {
$this->capabilityMarker = new stdClass();
- $minTtl = $this->resourceManager->getMayorVersion($this->resourceId) < 2 ? 0 : 1;
+ $minTtl = $this->resourceManager->getMajorVersion($this->resourceId) < 2 ? 0 : 1;
//without serialization redis supports only strings for simple
//get/set methods
$this->capabilities = new Capabilities(
View
14 library/Zend/Cache/Storage/Adapter/RedisResourceManager.php
@@ -508,12 +508,26 @@ public function getDatabase($id)
/**
* Get redis server version
*
+ * @deprecated 2.2.2 Use getMajorVersion instead
+ *
* @param string $id
* @return int
* @throws Exception\RuntimeException
*/
public function getMayorVersion($id)
{
+ return $this->getMajorVersion($id);
+ }
+
+ /**
+ * Get redis server version
+ *
+ * @param string $id
+ * @return int
+ * @throws Exception\RuntimeException
+ */
+ public function getMajorVersion($id)
+ {
if (!$this->hasResource($id)) {
throw new Exception\RuntimeException("No resource with id '{$id}'");
}
View
6 tests/ZendTest/Cache/Storage/Adapter/RedisTest.php
@@ -144,12 +144,12 @@ public function testGetCapabilitiesTtl()
$redisResource = new RedisResource();
$redisResource->connect($host, $port);
$info = $redisResource->info();
- $mayorVersion = (int)$info['redis_version'];
+ $majorVersion = (int)$info['redis_version'];
- $this->assertEquals($mayorVersion, $this->_options->getResourceManager()->getMayorVersion($this->_options->getResourceId()));
+ $this->assertEquals($majorVersion, $this->_options->getResourceManager()->getMajorVersion($this->_options->getResourceId()));
$capabilities = $this->_storage->getCapabilities();
- if ($mayorVersion < 2) {
+ if ($majorVersion < 2) {
$this->assertEquals(0, $capabilities->getMinTtl(), 'Redis version < 2.0.0 does not support key expiration');
} else {
$this->assertEquals(1, $capabilities->getMinTtl(), 'Redis version > 2.0.0 supports key expiration');
Something went wrong with that request. Please try again.