[+] Classes: add support of APC cache

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9217 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-10-11 10:04:55 +00:00
parent 4d91a31031
commit 48d8dc379f
7 changed files with 152 additions and 43 deletions
+8 -3
View File
@@ -42,9 +42,11 @@ class AdminPerformance extends AdminTab
$this->_errors[] = Tools::displayError('Caching system is missing');
else
$settings = preg_replace('/define\(\'_PS_CACHING_SYSTEM_\', \'([a-z0-9=\/+-_]+)\'\);/Ui', 'define(\'_PS_CACHING_SYSTEM_\', \''.$caching_system.'\');', $settings);
if ($cache_active AND $caching_system == 'CacheMemcache' AND !extension_loaded('memcache'))
if ($cache_active && $caching_system == 'CacheMemcache' && !extension_loaded('memcache'))
$this->_errors[] = Tools::displayError('To use Memcached, you must install the Memcache PECL extension on your server.').' <a href="http://www.php.net/manual/en/memcache.installation.php">http://www.php.net/manual/en/memcache.installation.php</a>';
elseif ($cache_active AND $caching_system == 'CacheFs' AND !is_writable(_PS_CACHEFS_DIRECTORY_))
else if ($cache_active && $caching_system == 'CacheApc' && !extension_loaded('apc'))
$this->_errors[] = Tools::displayError('To use APC cache, you must install the APC PECL extension on your server.').' <a href="http://fr.php.net/manual/fr/apc.installation.php">http://fr.php.net/manual/fr/apc.installation.php</a>';
else if ($cache_active && $caching_system == 'CacheFs' && !is_writable(_PS_CACHEFS_DIRECTORY_))
$this->_errors[] = Tools::displayError('To use CacheFS the directory').' '.realpath(_PS_CACHEFS_DIRECTORY_).' '.Tools::displayError('must be writable');
if ($caching_system == 'CacheFs')
@@ -220,7 +222,9 @@ class AdminPerformance extends AdminTab
$warnings = array();
if (!extension_loaded('memcache'))
$warnings[] = $this->l('To use Memcached, you must install the Memcache PECL extension on your server.').' <a href="http://www.php.net/manual/en/memcache.installation.php">http://www.php.net/manual/en/memcache.installation.php</a>';
if(!is_writable(_PS_CACHEFS_DIRECTORY_))
if (!extension_loaded('apc'))
$warnings[] = $this->l('To use APC, you must install the APC PECL extension on your server.').' <a href="http://fr.php.net/manual/fr/apc.installation.php">http://fr.php.net/manual/fr/apc.installation.php</a>';
if (!is_writable(_PS_CACHEFS_DIRECTORY_))
$warnings[] = $this->l('To use CacheFS the directory').' '.realpath(_PS_CACHEFS_DIRECTORY_).' '.$this->l('must be writable');
if ($warnings)
@@ -442,6 +446,7 @@ class AdminPerformance extends AdminTab
<div class="margin-form">
<select name="caching_system" id="caching_system">
<option value="CacheMemcache" '.(_PS_CACHING_SYSTEM_ == 'CacheMemcache' ? 'selected="selected"' : '' ).'>'.$this->l('Memcached').'</option>
<option value="CacheApc" '.(_PS_CACHING_SYSTEM_ == 'CacheApc' ? 'selected="selected"' : '' ).'>'.$this->l('APC').'</option>
<option value="CacheFs" '.(_PS_CACHING_SYSTEM_ == 'CacheFs' ? 'selected="selected"' : '' ).'>'.$this->l('File System').'</option>
</select>
</div>