refactor: move flush cache button to dedicated submenu page

- Removed cache button from branch settings page
- Added submenu page 'Сбросить кэш' under 'Настройки филиала'
- Same AJAX handler, cleaner dedicated page with big hero button
This commit is contained in:
Dekart Deploy Bot 2026-07-17 20:30:09 +00:00
parent c2125d7dcc
commit 7c17536c4f

View File

@ -1941,6 +1941,14 @@ function dekart_branch_add_menu() {
'dashicons-location-alt',
3.1
);
add_submenu_page(
'branch-settings',
'Сбросить кэш',
'🗄️ Сбросить кэш',
'manage_options',
'branch-cache-flush',
'dekart_flush_cache_page'
);
}
add_action( 'admin_init', 'dekart_branch_register_settings' );
@ -2301,17 +2309,22 @@ function dekart_branch_settings_page() {
<?php submit_button('Сохранить настройки филиала'); ?>
</form>
</div>
<?php
}
<hr style="max-width:800px;margin:30px 0;border:none;border-top:1px solid #c3c4c7">
<div style="max-width:800px">
<h2 style="margin-bottom:12px">🗄️ Кеширование</h2>
<p class="desc" style="margin-bottom:16px;color:#646970;font-size:12px">Сброс кеша полностью очищает объектный кеш (Memcached/Redis), инвалидирует versioned cache ключи и сбрасывает все буферы плагинов.</p>
<button type="button" id="dekart-flush-cache-btn" class="button button-secondary" style="display:inline-flex;align-items:center;gap:6px">
<span class="dashicons dashicons-update" style="font-size:16px;width:16px;height:16px"></span> Сбросить кэш
</button>
<span id="dekart-flush-cache-status" style="margin-left:12px;display:none"></span>
</div>
/**
* Страница: Сброс кеша (подменю Настройки филиала)
*/
function dekart_flush_cache_page() {
?>
<div class="wrap">
<h1>🗄️ Сброс кеша</h1>
<p class="desc" style="margin:16px 0;color:#646970;font-size:13px">Полная очистка объектного кеша (Memcached/Redis), инвалидация versioned cache ключей, сброс транзиентов.</p>
<button type="button" id="dekart-flush-cache-btn" class="button button-hero button-secondary" style="display:inline-flex;align-items:center;gap:8px">
<span class="dashicons dashicons-update" style="font-size:20px;width:20px;height:20px"></span> Сбросить кэш сейчас
</button>
<span id="dekart-flush-cache-status" style="margin-left:16px;display:none"></span>
<script>
(function() {
@ -2347,7 +2360,7 @@ function dekart_branch_settings_page() {
})
.finally(function() {
btn.disabled = false;
btn.innerHTML = '<span class="dashicons dashicons-update" style="font-size:16px;width:16px;height:16px"></span> Сбросить кэш';
btn.innerHTML = '<span class="dashicons dashicons-update" style="font-size:20px;width:20px;height:20px"></span> Сбросить кэш сейчас';
setTimeout(function() { status.style.display = 'none'; }, 5000);
});
});