updates for active directory now with docs
tests / ci (push) Canceled after 0s

This commit is contained in:
Mark Gregory
2026-11-11 17:15:37 +00:00
parent 4ebcd12565
commit 90f8655595
7 changed files with 433 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Throwable;
class DirectorySyncHistory
{
/** @param array<string, int>|null $counts */
public function record(string $id, string $status, bool $dryRun, bool $deactivateMissing, int $duration, ?array $counts = null, ?string $failure = null): void
{
try {
DB::table('ad_sync_runs')->insert([
'id' => $id,
'status' => $status,
'dry_run' => $dryRun,
'deactivate_missing' => $deactivateMissing,
'duration_ms' => $duration,
'counts' => $counts === null ? null : json_encode($counts, JSON_THROW_ON_ERROR),
'failure' => $failure,
'finished_at' => now(),
]);
} catch (Throwable $exception) {
Log::warning('Active Directory sync history could not be saved.', [
'run_id' => $id,
'exception_type' => $exception::class,
]);
}
}
}