From 31116a14a992ee40203d25feed8923f31d324da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Tue, 14 Apr 2015 17:07:11 +0200 Subject: [PATCH] Remove OpCache options as now bundled with PHP5.5+ --- config/configuration.sample.yml | 3 -- lib/Alchemy/Phrasea/Command/CheckConfig.php | 2 - .../Command/Setup/CheckEnvironment.php | 2 - .../Core/Provider/CacheServiceProvider.php | 6 +-- .../Phrasea/Setup/ConfigurationTester.php | 6 +-- .../Phrasea/Setup/Probe/OpcodeCacheProbe.php | 48 ------------------- .../Requirements/OpcodeCacheRequirement.php | 32 ------------- .../Setup/Version/Migration/Migration38.php | 9 ---- lib/conf.d/configuration.yml | 3 -- .../config/phraseanet/configuration.yml | 3 -- .../Fixtures/configuration-setup.yml | 3 -- .../Fixtures/configuration-with-hosts.yml | 3 -- .../Configuration/Fixtures/configuration.yml | 3 -- .../Fixtures/configuration-debugger.yml | 3 -- .../Fixtures/configuration-maintenance.yml | 3 -- .../Setup/Probe/OpcodeCacheProbeTest.php | 11 ----- .../OpcodeCacheRequirementTest.php | 13 ----- .../Version/Migration/Migration38Test.php | 4 -- 18 files changed, 5 insertions(+), 152 deletions(-) delete mode 100644 lib/Alchemy/Phrasea/Setup/Probe/OpcodeCacheProbe.php delete mode 100644 lib/Alchemy/Phrasea/Setup/Requirements/OpcodeCacheRequirement.php delete mode 100644 tests/Alchemy/Tests/Phrasea/Setup/Probe/OpcodeCacheProbeTest.php delete mode 100644 tests/Alchemy/Tests/Phrasea/Setup/Requirements/OpcodeCacheRequirementTest.php diff --git a/config/configuration.sample.yml b/config/configuration.sample.yml index 77e6bf76ff..2dacef0004 100644 --- a/config/configuration.sample.yml +++ b/config/configuration.sample.yml @@ -23,9 +23,6 @@ main: options: host: localhost port: 11211 - opcodecache: - type: ArrayCache - options: [] search-engine: type: phrasea options: [] diff --git a/lib/Alchemy/Phrasea/Command/CheckConfig.php b/lib/Alchemy/Phrasea/Command/CheckConfig.php index e135b83390..dcfc8030f7 100644 --- a/lib/Alchemy/Phrasea/Command/CheckConfig.php +++ b/lib/Alchemy/Phrasea/Command/CheckConfig.php @@ -16,7 +16,6 @@ use Alchemy\Phrasea\Setup\Probe\CacheServerProbe; use Alchemy\Phrasea\Setup\Probe\DataboxStructureProbe; use Alchemy\Phrasea\Setup\Probe\FilesystemProbe; use Alchemy\Phrasea\Setup\Probe\LocalesProbe; -use Alchemy\Phrasea\Setup\Probe\OpcodeCacheProbe; use Alchemy\Phrasea\Setup\Probe\PhpProbe; use Alchemy\Phrasea\Setup\Probe\SearchEngineProbe; use Alchemy\Phrasea\Setup\Probe\SubdefsPathsProbe; @@ -45,7 +44,6 @@ class CheckConfig extends AbstractCheckCommand DataboxStructureProbe::create($this->container), FilesystemProbe::create($this->container), LocalesProbe::create($this->container), - OpcodeCacheProbe::create($this->container), PhpProbe::create($this->container), SearchEngineProbe::create($this->container), SubdefsPathsProbe::create($this->container), diff --git a/lib/Alchemy/Phrasea/Command/Setup/CheckEnvironment.php b/lib/Alchemy/Phrasea/Command/Setup/CheckEnvironment.php index 6190be734f..c3bd720aff 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/CheckEnvironment.php +++ b/lib/Alchemy/Phrasea/Command/Setup/CheckEnvironment.php @@ -16,7 +16,6 @@ use Alchemy\Phrasea\Setup\Requirements\BinariesRequirements; use Alchemy\Phrasea\Setup\Requirements\CacheServerRequirement; use Alchemy\Phrasea\Setup\Requirements\FilesystemRequirements; use Alchemy\Phrasea\Setup\Requirements\LocalesRequirements; -use Alchemy\Phrasea\Setup\Requirements\OpcodeCacheRequirement; use Alchemy\Phrasea\Setup\Requirements\PhpRequirements; use Alchemy\Phrasea\Setup\Requirements\SystemRequirements; @@ -45,7 +44,6 @@ class CheckEnvironment extends AbstractCheckCommand new CacheServerRequirement(), new FilesystemRequirements(), new LocalesRequirements(), - new OpcodeCacheRequirement(), new PhpRequirements(), new SystemRequirements(), ]; diff --git a/lib/Alchemy/Phrasea/Core/Provider/CacheServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/CacheServiceProvider.php index e820128174..df7cdc3a6f 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/CacheServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/CacheServiceProvider.php @@ -49,9 +49,9 @@ class CacheServiceProvider implements ServiceProviderInterface }); $app['opcode-cache'] = $app->share(function (Application $app) { - $conf = $app['conf']->get(['main', 'opcodecache']); - - return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']); + /** @var CacheManager $service */ + $service = $app['phraseanet.cache-service']; + return $service->factory('opcode-cache', 'ArrayCache', []); }); } diff --git a/lib/Alchemy/Phrasea/Setup/ConfigurationTester.php b/lib/Alchemy/Phrasea/Setup/ConfigurationTester.php index 9a2d80ef04..afd7d09ca2 100644 --- a/lib/Alchemy/Phrasea/Setup/ConfigurationTester.php +++ b/lib/Alchemy/Phrasea/Setup/ConfigurationTester.php @@ -21,7 +21,6 @@ use Alchemy\Phrasea\Setup\Probe\CacheServerProbe; use Alchemy\Phrasea\Setup\Probe\DataboxStructureProbe; use Alchemy\Phrasea\Setup\Probe\FilesystemProbe; use Alchemy\Phrasea\Setup\Probe\LocalesProbe; -use Alchemy\Phrasea\Setup\Probe\OpcodeCacheProbe; use Alchemy\Phrasea\Setup\Probe\PhpProbe; use Alchemy\Phrasea\Setup\Probe\SearchEngineProbe; use Alchemy\Phrasea\Setup\Probe\SubdefsPathsProbe; @@ -55,7 +54,6 @@ class ConfigurationTester BinariesProbe::create($this->app), CacheServerProbe::create($this->app), DataboxStructureProbe::create($this->app), - OpcodeCacheProbe::create($this->app), FilesystemProbe::create($this->app), LocalesProbe::create($this->app), PhpProbe::create($this->app), @@ -75,7 +73,7 @@ class ConfigurationTester /** * Return true if got the latest configuration file. * - * @return type + * @return bool */ public function isInstalled() { @@ -125,7 +123,7 @@ class ConfigurationTester /** * Returns true if a major migration script can be executed * - * @return type + * @return bool */ public function isMigrable() { diff --git a/lib/Alchemy/Phrasea/Setup/Probe/OpcodeCacheProbe.php b/lib/Alchemy/Phrasea/Setup/Probe/OpcodeCacheProbe.php deleted file mode 100644 index 5b269acadb..0000000000 --- a/lib/Alchemy/Phrasea/Setup/Probe/OpcodeCacheProbe.php +++ /dev/null @@ -1,48 +0,0 @@ -addInformation('Current implementation', get_class($cache)); - - $this->addRecommendation( - 'Alchemy\Phrasea\Cache\ArrayCache' !== get_class($cache), - 'ArrayCache should not be used in production', - 'Configure an Opcode Cache' - ); - - if (null !== $cache->getStats()) { - foreach ($cache->getStats() as $name => $value) { - $this->addInformation($name, $value); - } - } - } - - /** - * {@inheritdoc} - * - * @return OpcodeCacheProbe - */ - public static function create(Application $app) - { - return new static($app['opcode-cache']); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/Requirements/OpcodeCacheRequirement.php b/lib/Alchemy/Phrasea/Setup/Requirements/OpcodeCacheRequirement.php deleted file mode 100644 index cf1b4b8bd8..0000000000 --- a/lib/Alchemy/Phrasea/Setup/Requirements/OpcodeCacheRequirement.php +++ /dev/null @@ -1,32 +0,0 @@ -setName('Opcode Cache'); - - if (version_compare(phpversion(), '5.5.0', '>=')) { - return; - } - - $this->addRecommendation( - extension_loaded('apc') || class_exists('xcache') || class_exists('wincache'), - 'A cache opcode extension such as apc, xcache or wincache is recommended', - 'Install and enable an opcode cache extension.' - ); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/Version/Migration/Migration38.php b/lib/Alchemy/Phrasea/Setup/Version/Migration/Migration38.php index fda45795cb..d1b459d45a 100644 --- a/lib/Alchemy/Phrasea/Setup/Version/Migration/Migration38.php +++ b/lib/Alchemy/Phrasea/Setup/Version/Migration/Migration38.php @@ -93,21 +93,12 @@ class Migration38 implements MigrationInterface if (isset($data[$env])) { $conf['main']['servername'] = $data[$env]['phraseanet']['servername']; $conf['main']['maintenance'] = $data[$env]['phraseanet']['maintenance']; - $opcodeCacheService = $data[$env]['opcodecache']; $cacheService = $data[$env]['cache']; } } if (is_file($this->servicesYaml)) { $services = $this->yaml->parse($this->servicesYaml); - if (null !== $opcodeCacheService) { - $conf['main']['opcodecache']['type'] = str_replace('Cache\\', '', $services['Cache'][$opcodeCacheService]['type']); - if (isset($services['Cache'][$opcodeCacheService]['options'])) { - $conf['main']['opcodecache']['options'] = $services['Cache'][$opcodeCacheService]['options']; - } else { - $conf['main']['opcodecache']['options'] = []; - } - } if (null !== $cacheService) { $conf['main']['cache']['type'] = str_replace('Cache\\', '', $services['Cache'][$cacheService]['type']); if (isset($services['Cache'][$cacheService]['options'])) { diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml index d77d2ae63b..8b5a71caa6 100644 --- a/lib/conf.d/configuration.yml +++ b/lib/conf.d/configuration.yml @@ -22,9 +22,6 @@ main: options: host: localhost port: 11211 - opcodecache: - type: ArrayCache - options: [] search-engine: type: elasticsearch # type: phrasea diff --git a/resources/vagrant/config/phraseanet/configuration.yml b/resources/vagrant/config/phraseanet/configuration.yml index 12f2f36761..3237c114e2 100644 --- a/resources/vagrant/config/phraseanet/configuration.yml +++ b/resources/vagrant/config/phraseanet/configuration.yml @@ -20,9 +20,6 @@ main: cache: type: ArrayCache options: [] - opcodecache: - type: ArrayCache - options: [] search-engine: type: elasticsearch options: [] diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml index d77d2ae63b..8b5a71caa6 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml @@ -22,9 +22,6 @@ main: options: host: localhost port: 11211 - opcodecache: - type: ArrayCache - options: [] search-engine: type: elasticsearch # type: phrasea diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-with-hosts.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-with-hosts.yml index 6b1f111985..1c472c2551 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-with-hosts.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-with-hosts.yml @@ -32,9 +32,6 @@ main: options: host: localhost port: 11211 - opcodecache: - type: ArrayCache - options: [] task-manager: status: started enabled: true diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml index d77d2ae63b..8b5a71caa6 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml @@ -22,9 +22,6 @@ main: options: host: localhost port: 11211 - opcodecache: - type: ArrayCache - options: [] search-engine: type: elasticsearch # type: phrasea diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml index 21655f252f..1dd38fcd86 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml @@ -19,9 +19,6 @@ main: options: host: localhost port: 11211 - opcodecache: - type: ArrayCache - options: { } task-manager: options: '' trusted-proxies: { } diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml index ae2b503e25..78a301a569 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml @@ -19,9 +19,6 @@ main: options: host: localhost port: 11211 - opcodecache: - type: ArrayCache - options: { } task-manager: options: '' trusted-proxies: { } diff --git a/tests/Alchemy/Tests/Phrasea/Setup/Probe/OpcodeCacheProbeTest.php b/tests/Alchemy/Tests/Phrasea/Setup/Probe/OpcodeCacheProbeTest.php deleted file mode 100644 index 3868b00892..0000000000 --- a/tests/Alchemy/Tests/Phrasea/Setup/Probe/OpcodeCacheProbeTest.php +++ /dev/null @@ -1,11 +0,0 @@ - 21211, ] ]; - $modified['main']['opcodecache'] = [ - 'type' => 'ApcCache', - 'options' => [], - ]; $modified['border-manager']['enabled'] = false; return $modified;