Files
citrus-cms/resources/views/admin-ajax/update-summary-cache.blade.php
T
2026-04-28 21:15:09 +03:00

43 lines
1.3 KiB
PHP

<?php
// Summary Cache Update Endpoint
// Access: {base_url}/admin-ajax/update-summary-cache
use Illuminate\Support\Facades\Storage;
// Set higher memory and time limits
ini_set('memory_limit', '1024M');
set_time_limit(300);
echo "Starting summary cache update...<br>";
flush();
try {
// Render the summary-nocache view
$viewContent = view('admin.type.summary-nocache')->render();
// Ensure cache directory exists
if (!Storage::exists('cache')) {
Storage::makeDirectory('cache');
}
// Save to cache
Storage::put('cache/summary.blade.php', $viewContent);
// Save last update time
Storage::put('cache/summary_last_updated.txt', date('Y-m-d H:i:s'));
$fileSize = strlen($viewContent);
echo "✅ Cache updated successfully!<br>";
echo "File size: " . number_format($fileSize / 1024, 2) . " KB<br>";
echo "Last updated: " . date('Y-m-d H:i:s') . "<br>";
echo "<br><strong>JavaScript buttons will be added dynamically when the page loads.</strong><br>";
echo "<br><a href='/admin/types/summary'>View Summary Page</a>";
} catch (\Exception $e) {
echo "❌ Error updating cache: " . $e->getMessage() . "<br>";
echo "Memory used: " . number_format(memory_get_peak_usage() / 1024 / 1024, 2) . " MB<br>";
}
?>