Remove OpCache options as now bundled with PHP5.5+

This commit is contained in:
Benoît Burnichon
2015-04-14 17:07:11 +02:00
parent 0349db4adb
commit 31116a14a9
18 changed files with 5 additions and 152 deletions

View File

@@ -23,9 +23,6 @@ main:
options:
host: localhost
port: 11211
opcodecache:
type: ArrayCache
options: []
search-engine:
type: phrasea
options: []

View File

@@ -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),

View File

@@ -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(),
];

View File

@@ -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', []);
});
}

View File

@@ -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()
{

View File

@@ -1,48 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\Probe;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Setup\Requirements\OpcodeCacheRequirement;
use Alchemy\Phrasea\Cache\Cache;
class OpcodeCacheProbe extends OpcodeCacheRequirement implements ProbeInterface
{
public function __construct(Cache $cache)
{
parent::__construct();
$this->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']);
}
}

View File

@@ -1,32 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\Requirements;
use Alchemy\Phrasea\Setup\RequirementCollection;
class OpcodeCacheRequirement extends RequirementCollection implements RequirementInterface
{
public function __construct()
{
$this->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.'
);
}
}

View File

@@ -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'])) {

View File

@@ -22,9 +22,6 @@ main:
options:
host: localhost
port: 11211
opcodecache:
type: ArrayCache
options: []
search-engine:
type: elasticsearch
# type: phrasea

View File

@@ -20,9 +20,6 @@ main:
cache:
type: ArrayCache
options: []
opcodecache:
type: ArrayCache
options: []
search-engine:
type: elasticsearch
options: []

View File

@@ -22,9 +22,6 @@ main:
options:
host: localhost
port: 11211
opcodecache:
type: ArrayCache
options: []
search-engine:
type: elasticsearch
# type: phrasea

View File

@@ -32,9 +32,6 @@ main:
options:
host: localhost
port: 11211
opcodecache:
type: ArrayCache
options: []
task-manager:
status: started
enabled: true

View File

@@ -22,9 +22,6 @@ main:
options:
host: localhost
port: 11211
opcodecache:
type: ArrayCache
options: []
search-engine:
type: elasticsearch
# type: phrasea

View File

@@ -19,9 +19,6 @@ main:
options:
host: localhost
port: 11211
opcodecache:
type: ArrayCache
options: { }
task-manager:
options: ''
trusted-proxies: { }

View File

@@ -19,9 +19,6 @@ main:
options:
host: localhost
port: 11211
opcodecache:
type: ArrayCache
options: { }
task-manager:
options: ''
trusted-proxies: { }

View File

@@ -1,11 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Setup\Probe;
class OpcodeCacheProbeTest extends ProbeTestCase
{
protected function getClassName()
{
return 'Alchemy\Phrasea\Setup\Probe\OpcodeCacheProbe';
}
}

View File

@@ -1,13 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Setup\Requirements;
use Alchemy\Phrasea\Setup\Requirements\OpcodeCacheRequirement;
class OpcodeCacheRequirementTest extends RequirementsTestCase
{
protected function provideRequirements()
{
return new OpcodeCacheRequirement;
}
}

View File

@@ -72,10 +72,6 @@ class Migration38Test extends AbstractSetupTester
'port' => 21211,
]
];
$modified['main']['opcodecache'] = [
'type' => 'ApcCache',
'options' => [],
];
$modified['border-manager']['enabled'] = false;
return $modified;