diff --git a/.appveyor.yml b/.appveyor.yml index 5ca3e94020a..51d965a2503 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -38,4 +38,4 @@ before_test: test_script: - cd C:\projects\yii2 - - vendor\bin\phpunit --exclude-group db,wincache,xcache,zenddata + - vendor\bin\phpunit --exclude-group db,wincache diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f249d32875..8c960a0ec68 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: [push, pull_request] env: DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi" EXTENSIONS: apcu, curl, dom, imagick, intl, mbstring, mcrypt, memcached, pdo, pdo_sqlite, sqlite - PHPUNIT_EXCLUDE_GROUP: db,wincache,xcache,zenddata + PHPUNIT_EXCLUDE_GROUP: db,wincache concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.gitignore b/.gitignore index 562e0d0300a..96ac2d5e964 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,8 @@ composer.phar phpunit.phar # local phpunit config /phpunit.xml +#phpunit cache +.phpunit.result.cache # ignore dev installed apps and extensions /apps diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84da01091cd..42b5d77a12e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,5 +94,5 @@ travis: - docker-compose up --build -d # wait for dbs ... - sleep 10 - - docker-compose run --rm php vendor/bin/phpunit -v --exclude mssql,oci,wincache,xcache,zenddata + - docker-compose run --rm php vendor/bin/phpunit -v --exclude mssql,oci,wincache diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 941c24de003..913b8f4fff9 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -84,7 +84,7 @@ build: - sudo locale-gen fr_FR.UTF-8 override: - - command: ./vendor/bin/phpunit --verbose --exclude-group db,wincache,xcache,zenddata --colors=always --coverage-clover ./coverage.xml + - command: ./vendor/bin/phpunit --verbose --exclude-group db,wincache --colors=always --coverage-clover ./coverage.xml on_node: 1 coverage: file: coverage.xml diff --git a/docs/guide-es/caching-data.md b/docs/guide-es/caching-data.md index 1349865d064..065903d8539 100644 --- a/docs/guide-es/caching-data.md +++ b/docs/guide-es/caching-data.md @@ -79,8 +79,6 @@ se muestra un listado con los componentes de caché disponibles: * [[yii\caching\MemCache]]: utiliza las extensiones de PHP [memcache](https://www.php.net/manual/es/book.memcache.php) y [memcached](https://www.php.net/manual/es/book.memcached.php). Esta opción puede ser considerada como la más rápida cuando la caché es manejada en una aplicación distribuida (ej. con varios servidores, con balance de carga, etc..) * [[yii\redis\Cache]]: implementa un componente de caché basado en [Redis](https://redis.io/) que almacenan pares clave-valor (requiere la versión 2.6.12 de redis). * [[yii\caching\WinCache]]: utiliza la extensión de PHP [WinCache](https://iis.net/downloads/microsoft/wincache-extension) ([ver también](https://www.php.net/manual/es/book.wincache.php)). -* [[yii\caching\XCache]] _(deprecated)_: utiliza la extensión de PHP [XCache](https://en.wikipedia.org/wiki/List_of_PHP_accelerators#XCache). -* [[yii\caching\ZendDataCache]] _(deprecated)_: utiliza [Zend Data Cache](https://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm) como el medio fundamental de caché. > Tip: Puedes utilizar diferentes tipos de almacenamiento de caché en la misma aplicación. Una estrategia común es la de usar almacenamiento de caché en memoria para almacenar datos que son pequeños pero que son utilizados constantemente (ej. datos estadísticos), y utilizar el almacenamiento de caché en archivos o en base de datos para guardar datos que son grandes y utilizados con menor frecuencia (ej. contenido de página). diff --git a/docs/guide-fr/caching-data.md b/docs/guide-fr/caching-data.md index 01979d539b3..d68571834d4 100644 --- a/docs/guide-fr/caching-data.md +++ b/docs/guide-fr/caching-data.md @@ -100,10 +100,6 @@ Yii prend en charge un large panel de supports de stockage pour cache. Ce qui su (une version de redis égale ou supérieure à 2.6.12 est nécessaire). * [[yii\caching\WinCache]]: utilise le [WinCache](https://iis.net/downloads/microsoft/wincache-extension) PHP ([voir aussi l'extension](https://www.php.net/manual/fr/book.wincache.php)). -* [[yii\caching\XCache]] _(deprecated)_: utilise l'extension PHP [XCache](https://en.wikipedia.org/wiki/List_of_PHP_accelerators#XCache). -* [[yii\caching\ZendDataCache]] _(deprecated)_: utilise le - [cache de données Zend](https://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm) - en tant que médium de cache sous-jacent. > Tip: vous pouvez utiliser différents supports de stockage pour cache dans la même application. Une stratégie courante est d'utiliser un support de stockage pour cache basé sur la mémoire pour stocker des données de petite taille mais d'usage constant (p. ex. des données statistiques), et d'utiliser des supports de stockage pour cache basés sur des fichiers ou des bases de données pour stocker des données volumineuses et utilisées moins souvent (p. ex. des contenus de pages). diff --git a/docs/guide-ja/caching-data.md b/docs/guide-ja/caching-data.md index 513fdc59466..7195f3512f0 100644 --- a/docs/guide-ja/caching-data.md +++ b/docs/guide-ja/caching-data.md @@ -128,11 +128,6 @@ Yii はさまざまなキャッシュ・ストレージをサポートしてい (Redis の バージョン 2.6.12 以降が必要とされます) 。 * [[yii\caching\WinCache]]: PHP の [WinCache](https://iis.net/downloads/microsoft/wincache-extension) エクステンションを使用します。 ([参照リンク](https://www.php.net/manual/ja/book.wincache.php)) -* [[yii\caching\XCache]] _(非推奨)_: PHP の [XCache](https://en.wikipedia.org/wiki/List_of_PHP_accelerators#XCache) 拡張モジュールを使用します。 -* [[yii\caching\ZendDataCache]] _(非推奨)_: - キャッシュ・メディアとして [Zend Data Cache](https://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm) - を使用します。 - > Tip: 同じアプリケーション内で異なるキャッシュを使用することもできます。 一般的なやり方として、小さくとも常に使用されるデータ (例えば、統計データ) を格納する場合はメモリ・ベースのキャッシュ・ストレージを使用し、 diff --git a/docs/guide-pt-BR/caching-data.md b/docs/guide-pt-BR/caching-data.md index 3801b355a1e..c259f286be1 100644 --- a/docs/guide-pt-BR/caching-data.md +++ b/docs/guide-pt-BR/caching-data.md @@ -96,10 +96,6 @@ Yii suporta uma ampla gama de sistemas de cache. A seguir um resumo: [Redis](https://redis.io/) (requer redis versão 2.6.12 ou mais recente). * [[yii\caching\WinCache]]: usa a extensão PHP [WinCache](https://iis.net/downloads/microsoft/wincache-extension) ([veja também](https://www.php.net/manual/pt_BR/book.wincache.php)). -* [[yii\caching\XCache]] _(deprecated)_: usa a extensão PHP [XCache](https://en.wikipedia.org/wiki/List_of_PHP_accelerators#XCache). -* [[yii\caching\ZendDataCache]] _(deprecated)_: usa - [Cache de Dados Zend](https://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm) - como o meio de cache subjacente. > Dica: Você pode usar vários tipos de cache na mesma aplicação. Uma estratégia comum é usar caches baseados diff --git a/docs/guide-ru/caching-data.md b/docs/guide-ru/caching-data.md index 7b1a3052e29..07d3358435e 100644 --- a/docs/guide-ru/caching-data.md +++ b/docs/guide-ru/caching-data.md @@ -102,8 +102,6 @@ Yii поддерживает множество хранилищ кэша: * [[yii\caching\MemCache]]: использует расширения PHP [memcache](https://www.php.net/manual/ru/book.memcache.php) и [memcached](https://www.php.net/manual/ru/book.memcached.php). Этот вариант может рассматриваться как самый быстрый при работе в распределенных приложениях (например, с несколькими серверами, балансировкой нагрузки и так далее); * [[yii\redis\Cache]]: реализует компонент кэша на основе [Redis](https://redis.io/), хранилища ключ-значение (требуется Redis версии 2.6.12 или выше); * [[yii\caching\WinCache]]: использует расширение PHP [WinCache](https://iis.net/downloads/microsoft/wincache-extension) ([смотрите также](https://www.php.net/manual/ru/book.wincache.php)); -* [[yii\caching\XCache]] _(deprecated)_: использует расширение PHP [XCache](https://en.wikipedia.org/wiki/List_of_PHP_accelerators#XCache); -* [[yii\caching\ZendDataCache]] _(deprecated)_: использует [Zend Data Cache](https://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm). > Tip: Вы можете использовать разные способы хранения кэша в одном приложении. Общая стратегия заключается в использовании памяти под хранение небольших часто используемых данных (например, статистические данные). Для больших и реже используемых данных (например, содержимое страницы) лучше использовать файлы или базу данных. diff --git a/docs/guide-zh-CN/caching-data.md b/docs/guide-zh-CN/caching-data.md index 046c85f4124..66bc0859d9e 100644 --- a/docs/guide-zh-CN/caching-data.md +++ b/docs/guide-zh-CN/caching-data.md @@ -128,10 +128,6 @@ Yii 支持一系列缓存存储器,概况如下: (需要 redis 2.6.12 及以上版本的支持 )。 * [[yii\caching\WinCache]]:使用 PHP [WinCache](https://iis.net/downloads/microsoft/wincache-extension) ([另可参考](https://www.php.net/manual/zh/book.wincache.php))扩展. -* [[yii\caching\XCache]]:使用 PHP [XCache](https://en.wikipedia.org/wiki/List_of_PHP_accelerators#XCache)扩展。 -* [[yii\caching\ZendDataCache]]:使用 - [Zend Data Cache](https://files.zend.com/help/Zend-Server-6/zend- server.htm#data_cache_component.htm) - 作为底层缓存媒介。 > Tip: 你可以在同一个应用程序中使用不同的缓存存储器。一个常见的策略是使用基于内存的缓存存储器 diff --git a/docs/guide/caching-data.md b/docs/guide/caching-data.md index 1c712e801d0..9f980250996 100644 --- a/docs/guide/caching-data.md +++ b/docs/guide/caching-data.md @@ -130,10 +130,6 @@ Yii supports a wide range of cache storage. The following is a summary: (redis version 2.6.12 or higher is required). * [[yii\caching\WinCache]]: uses PHP [WinCache](https://iis.net/downloads/microsoft/wincache-extension) ([see also](https://www.php.net/manual/en/book.wincache.php)) extension. -* [[yii\caching\XCache]] _(deprecated)_: uses PHP [XCache](https://en.wikipedia.org/wiki/List_of_PHP_accelerators#XCache) extension. -* [[yii\caching\ZendDataCache]] _(deprecated)_: uses - [Zend Data Cache](https://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm) - as the underlying caching medium. > Tip: You may use different cache storage in the same application. A common strategy is to use memory-based diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 8bd17d17eab..06d86c145b2 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -5,6 +5,7 @@ Yii Framework 2 Change Log ------------------------ - Chg #19902: Remove support for CUBRID (mtangoo) +- Chg #19891: Remove XCache and ZendDataCache support (mtangoo) 2.0.49 under development diff --git a/framework/UPGRADE.md b/framework/UPGRADE.md index 8286cf0100c..539873408a2 100644 --- a/framework/UPGRADE.md +++ b/framework/UPGRADE.md @@ -526,7 +526,6 @@ Upgrade from Yii 2.0.13 - Replace usages of `yii\base\InvalidParamException` with `yii\base\InvalidArgumentException`. - Replace calls to `Yii::trace()` with `Yii::debug()`. - Remove calls to `yii\BaseYii::powered()`. - - If you are using XCache or Zend data cache, those are going away in 2.1 so you might want to start looking for an alternative. * In case you aren't using CSRF cookies (REST APIs etc.) you should turn them off explicitly by setting `\yii\web\Request::$enableCsrfCookie` to `false` in your config file. diff --git a/framework/caching/XCache.php b/framework/caching/XCache.php deleted file mode 100644 index 06c305de2ea..00000000000 --- a/framework/caching/XCache.php +++ /dev/null @@ -1,111 +0,0 @@ - - * @since 2.0 - * @deprecated since 2.0.14. This class will be removed in 2.1.0. - */ -class XCache extends Cache -{ - /** - * Checks whether a specified key exists in the cache. - * This can be faster than getting the value from the cache if the data is big. - * Note that this method does not check whether the dependency associated - * with the cached data, if there is any, has changed. So a call to [[get]] - * may return false while exists returns true. - * @param mixed $key a key identifying the cached value. This can be a simple string or - * a complex data structure consisting of factors representing the key. - * @return bool true if a value exists in cache, false if the value is not in the cache or expired. - */ - public function exists($key) - { - $key = $this->buildKey($key); - - return xcache_isset($key); - } - - /** - * Retrieves a value from cache with a specified key. - * This is the implementation of the method declared in the parent class. - * @param string $key a unique key identifying the cached value - * @return mixed|false the value stored in cache, false if the value is not in the cache or expired. - */ - protected function getValue($key) - { - return xcache_isset($key) ? xcache_get($key) : false; - } - - /** - * Stores a value identified by a key in cache. - * This is the implementation of the method declared in the parent class. - * - * @param string $key the key identifying the value to be cached - * @param mixed $value the value to be cached. Most often it's a string. If you have disabled [[serializer]], - * it could be something else. - * @param int $duration the number of seconds in which the cached value will expire. 0 means never expire. - * @return bool true if the value is successfully stored into cache, false otherwise - */ - protected function setValue($key, $value, $duration) - { - return xcache_set($key, $value, $duration); - } - - /** - * Stores a value identified by a key into cache if the cache does not contain this key. - * This is the implementation of the method declared in the parent class. - * - * @param string $key the key identifying the value to be cached - * @param mixed $value the value to be cached. Most often it's a string. If you have disabled [[serializer]], - * it could be something else. - * @param int $duration the number of seconds in which the cached value will expire. 0 means never expire. - * @return bool true if the value is successfully stored into cache, false otherwise - */ - protected function addValue($key, $value, $duration) - { - return !xcache_isset($key) ? $this->setValue($key, $value, $duration) : false; - } - - /** - * Deletes a value with the specified key from cache - * This is the implementation of the method declared in the parent class. - * @param string $key the key of the value to be deleted - * @return bool if no error happens during deletion - */ - protected function deleteValue($key) - { - return xcache_unset($key); - } - - /** - * Deletes all values from cache. - * This is the implementation of the method declared in the parent class. - * @return bool whether the flush operation was successful. - */ - protected function flushValues() - { - for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) { - if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) { - return false; - } - } - - return true; - } -} diff --git a/framework/caching/ZendDataCache.php b/framework/caching/ZendDataCache.php deleted file mode 100644 index 0f49501db4c..00000000000 --- a/framework/caching/ZendDataCache.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @since 2.0 - * @deprecated since 2.0.14. This class will be removed in 2.1.0. - */ -class ZendDataCache extends Cache -{ - /** - * Retrieves a value from cache with a specified key. - * This is the implementation of the method declared in the parent class. - * @param string $key a unique key identifying the cached value - * @return mixed|false the value stored in cache, false if the value is not in the cache or expired. - */ - protected function getValue($key) - { - $result = zend_shm_cache_fetch($key); - - return $result === null ? false : $result; - } - - /** - * Stores a value identified by a key in cache. - * This is the implementation of the method declared in the parent class. - * - * @param string $key the key identifying the value to be cached - * @param mixed $value the value to be cached. Most often it's a string. If you have disabled [[serializer]], - * it could be something else. - * @param int $duration the number of seconds in which the cached value will expire. 0 means never expire. - * @return bool true if the value is successfully stored into cache, false otherwise - */ - protected function setValue($key, $value, $duration) - { - return zend_shm_cache_store($key, $value, $duration); - } - - /** - * Stores a value identified by a key into cache if the cache does not contain this key. - * This is the implementation of the method declared in the parent class. - * - * @param string $key the key identifying the value to be cached - * @param mixed $value the value to be cached. Most often it's a string. If you have disabled [[serializer]], - * it could be something else. - * @param int $duration the number of seconds in which the cached value will expire. 0 means never expire. - * @return bool true if the value is successfully stored into cache, false otherwise - */ - protected function addValue($key, $value, $duration) - { - return zend_shm_cache_fetch($key) === null ? $this->setValue($key, $value, $duration) : false; - } - - /** - * Deletes a value with the specified key from cache - * This is the implementation of the method declared in the parent class. - * @param string $key the key of the value to be deleted - * @return bool if no error happens during deletion - */ - protected function deleteValue($key) - { - return zend_shm_cache_delete($key); - } - - /** - * Deletes all values from cache. - * This is the implementation of the method declared in the parent class. - * @return bool whether the flush operation was successful. - */ - protected function flushValues() - { - return zend_shm_cache_clear(); - } -} diff --git a/framework/classes.php b/framework/classes.php index 4f52f31baa0..c148e32efa3 100644 --- a/framework/classes.php +++ b/framework/classes.php @@ -85,8 +85,6 @@ 'yii\caching\MemCacheServer' => YII2_PATH . '/caching/MemCacheServer.php', 'yii\caching\TagDependency' => YII2_PATH . '/caching/TagDependency.php', 'yii\caching\WinCache' => YII2_PATH . '/caching/WinCache.php', - 'yii\caching\XCache' => YII2_PATH . '/caching/XCache.php', - 'yii\caching\ZendDataCache' => YII2_PATH . '/caching/ZendDataCache.php', 'yii\captcha\Captcha' => YII2_PATH . '/captcha/Captcha.php', 'yii\captcha\CaptchaAction' => YII2_PATH . '/captcha/CaptchaAction.php', 'yii\captcha\CaptchaAsset' => YII2_PATH . '/captcha/CaptchaAsset.php', diff --git a/tests/README.md b/tests/README.md index 19856e5e0d0..626313701ca 100644 --- a/tests/README.md +++ b/tests/README.md @@ -85,7 +85,7 @@ Run a group of unit tests docker-compose run php vendor/bin/phpunit -v --group caching,db docker-compose run php vendor/bin/phpunit -v --exclude base,caching,db,i18n,log,mutex,rbac,validators,web - docker-compose run php vendor/bin/phpunit -v --exclude mssql,oci,wincache,xcache,zenddata + docker-compose run php vendor/bin/phpunit -v --exclude mssql,oci,wincache > Note: Documentation about [installing additional extensions](https://github.com/yiisoft/yii2-docker/blob/master/docs/install-extensions.md) can be found at `yiisoft/yii2-docker`. diff --git a/tests/framework/caching/XCacheTest.php b/tests/framework/caching/XCacheTest.php deleted file mode 100644 index 68859325ffe..00000000000 --- a/tests/framework/caching/XCacheTest.php +++ /dev/null @@ -1,36 +0,0 @@ -markTestSkipped('XCache not installed. Skipping.'); - } - - if ($this->_cacheInstance === null) { - $this->_cacheInstance = new XCache(); - } - - return $this->_cacheInstance; - } -} diff --git a/tests/framework/caching/ZendDataCacheTest.php b/tests/framework/caching/ZendDataCacheTest.php deleted file mode 100644 index 728b0042953..00000000000 --- a/tests/framework/caching/ZendDataCacheTest.php +++ /dev/null @@ -1,36 +0,0 @@ -markTestSkipped('Zend Data cache not installed. Skipping.'); - } - - if ($this->_cacheInstance === null) { - $this->_cacheInstance = new ZendDataCache(); - } - - return $this->_cacheInstance; - } -}