updates for active directory now with docs

This commit is contained in:
Mark Gregory
2026-11-12 08:01:31 +00:00
parent c0d6b821cb
commit 7166dd33f9
21 changed files with 252 additions and 246 deletions
@@ -0,0 +1,32 @@
<?php
namespace Modules\ActiveDirectory\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,
]);
}
}
}