ikinci temizlik tamamlandı
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
set_time_limit(-1);
|
||||
ini_set('max_execution_time', -1);
|
||||
$cronjobDocumentsPeriod = setting('cron_job_period');
|
||||
$oneMinuteAgo = Carbon::now()->subMinutes($cronjobDocumentsPeriod);
|
||||
$take = setting('cron_job_batch_process_count');
|
||||
$saat = date("H:i");
|
||||
|
||||
if(!getesit("type","")) {
|
||||
Cache::forget("cronjobDocuments");
|
||||
}
|
||||
|
||||
if(!getisset("type"))
|
||||
{
|
||||
exit();
|
||||
}
|
||||
if($saat == "00:00")
|
||||
{
|
||||
Cache::forget("cronjob");
|
||||
dump("forget cronjobDocuments");
|
||||
}
|
||||
|
||||
if(!Cache::has("cronjobDocuments")) {
|
||||
$start = new Carbon(simdi());
|
||||
|
||||
Cache::put("cronjobDocuments", simdi());
|
||||
|
||||
Log::debug("🟢📂 cron document start: " . simdi());
|
||||
|
||||
$allFiles = glob(base_path() . '/resources/views/cron-documents/*.blade.php');
|
||||
$total = count($allFiles);
|
||||
$count = 0;
|
||||
|
||||
try {
|
||||
?>
|
||||
@if(!getesit("type",""))
|
||||
@includeIf('cron-documents.' . get("type"))
|
||||
@else
|
||||
@foreach ($allFiles as $file)
|
||||
|
||||
<?php
|
||||
|
||||
$description = $file;
|
||||
$description = str_replace(".blade.php", "", $description);
|
||||
|
||||
Cache::put("cronjob_document_progress", [
|
||||
'total' => $total,
|
||||
'count' => $count,
|
||||
'progress' => round($count * 100 / $total),
|
||||
'description' => $description,
|
||||
'start' => simdi()
|
||||
|
||||
]);
|
||||
|
||||
$count++;
|
||||
?>
|
||||
|
||||
@include('cron-documents.' . basename(str_replace('.blade.php', '', $file)))
|
||||
@endforeach
|
||||
@endif
|
||||
<?php
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
dump($th);
|
||||
Log::error("cron documents");
|
||||
Log::error($th->getMessage());
|
||||
Cache::forget("cronjobDocuments");
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
$end = new Carbon(simdi());
|
||||
|
||||
Cache::put("cronjob_document_progress", [
|
||||
'total' => $total,
|
||||
'count' => $total,
|
||||
'progress' => 100,
|
||||
'description' => "finish " . simdi() . " " . $start->diff($end)->format('%H:%I:%S')
|
||||
|
||||
]);
|
||||
|
||||
Log::debug("🔴📂 cron document finish: " . simdi());
|
||||
Log::debug("⏰📂 süre: " . $start->diff($end)->format('%H:%I:%S'));
|
||||
Cache::forget("cronjobDocuments");
|
||||
|
||||
} else {
|
||||
dump("Çalışan bir cron var onun bitmesini bekliyorum");
|
||||
Log::debug("Çalışan bir cron documents var onun bitmesini bekliyorum");
|
||||
}
|
||||
Reference in New Issue
Block a user