35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
||
// Summary View Cache Generator
|
||
// Bu cron görevi, summary blade viewını önbelleğe alır ve storage/app/cache/ dizinine kaydeder
|
||
|
||
use Illuminate\Support\Facades\Storage;
|
||
|
||
// Cache klasörünü oluştur (yoksa)
|
||
if (!Storage::exists('cache')) {
|
||
Storage::makeDirectory('cache');
|
||
}
|
||
|
||
// Önbelleğe alınacak view
|
||
$viewPath = 'admin.type.summary-nocache';
|
||
$cacheFileName = 'summary';
|
||
|
||
try {
|
||
// View içeriğini oluştur
|
||
$viewContent = view($viewPath)->render();
|
||
|
||
// Cache dosyasını kaydet
|
||
Storage::put("cache/{$cacheFileName}.blade.php", $viewContent);
|
||
|
||
// Son güncelleme zamanını kaydet
|
||
Storage::put("cache/{$cacheFileName}_last_updated.txt", date('Y-m-d H:i:s'));
|
||
|
||
echo "{$viewPath} önbelleği başarıyla güncellendi: " . date('Y-m-d H:i:s') . "<br>";
|
||
Artisan::call('cache:clear');
|
||
Artisan::call('config:clear');
|
||
Artisan::call('view:clear');
|
||
|
||
} catch (\Exception $e) {
|
||
echo "{$viewPath} önbelleği güncellenirken hata oluştu: " . $e->getMessage() . "<br>";
|
||
}
|
||
|
||
?>
|