133 lines
5.8 KiB
PHP
133 lines
5.8 KiB
PHP
<?php
|
|
/**
|
|
* Redis Cache
|
|
* Version: 2.1.1
|
|
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
|
|
* https://teamwant.pl
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Open Software License (OSL 3.0)
|
|
* that is bundled with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* http://opensource.org/licenses/osl-3.0.php
|
|
*
|
|
* @author Teamwant <kontakt@teamwant.pl>
|
|
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
|
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
|
* @category Teamwant
|
|
* @package Teamwant
|
|
*/
|
|
|
|
class AdminPerformanceController extends AdminPerformanceControllerCore
|
|
{
|
|
|
|
public function initFieldsetCaching()
|
|
{
|
|
$phpdoc_langs = array('en', 'zh', 'fr', 'de', 'ja', 'pl', 'ro', 'ru', 'fa', 'es', 'tr');
|
|
$php_lang = in_array($this->context->language->iso_code, $phpdoc_langs) ? $this->context->language->iso_code : 'en';
|
|
|
|
$warning_memcache = $this->trans('(you must install the [a]Memcache PECL extension[/a])', array(
|
|
'[a]' => '<a href="http://www.php.net/manual/'.\Tools::substr($php_lang, 0, 2).'/memcache.installation.php" target="_blank">',
|
|
'[/a]' => '</a>',
|
|
),
|
|
'Admin.Advparameters.Notification'
|
|
);
|
|
|
|
$warning_memcached = $this->trans('(you must install the [a]Memcached PECL extension[/a])', array(
|
|
'[a]' => '<a href="http://www.php.net/manual/'.\Tools::substr($php_lang, 0, 2).'/memcached.installation.php" target="_blank">',
|
|
'[/a]' => '</a>',
|
|
),
|
|
'Admin.Advparameters.Notification'
|
|
);
|
|
|
|
$warning_apc = $this->trans('(you must install the [a]APC PECL extension[/a])', array(
|
|
'[a]' => '<a href="http://php.net/manual/'.\Tools::substr($php_lang, 0, 2).'/apc.installation.php" target="_blank">',
|
|
'[/a]' => '</a>',
|
|
),
|
|
'Admin.Advparameters.Notification'
|
|
);
|
|
|
|
$warning_xcache = $this->trans('(you must install the [a]Xcache extension[/a])', array(
|
|
'[a]' => '<a href="http://xcache.lighttpd.net" target="_blank">',
|
|
'[/a]' => '</a>',
|
|
),
|
|
'Admin.Advparameters.Notification'
|
|
);
|
|
|
|
$this->fields_form[6]['form'] = array(
|
|
'legend' => array(
|
|
'title' => $this->trans('Caching', array(), 'Admin.Advparameters.Feature'),
|
|
'icon' => 'icon-desktop'
|
|
),
|
|
'input' => array(
|
|
array(
|
|
'type' => 'hidden',
|
|
'name' => 'cache_up'
|
|
),
|
|
array(
|
|
'type' => 'switch',
|
|
'label' => $this->trans('Use cache', array(), 'Admin.Advparameters.Feature'),
|
|
'name' => 'cache_active',
|
|
'is_bool' => true,
|
|
'values' => array(
|
|
array(
|
|
'id' => 'cache_active_on',
|
|
'value' => 1,
|
|
'label' => $this->trans('Enabled', array(), 'Admin.Global')
|
|
),
|
|
array(
|
|
'id' => 'cache_active_off',
|
|
'value' => 0,
|
|
'label' => $this->trans('Disabled', array(), 'Admin.Global')
|
|
)
|
|
)
|
|
),
|
|
array(
|
|
'type' => 'radio',
|
|
'label' => $this->trans('Caching system', array(), 'Admin.Advparameters.Feature'),
|
|
'name' => 'caching_system',
|
|
'values' => array(
|
|
array(
|
|
'id' => 'CacheMemcache',
|
|
'value' => 'CacheMemcache',
|
|
'label' => $this->trans('Memcached via PHP::Memcache', array(), 'Admin.Advparameters.Feature').(extension_loaded('memcache') ? '' : $warning_memcache)
|
|
),
|
|
array(
|
|
'id' => 'CacheMemcached',
|
|
'value' => 'CacheMemcached',
|
|
'label' => $this->trans('Memcached via PHP::Memcached', array(), 'Admin.Advparameters.Feature').(extension_loaded('memcached') ? '' : $warning_memcached)
|
|
),
|
|
array(
|
|
'id' => 'CacheApc',
|
|
'value' => 'CacheApc',
|
|
'label' => $this->trans('APC', array(), 'Admin.Advparameters.Feature').((extension_loaded('apc') || extension_loaded('apcu'))? '' : $warning_apc)
|
|
),
|
|
array(
|
|
'id' => 'CacheXcache',
|
|
'value' => 'CacheXcache',
|
|
'label' => $this->trans('Xcache', array(), 'Admin.Advparameters.Feature').(extension_loaded('xcache') ? '' : $warning_xcache)
|
|
),
|
|
array(
|
|
'id' => 'CacheRedis',
|
|
'value' => 'Redis',
|
|
'label' => $this->trans('Redis', array(), '')
|
|
),
|
|
|
|
)
|
|
),
|
|
),
|
|
'submit' => array(
|
|
'title' => $this->trans('Save', array(), 'Admin.Actions')
|
|
),
|
|
'memcachedServers' => true
|
|
);
|
|
|
|
$this->fields_value['cache_active'] = _PS_CACHE_ENABLED_;
|
|
$this->fields_value['caching_system'] = _PS_CACHING_SYSTEM_;
|
|
|
|
$this->tpl_form_vars['servers'] = CacheMemcache::getMemcachedServers();
|
|
$this->tpl_form_vars['_PS_CACHE_ENABLED_'] = _PS_CACHE_ENABLED_;
|
|
}
|
|
}
|