Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add apcu enabled check if apcu extension loaded (#10310) #10311

Merged
merged 4 commits into from
Dec 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
php-version: "${{ matrix.php-version }}"
extensions: "apcu, pdo, ${{ matrix.extension }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
ini-values: "zend.assertions=1, apc.enable_cli=1"
aleksejs1 marked this conversation as resolved.
Show resolved Hide resolved

- name: "Require specific DBAL version"
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
ini-values: "zend.assertions=1, apc.enable_cli=1"

- name: "Require specific DBAL version"
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
Expand Down Expand Up @@ -211,7 +211,7 @@ jobs:
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
ini-values: "zend.assertions=1, apc.enable_cli=1"
extensions: "${{ matrix.extension }}"

- name: "Install dependencies with Composer"
Expand Down Expand Up @@ -276,7 +276,7 @@ jobs:
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
ini-values: "zend.assertions=1, apc.enable_cli=1"
extensions: "${{ matrix.extension }}"

- name: "Require specific DBAL version"
Expand Down Expand Up @@ -327,7 +327,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: "zend.assertions=1"
ini-values: "zend.assertions=1, apc.enable_cli=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpbench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
ini-values: "zend.assertions=1, apc.enable_cli=1"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v3"
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/ORMSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Symfony\Component\Cache\Adapter\MemcachedAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;

use function apcu_enabled;
use function class_exists;
use function extension_loaded;
use function md5;
Expand Down Expand Up @@ -181,7 +182,7 @@ private static function createCacheInstance(

$namespace = 'dc2_' . md5($proxyDir);

if (extension_loaded('apcu')) {
if (extension_loaded('apcu') && apcu_enabled()) {
return new ApcuAdapter($namespace);
}

Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Tools/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Symfony\Component\Cache\Adapter\MemcachedAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;

use function apcu_enabled;
use function class_exists;
use function dirname;
use function extension_loaded;
Expand Down Expand Up @@ -236,7 +237,7 @@ private static function createCacheInstance(bool $isDevMode, ?Cache $cache): Cac

if ($isDevMode === true) {
$cache = class_exists(ArrayCache::class) ? new ArrayCache() : new ArrayAdapter();
} elseif (extension_loaded('apcu')) {
} elseif (extension_loaded('apcu') && apcu_enabled()) {
$cache = class_exists(ApcuCache::class) ? new ApcuCache() : new ApcuAdapter();
} elseif (extension_loaded('memcached') && (class_exists(MemcachedCache::class) || MemcachedAdapter::isSupported())) {
$memcached = new Memcached();
Expand Down