From 8efae0b232210b27200f2709e7fcb24c7f02c5de Mon Sep 17 00:00:00 2001 From: Guilherme Blanco Date: Mon, 3 Oct 2011 01:30:20 -0300 Subject: [PATCH] Fixes DDC-1396. --- .../Tools/Console/Command/ClearCache/MetadataCommand.php | 7 ++++++- .../ORM/Tools/Console/Command/ClearCache/QueryCommand.php | 7 ++++++- .../ORM/Tools/Console/Command/ClearCache/ResultCommand.php | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php index ef7b02e3c..13243a0f7 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php @@ -21,7 +21,8 @@ namespace Doctrine\ORM\Tools\Console\Command\ClearCache; use Symfony\Component\Console\Input\InputArgument, Symfony\Component\Console\Input\InputOption, - Symfony\Component\Console; + Symfony\Component\Console, + Doctrine\Common\Cache; /** * Command to clear the metadata cache of the various cache drivers. @@ -83,6 +84,10 @@ EOT if ( ! $cacheDriver) { throw new \InvalidArgumentException('No Metadata cache driver is configured on given EntityManager.'); } + + if ($cacheDriver instanceof Cache\ApcCache) { + throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); + } $output->write('Clearing ALL Metadata cache entries' . PHP_EOL); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryCommand.php index becb78a90..6451d4ad7 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryCommand.php @@ -21,7 +21,8 @@ namespace Doctrine\ORM\Tools\Console\Command\ClearCache; use Symfony\Component\Console\Input\InputArgument, Symfony\Component\Console\Input\InputOption, - Symfony\Component\Console; + Symfony\Component\Console, + Doctrine\Common\Cache; /** * Command to clear the query cache of the various cache drivers. @@ -83,6 +84,10 @@ EOT if ( ! $cacheDriver) { throw new \InvalidArgumentException('No Query cache driver is configured on given EntityManager.'); } + + if ($cacheDriver instanceof Cache\ApcCache) { + throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); + } $output->write('Clearing ALL Query cache entries' . PHP_EOL); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/ResultCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/ResultCommand.php index d8efeaa44..1dfacb056 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/ResultCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/ResultCommand.php @@ -21,7 +21,8 @@ namespace Doctrine\ORM\Tools\Console\Command\ClearCache; use Symfony\Component\Console\Input\InputArgument, Symfony\Component\Console\Input\InputOption, - Symfony\Component\Console; + Symfony\Component\Console, + Doctrine\Common\Cache; /** * Command to clear the result cache of the various cache drivers. @@ -83,6 +84,10 @@ EOT if ( ! $cacheDriver) { throw new \InvalidArgumentException('No Result cache driver is configured on given EntityManager.'); } + + if ($cacheDriver instanceof Cache\ApcCache) { + throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); + } $output->write('Clearing ALL Result cache entries' . PHP_EOL);