f659c73ffa
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Blocked by required conditions
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Blocked by required conditions
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Blocked by required conditions
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Blocked by required conditions
Generic: Project CI / Tests (pull_request) Blocked by required conditions
Platform: moko-platform CI / Gate 4: Governance (push) Blocked by required conditions
Platform: moko-platform CI / Gate 5: Template Integrity (push) Blocked by required conditions
Platform: moko-platform CI / CI Summary (push) Blocked by required conditions
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (pull_request) Blocked by required conditions
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (pull_request) Blocked by required conditions
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (pull_request) Blocked by required conditions
Platform: moko-platform CI / Gate 3: Self-Health Check (pull_request) Blocked by required conditions
Platform: moko-platform CI / Gate 4: Governance (pull_request) Blocked by required conditions
Platform: moko-platform CI / Gate 5: Template Integrity (pull_request) Blocked by required conditions
Platform: moko-platform CI / CI Summary (pull_request) Blocked by required conditions
Universal: PR Check / Build RC Package (pull_request) Blocked by required conditions
Universal: PR Check / Report Issues (pull_request) Blocked by required conditions
Generic: Repo Health / Scripts governance (pull_request) Blocked by required conditions
Generic: Repo Health / Repository health (pull_request) Blocked by required conditions
Generic: Repo Health / Report Issues (pull_request) Blocked by required conditions
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Universal: PR Check / Validate PR (pull_request) Failing after 5s
Generic: Project CI / Lint & Validate (pull_request) Successful in 10s
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Successful in 7s
Generic: Repo Health / Access control (pull_request) Successful in 1s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: Auto Version Bump / Version Bump (push) Successful in 10s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 16s
Platform: moko-platform CI / Gate 1: Code Quality (push) Failing after 39s
Platform: moko-platform CI / Gate 1: Code Quality (pull_request) Failing after 37s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 36s
Task URLs corrected to display.clearCache/display.clearTemp format. Removed custom CSS in favor of inline Bootstrap utilities.
98 lines
3.3 KiB
PHP
98 lines
3.3 KiB
PHP
<?php
|
|
/**
|
|
* MokoSuiteClient Cache & Temp Cleaner — status bar split button
|
|
*
|
|
* Displays "Clear: Cache | Temp" as a single header item with two
|
|
* clickable halves. Uses native Atum header-item markup.
|
|
*/
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Session\Session;
|
|
|
|
$token = Session::getFormToken();
|
|
$cacheUrl = 'index.php?option=com_mokosuiteclient&task=display.clearCache&format=json';
|
|
$tempUrl = 'index.php?option=com_mokosuiteclient&task=display.clearTemp&format=json';
|
|
$domain = $domain ?? '';
|
|
?>
|
|
|
|
<div class="header-item-content d-flex align-items-center gap-2">
|
|
<?php if ($domain): ?>
|
|
<span style="font-family:monospace;font-size:0.75rem;cursor:pointer;" id="mokosuiteclient-domain" title="Support key — click to copy"><?php echo htmlspecialchars($domain); ?></span>
|
|
<span class="text-muted">|</span>
|
|
<?php endif; ?>
|
|
<a href="#" class="d-flex align-items-center gap-1 text-decoration-none" id="mokosuiteclient-clear-cache" title="Clear all Joomla cache" style="font-size:0.8rem;">
|
|
<span class="icon-bolt" aria-hidden="true" id="mokosuiteclient-cache-icon"></span> Cache
|
|
</a>
|
|
<span class="text-muted">|</span>
|
|
<a href="#" class="d-flex align-items-center gap-1 text-decoration-none" id="mokosuiteclient-clear-temp" title="Clear temp directory" style="font-size:0.8rem;">
|
|
<span class="icon-trash" aria-hidden="true" id="mokosuiteclient-temp-icon"></span> Temp
|
|
</a>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
function setupCleaner(btnId, iconId, url, token) {
|
|
var btn = document.getElementById(btnId);
|
|
var icon = document.getElementById(iconId);
|
|
if (!btn || !icon) return;
|
|
var origClass = icon.className;
|
|
|
|
btn.addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
if (btn.dataset.busy) return;
|
|
btn.dataset.busy = '1';
|
|
icon.className = 'icon-spinner icon-spin';
|
|
|
|
var formData = new FormData();
|
|
formData.append(token, '1');
|
|
|
|
fetch(url, {
|
|
method: 'POST',
|
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
|
body: formData
|
|
})
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
if (data.success) {
|
|
icon.className = 'icon-check';
|
|
icon.style.color = '#198754';
|
|
} else {
|
|
icon.className = 'icon-times';
|
|
icon.style.color = '#dc3545';
|
|
}
|
|
setTimeout(function() {
|
|
icon.className = origClass;
|
|
icon.style.color = '';
|
|
delete btn.dataset.busy;
|
|
}, 2000);
|
|
})
|
|
.catch(function() {
|
|
icon.className = 'icon-times';
|
|
icon.style.color = '#dc3545';
|
|
setTimeout(function() {
|
|
icon.className = origClass;
|
|
icon.style.color = '';
|
|
delete btn.dataset.busy;
|
|
}, 2000);
|
|
});
|
|
});
|
|
}
|
|
|
|
setupCleaner('mokosuiteclient-clear-cache', 'mokosuiteclient-cache-icon', '<?php echo $cacheUrl; ?>', '<?php echo $token; ?>');
|
|
setupCleaner('mokosuiteclient-clear-temp', 'mokosuiteclient-temp-icon', '<?php echo $tempUrl; ?>', '<?php echo $token; ?>');
|
|
|
|
// Click-to-copy domain
|
|
var domainEl = document.getElementById('mokosuiteclient-domain');
|
|
if (domainEl) {
|
|
domainEl.addEventListener('click', function() {
|
|
navigator.clipboard.writeText(domainEl.textContent.trim()).then(function() {
|
|
var orig = domainEl.textContent;
|
|
domainEl.textContent = 'Copied!';
|
|
setTimeout(function() { domainEl.textContent = orig; }, 1500);
|
|
});
|
|
});
|
|
}
|
|
});
|
|
</script>
|