public function clearRewriteCache() { $cache =
(int) $this->config->
offsetGet('routerCache'
);
$cache =
$cache < 360 ? 86400 :
$cache;
$builder =
$this->db->
createQueryBuilder();
$builder ->
from('s_core_config_values', 'v'
) ->
join('v', 's_core_config_elements', 'e', 'v.element_id = e.id'
) ->
select(['v.shop_id', 'v.value', 'e.id as element_id'
]) ->
where($builder->
expr()->
like('e.name',
$builder->
expr()->
literal('routerlastupdate'
)));
$values =
$builder->
execute()->
fetchAll(PDO::FETCH_ASSOC
);
$stmt =
$this->db->
prepare('UPDATE s_core_config_values SET value=? WHERE shop_id=? AND element_id=?'
);
foreach ($values as $rawValue) { $value =
unserialize($rawValue['value'
],
['allowed_classes' => false
]);
$value =
min(strtotime($value),
time() -
$cache);
$value =
date('Y-m-d H:i:s',
$value);
$value =
serialize($value);
$stmt->
execute([$value,
$rawValue['shop_id'
],
$rawValue['element_id'
]]);
} }