diff --git a/composer.json b/composer.json index 8d8dcd5c47f2accd84ced3129f3fbcb95418223e..2ce06e518233c8b8451b383ff8be7150ff880a3c 100644 --- a/composer.json +++ b/composer.json @@ -118,7 +118,7 @@ "drupal/migrate_tools": "4.0", "drupal/paragraphs": "1.3", "drupal/pathauto": "1.0", - "drupal/redis": "1.0-rc2", + "drupal/redis": "1.0", "drupal/roleassign": "^1.0@alpha", "drupal/scheduler": "1.0", "drupal/search_api": "1.1", diff --git a/composer.lock b/composer.lock index c1d2e5493f1e8db66359e5fcaf8b8b735c4d8601..4af46487dd3f45f9fde7da0714001c442a3505ef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "8452601cd705e8fd249c372b56b62636", + "content-hash": "2df083d770e28fc281b43122b934f357", "packages": [ { "name": "alchemy/zippy", @@ -4781,17 +4781,17 @@ }, { "name": "drupal/redis", - "version": "1.0.0-rc2", + "version": "1.0.0", "source": { "type": "git", "url": "https://git.drupal.org/project/redis", - "reference": "8.x-1.0-rc2" + "reference": "8.x-1.0" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/redis-8.x-1.0-rc2.zip", - "reference": "8.x-1.0-rc2", - "shasum": "7eeaa7078e9df6f4bbea1ca90dbc43aa044da346" + "url": "https://ftp.drupal.org/files/projects/redis-8.x-1.0.zip", + "reference": "8.x-1.0", + "shasum": "98cf460db5c9aaacf3d5c02ac51e0c9e8e85edbb" }, "require": { "drupal/core": "~8.0" @@ -4805,11 +4805,11 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.0-rc2", + "version": "8.x-1.0", "datestamp": "1527699484", "security-coverage": { - "status": "not-covered", - "message": "RC releases are not covered by Drupal security advisories." + "status": "covered", + "message": "Covered by Drupal's security advisory policy" } } }, diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 9b1cd40d36b5c6f1666b83a80eff607690d6a401..553274385b82ace565bbf5e2beb03e2694061d07 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2472,6 +2472,7 @@ 'Drupal\\redis\\Lock\\PhpRedis' => $baseDir . '/web/modules/redis/src/Lock/PhpRedis.php', 'Drupal\\redis\\Lock\\Predis' => $baseDir . '/web/modules/redis/src/Lock/Predis.php', 'Drupal\\redis\\PersistentLock\\PhpRedis' => $baseDir . '/web/modules/redis/src/PersistentLock/PhpRedis.php', + 'Drupal\\redis\\PersistentLock\\Predis' => $baseDir . '/web/modules/redis/src/PersistentLock/Predis.php', 'Drupal\\redis\\Queue\\PhpRedis' => $baseDir . '/web/modules/redis/src/Queue/PhpRedis.php', 'Drupal\\redis\\Queue\\Predis' => $baseDir . '/web/modules/redis/src/Queue/Predis.php', 'Drupal\\redis\\Queue\\QueueBase' => $baseDir . '/web/modules/redis/src/Queue/QueueBase.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index dc9d97e8d7b788a9c703954a0743be1395225489..d3091d1dd22de5f34081598b89a4522cab751bc5 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -2992,6 +2992,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Drupal\\redis\\Lock\\PhpRedis' => __DIR__ . '/../..' . '/web/modules/redis/src/Lock/PhpRedis.php', 'Drupal\\redis\\Lock\\Predis' => __DIR__ . '/../..' . '/web/modules/redis/src/Lock/Predis.php', 'Drupal\\redis\\PersistentLock\\PhpRedis' => __DIR__ . '/../..' . '/web/modules/redis/src/PersistentLock/PhpRedis.php', + 'Drupal\\redis\\PersistentLock\\Predis' => __DIR__ . '/../..' . '/web/modules/redis/src/PersistentLock/Predis.php', 'Drupal\\redis\\Queue\\PhpRedis' => __DIR__ . '/../..' . '/web/modules/redis/src/Queue/PhpRedis.php', 'Drupal\\redis\\Queue\\Predis' => __DIR__ . '/../..' . '/web/modules/redis/src/Queue/Predis.php', 'Drupal\\redis\\Queue\\QueueBase' => __DIR__ . '/../..' . '/web/modules/redis/src/Queue/QueueBase.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 97310e09017675b59b876b6878dc56a7c5513539..6e55505abf004bbfabc2897cb6a6e4a50ea4f948 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -4928,18 +4928,18 @@ }, { "name": "drupal/redis", - "version": "1.0.0-rc2", - "version_normalized": "1.0.0.0-RC2", + "version": "1.0.0", + "version_normalized": "1.0.0.0", "source": { "type": "git", "url": "https://git.drupal.org/project/redis", - "reference": "8.x-1.0-rc2" + "reference": "8.x-1.0" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/redis-8.x-1.0-rc2.zip", - "reference": "8.x-1.0-rc2", - "shasum": "7eeaa7078e9df6f4bbea1ca90dbc43aa044da346" + "url": "https://ftp.drupal.org/files/projects/redis-8.x-1.0.zip", + "reference": "8.x-1.0", + "shasum": "98cf460db5c9aaacf3d5c02ac51e0c9e8e85edbb" }, "require": { "drupal/core": "~8.0" @@ -4953,11 +4953,11 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.0-rc2", + "version": "8.x-1.0", "datestamp": "1527699484", "security-coverage": { - "status": "not-covered", - "message": "RC releases are not covered by Drupal security advisories." + "status": "covered", + "message": "Covered by Drupal's security advisory policy" } } }, diff --git a/web/modules/redis/.travis.yml b/web/modules/redis/.travis.yml index 30bba24e71763bf65942c2edb50d8e3ac3763826..400d14326b983ce0bbaffa1f92f2fb6224940136 100644 --- a/web/modules/redis/.travis.yml +++ b/web/modules/redis/.travis.yml @@ -12,12 +12,9 @@ php: - 5.5 - 5.6 - 7 - - hhvm matrix: fast_finish: true - allow_failures: - - php: hhvm env: global: @@ -63,7 +60,7 @@ env: - DRUPAL_TI_BEHAT_BROWSER="firefox" # Use Drupal 8.3.x to run tests. - - DRUPAL_TI_CORE_BRANCH="8.3.x" + - DRUPAL_TI_CORE_BRANCH="8.5.x" # PHPUnit specific commandline arguments. - DRUPAL_TI_PHPUNIT_ARGS="--verbose --debug" diff --git a/web/modules/redis/redis.info.yml b/web/modules/redis/redis.info.yml index cc9f2354863aea10e2854738093d48f6b8f4c570..06a5bbcb67e04e43c7e325b53621ef3d26a816a4 100644 --- a/web/modules/redis/redis.info.yml +++ b/web/modules/redis/redis.info.yml @@ -5,8 +5,8 @@ type: module # core: 8.x configure: redis.admin_display -# Information added by Drupal.org packaging script on 2017-09-14 -version: '8.x-1.0-rc2' +# Information added by Drupal.org packaging script on 2018-05-30 +version: '8.x-1.0' core: '8.x' project: 'redis' -datestamp: 1505390051 +datestamp: 1527699489 diff --git a/web/modules/redis/src/Cache/CacheBase.php b/web/modules/redis/src/Cache/CacheBase.php index 4fe8e5dce7725dc7ab0f7675fcf26c2453ce2ae8..6daf590ace10869e55de1f99f9dfd2b917af0e4c 100644 --- a/web/modules/redis/src/Cache/CacheBase.php +++ b/web/modules/redis/src/Cache/CacheBase.php @@ -3,6 +3,7 @@ namespace Drupal\redis\Cache; use \DateInterval; +use Drupal\Component\Assertion\Inspector; use Drupal\Component\Serialization\SerializationInterface; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; @@ -297,7 +298,7 @@ protected function createEntryHash($cid, $data, $expire = Cache::PERMANENT, arra // Always add a cache tag for the current bin, so that we can use that for // invalidateAll(). $tags[] = $this->getTagForBin(); - assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($tags)', 'Cache Tags must be strings.'); + assert(Inspector::assertAllStrings($tags), 'Cache Tags must be strings.'); $hash = [ 'cid' => $cid, 'created' => round(microtime(TRUE), 3), diff --git a/web/modules/redis/src/Lock/Predis.php b/web/modules/redis/src/Lock/Predis.php index bede5d97b89555bf633d19be73c6e851b6951815..aa67ca14350a71e3e4194137a845f5f23153f47a 100644 --- a/web/modules/redis/src/Lock/Predis.php +++ b/web/modules/redis/src/Lock/Predis.php @@ -84,8 +84,8 @@ public function acquire($name, $timeout = 30.0) { // succeed if the key does not exist yet. $result = $this->client->set($key, $id, 'nx', 'px', (int) ($timeout * 1000)); - // If the result is FALSE, we failed to acquire the lock. - if (FALSE === $result) { + // If the result is FALSE or NULL, we failed to acquire the lock. + if (FALSE === $result || NULL === $result) { return FALSE; } diff --git a/web/modules/redis/src/PersistentLock/Predis.php b/web/modules/redis/src/PersistentLock/Predis.php new file mode 100644 index 0000000000000000000000000000000000000000..79252e77e5398f7561c34a01ce8c2f9f63a1b255 --- /dev/null +++ b/web/modules/redis/src/PersistentLock/Predis.php @@ -0,0 +1,26 @@ +<?php + +namespace Drupal\redis\PersistentLock; + +use Drupal\redis\ClientFactory; + +/** + * Predis persistent lock backend + */ +class Predis extends \Drupal\redis\Lock\Predis { + + /** + * Creates a Predis persistent lock backend. + */ + public function __construct(ClientFactory $factory) { + // Do not call the parent constructor to avoid registering a shutdown + // function that releases all the locks at the end of a request. + $this->client = $factory->getClient(); + // Set the lockId to a fixed string to make the lock ID the same across + // multiple requests. The lock ID is used as a page token to relate all the + // locks set during a request to each other. + // @see \Drupal\Core\Lock\LockBackendInterface::getLockId() + $this->lockId = 'persistent'; + } + +} diff --git a/web/modules/redis/tests/src/Functional/Lock/RedisLockFunctionalTest.php b/web/modules/redis/tests/src/Functional/Lock/RedisLockFunctionalTest.php index fbf4b0461b02c054b0c302ae00ef49b0a7a5de36..d74a05ee2a87a63c220092a27622e0b8e4cc1b07 100644 --- a/web/modules/redis/tests/src/Functional/Lock/RedisLockFunctionalTest.php +++ b/web/modules/redis/tests/src/Functional/Lock/RedisLockFunctionalTest.php @@ -41,7 +41,7 @@ protected function setUp() { file_put_contents($filename, $contents); $settings = Settings::getAll(); $settings['container_yamls'][] = 'modules/redis/example.services.yml'; - $settings['redis.connection']['interface'] = '\'' . $redis_interface . '\''; + $settings['redis.connection']['interface'] = $redis_interface; new Settings($settings); OpCodeCache::invalidate(DRUPAL_ROOT . '/' . $filename); diff --git a/web/modules/redis/tests/src/Functional/WebTest.php b/web/modules/redis/tests/src/Functional/WebTest.php index d5cfcb22d66d8aa4b74005ff49ad13fc38db6b2b..e49dfa3472ea47ddcf912668cb006493722499cf 100644 --- a/web/modules/redis/tests/src/Functional/WebTest.php +++ b/web/modules/redis/tests/src/Functional/WebTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\redis\Functional; use Drupal\Component\Utility\OpCodeCache; -use Drupal\Component\Utility\Unicode; use Drupal\Core\Database\Database; use Drupal\Core\Site\Settings; use Drupal\field_ui\Tests\FieldUiTestTrait; @@ -142,10 +141,10 @@ public function testModuleInstallation() { // Create a node type with a field. $edit = [ 'name' => $this->randomString(), - 'type' => $node_type = Unicode::strtolower($this->randomMachineName()), + 'type' => $node_type = mb_strtolower($this->randomMachineName()), ]; $this->drupalPostForm('admin/structure/types/add', $edit, t('Save and manage fields')); - $field_name = Unicode::strtolower($this->randomMachineName()); + $field_name = mb_strtolower($this->randomMachineName()); $this->fieldUIAddNewField('admin/structure/types/manage/' . $node_type, $field_name, NULL, 'text'); // Create a node, check display, edit, verify that it has been updated. @@ -154,7 +153,7 @@ public function testModuleInstallation() { 'body[0][value]' => $this->randomMachineName(), 'field_' . $field_name . '[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm('node/add/' . $node_type, $edit, t('Save and publish')); + $this->drupalPostForm('node/add/' . $node_type, $edit, t('Save')); // Test the output as anonymous user. $this->drupalLogout(); @@ -169,7 +168,7 @@ public function testModuleInstallation() { $update = [ 'title[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm(NULL, $update, t('Save and keep published')); + $this->drupalPostForm(NULL, $update, t('Save')); $this->assertSession()->responseContains($update['title[0][value]']); $this->drupalGet('node'); $this->assertSession()->responseContains($update['title[0][value]']); diff --git a/web/modules/redis/tests/src/Kernel/RedisQueueTest.php b/web/modules/redis/tests/src/Kernel/RedisQueueTest.php index 137cb98213ea2fb555ba59be8c34d26c1bd67d27..78110049ae689ec4a220eac8cf213cd9e2775967 100644 --- a/web/modules/redis/tests/src/Kernel/RedisQueueTest.php +++ b/web/modules/redis/tests/src/Kernel/RedisQueueTest.php @@ -39,7 +39,7 @@ public function testRedisNonBlockingQueue() { $queue2 = new $class_name($this->randomMachineName(), $settings, $client_factory->getClient()); $queue2->createQueue(); - $this->queueTest($queue1, $queue2); + $this->runQueueTest($queue1, $queue2); $queue1->deleteQueue(); $queue2->deleteQueue(); @@ -53,7 +53,7 @@ public function testRedisNonBlockingQueue() { $queue2 = new $class_name($this->randomMachineName(), $settings, $client_factory->getClient()); $queue2->createQueue(); - $this->queueTest($queue1, $queue2); + $this->runQueueTest($queue1, $queue2); } /** @@ -74,7 +74,7 @@ public function testRedisBlockingQueue() { $queue2 = new $class_name($this->randomMachineName(), $settings, $client_factory->getClient()); $queue2->createQueue(); - $this->queueTest($queue1, $queue2); + $this->runQueueTest($queue1, $queue2); } /**