<?php
namespace Claromentis\Core\Cache;

$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"] ?: array()) + array("_db98357e662ee4057f89ee50" . "fd63a2c5" => base64_decode("Q2xlYXJpbmcgc2hhcmVkIGFzc2V0cyBjY" . "WNoZQ=="), "_4d707fa" . "b93bebb0" . "0bbe69e8" . "159697c9" . "0" => base64_decode(""), "_8fec21706bd243b37" . "ecf62b1caf8fb8a" => base64_decode("Y" . "2" . "x" . "p"), "_2ac6cb432a5df959efdffbcd288d07" . "45" => base64_decode("Q2xlYXJpbmcgdGVtcGxhd" . "GVyIGNhY2hl"), "_2935eb81473" . "a5cdf164ba52" . "dc31d305c" => base64_decode("Q2xlYXJpbmcgbWVtb3J" . "5IGNhY2hlcw=="), "_d904025" . "6bff96ad" . "2c221f79" . "439e0560" . "c" => base64_decode("Q2xlYXJpbmcgZGlyZWN0b3J5I" . "A=="), "_282505db60b6a60f1" . "a0c54a0f8c27092" => base64_decode("VEVNUEx" . "BVEVSX0" . "NBQ0hFX" . "0RJUg=="), "_3d13c2fddaab71a09e" . "eaf22607f1db0f" => base64_decode("Q2xlYXJpbmcgYWxsIHNoYXJlZCBjYWNoZXM" . "="), "_db7b295629faa1" . "6027a2c263095eb" . "a70" => base64_decode("cGhwX3NhcGlfbmF" . "tZQ=="), "_22ac6aae2762e0f310c495384c47" . "7dc8" => base64_decode("Lmdpd" . "GtlZX" . "A="), "_f02edf67" . "305f5d984" . "784e5a63a" . "cb5f0b" => base64_decode("U2tpcHBpbmcgY2xlYXJpbmcgbWVtb3J5IG" . "NhY2hlcyAocnVubmluZyBmcm9tIHRoZSBj" . "b21tYW5kIGxpbmUp"), "_8fd6da143a742433037d3" . "741c26c9f14" => base64_decode("Q2xlYXJpbmcgbG9jYWwgYXNzZXRzIGNhY2" . "hl"), "_8368ecd0" . "faa75c04b" . "4e54eac3b" . "d45d63" => base64_decode("Q2xlYXJpbmcgbG9jYWx" . "pemF0aW9uIGNhY2hl"), "_edd716f" . "0baedc24" . "27c121be" . "529bf222" . "d" => base64_decode("Q2xlYXJpbmcg" . "YWxsIGxvY2Fs" . "IGNhY2hlcw=="));
use ClaCache;
use Claromentis\Core\Assets\AssetsPathGenerator;
use Claromentis\Core\Config\Config;
use Claromentis\Core\Localization\LocalizationPathGenerator;
use Claromentis\Core\Util\FilesystemUtil;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;




class CacheClearer
{
    use LoggerAwareTrait;
    protected FilesystemUtil $filesystem_util;
    
    
    
    
    private $i18n_dir;
    
    
    
    
    private $assets_cache_dir;
    
    
    
    
    private $shared_assets_cache_dir;
    
    
    
    
    private $templater_cache_dir;
    
    
    
    
    private $cache_types;
    
    
    
    
    
    
    
    
    
    public function __construct(FilesystemUtil $_3e9dd802f6570205386040c44f4fa34c, AssetsPathGenerator $_d97d6167740e659d41e6072afead2dee, LocalizationPathGenerator $_d4919729bcd109cabacba2d3cebe6527, Config $config)
    {
        $this->filesystem_util = $_3e9dd802f6570205386040c44f4fa34c;
        $this->i18n_dir = $_d4919729bcd109cabacba2d3cebe6527->GetCacheRoot();
        $this->assets_cache_dir = $_d97d6167740e659d41e6072afead2dee->GetLocalCachePath();
        $this->shared_assets_cache_dir = $_d97d6167740e659d41e6072afead2dee->GetSharedCachePath();
        $this->cache_types = ClaCache::PRIMARY_CACHES;
        $this->templater_cache_dir = $config->get($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_282505db60b6a60f1a0c54a0f8c2709" . "2"]);
        $this->logger = new NullLogger();
    }
    
    
    
    
    public function Clear()
    {
        $this->Reset();
        $this->ResetShared();
    }
    
    
    
    
    public function Reset()
    {
        $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_edd716f0" . "baedc2427" . "c121be529" . "bf222d"]);
        if ($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_db7b295629fa" . "a16027a2c2630" . "95eba70"]() !== $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_8fec217" . "06bd243b" . "37ecf62b" . "1caf8fb8" . "a"]) {
            $this->ClearCla();
        } else {
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_f02edf6" . "7305f5d9" . "84784e5a" . "63acb5f0" . "b"]);
        }
        $this->ClearLocalization();
        $this->ClearTemplater();
        $this->ClearAssets();
    }
    public function ResetShared()
    {
        $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_3d13c2fddaab71a09eeaf22607f1db0" . "f"]);
        $this->ClearAssetsShared();
    }
    
    
    
    
    
    
    public function ClearLocalization()
    {
        $this->logger->info($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_8368ecd0faa75c04b" . "4e54eac3bd45d63"]);
        return $this->ClearDirectory($this->i18n_dir);
    }
    
    
    
    
    
    
    public function ClearAssets()
    {
        $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_8fd6da143a742433037d3741c" . "26c9f14"]);
        return $this->ClearDirectory($this->assets_cache_dir);
    }
    public function ClearAssetsShared()
    {
        $this->logger->info($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_db98357e662ee4057f89ee50fd63a2" . "c5"]);
        $this->ClearDirectory($this->shared_assets_cache_dir);
    }
    
    
    
    
    public function ClearCla()
    {
        $this->logger->info($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_2935eb81473a5" . "cdf164ba52dc31" . "d305c"]);
        foreach ($this->cache_types as $type) {
            ClaCache::I($type)->Clear($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_4d707fab93be" . "bb00bbe69e815" . "9697c90"]);
        }
        ClaCache::Clear($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_4d707fab93bebb00bbe69e81596" . "97c90"], true);
    }
    public function ClearTemplater()
    {
        $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_2ac6cb432a5df959efdffbcd2" . "88d0745"]);
        return $this->ClearDirectory($this->templater_cache_dir);
    }
    
    
    
    
    
    
    
    private function ClearDirectory($_c4f3321d131869e51a8844b6bcd8fb86)
    {
        $this->logger->debug($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_d9040256" . "bff96ad2c" . "221f79439" . "e0560c"] . $_c4f3321d131869e51a8844b6bcd8fb86);
        return $this->filesystem_util->DeleteDir($_c4f3321d131869e51a8844b6bcd8fb86, false, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_22ac6aae2762e0f310c4" . "95384c477dc8"]);
    }
}