Merge pull request #7623 from andrewandante/bugfix/apcu_cli

check for apc.enable_cli when running from CLI
This commit is contained in:
Daniel Hensby 2017-11-22 11:33:33 +00:00 committed by GitHub
commit 9f0917ff5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ namespace SilverStripe\Core\Cache;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Control\Director;
use SilverStripe\Core\Injector\Injector;
use Symfony\Component\Cache\Simple\FilesystemCache;
use Symfony\Component\Cache\Simple\ApcuCache;
@ -85,7 +86,8 @@ class DefaultCacheFactory implements CacheFactory
{
static $apcuSupported = null;
if (null === $apcuSupported) {
$apcuSupported = ApcuAdapter::isSupported();
// Need to check for CLI because Symfony won't: https://github.com/symfony/symfony/pull/25080
$apcuSupported = Director::is_cli() ? ini_get('apc.enable_cli') && ApcuAdapter::isSupported() : ApcuAdapter::isSupported();
}
return $apcuSupported;
}