101 lines
3.1 KiB
PHP
101 lines
3.1 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
|
|
*/
|
|
|
|
namespace Teamwant\Prestashop17\Redis\Classes\Versions;
|
|
|
|
use Media;
|
|
use Teamwant\Prestashop17\Redis\Classes\TeamwantRedis;
|
|
use Teamwant\Prestashop17\Redis\Classes\TeamwantRedisCacheConfig;
|
|
use Teamwant_redis\OverrideSrc\OverrideHookFile;
|
|
use Teamwant_redis\OverrideSrc\OverrideSrcCachingType;
|
|
use Tools;
|
|
|
|
trait TeamwantRedisVersion
|
|
{
|
|
use TeamwantRedis;
|
|
use TeamwantRedisCacheConfig;
|
|
|
|
public function hookDisplayBackOfficeHeader()
|
|
{
|
|
// custom js variables
|
|
Media::addJsDef([
|
|
'token_AdminRedisConfiguration' => Tools::getAdminTokenLite('AdminRedisConfiguration'),
|
|
]);
|
|
|
|
$controller = Tools::getValue('controller', '');
|
|
if ($controller === 'AdminPerformance') {
|
|
//custom js variables
|
|
Media::addJsDef([
|
|
'tw_redis_lang_save_change_on_performance' => $this->l('Are you sure to save the changes? The redis configuration has not been saved.'),
|
|
'tw_redis_langs' => [
|
|
0 => $this->l('Are you sure?'),
|
|
],
|
|
]);
|
|
}
|
|
|
|
// custom js
|
|
$this->context->controller->addJs($this->_path . 'views/js/redis-admin1780.js');
|
|
|
|
// custom css (zostawiam wersje 1770)
|
|
$this->context->controller->addCSS($this->_path . 'views/css/redis-admin1770.css');
|
|
}
|
|
|
|
public function install()
|
|
{
|
|
$this->createCustomOverride($this->prestashopVersion);
|
|
|
|
//custom override presta files
|
|
load_Teamwant_redis_OverrideSrc();
|
|
|
|
$out = parent::install()
|
|
&& $this->registerHook('displayBackOfficeHeader')
|
|
&& $this->registerHook('actionClearCompileCache');
|
|
|
|
//custom override presta files
|
|
OverrideSrcCachingType::install();
|
|
$this->registerAdminControllers();
|
|
|
|
//tworzenie startowego pliku
|
|
$this->createDefaultConfigFile();
|
|
|
|
//from 1.6.2
|
|
OverrideHookFile::install();
|
|
|
|
return $out;
|
|
}
|
|
|
|
public function enable($force_all = false)
|
|
{
|
|
$this->createCustomOverride($this->prestashopVersion);
|
|
|
|
//custom override presta files
|
|
load_Teamwant_redis_OverrideSrc();
|
|
OverrideSrcCachingType::install();
|
|
$this->registerHook('displayBackOfficeHeader');
|
|
$this->registerHook('actionClearCompileCache');
|
|
$this->registerAdminControllers();
|
|
|
|
//from 1.6.2
|
|
OverrideHookFile::install();
|
|
return parent::enable($force_all);
|
|
}
|
|
}
|