From ae55a905c4825858524ba8cf65aebec2c7bfdb00 Mon Sep 17 00:00:00 2001 From: Michael Karbowiak Date: Sun, 6 Oct 2024 02:57:51 +0200 Subject: [PATCH] There is no more force update.. --- app/Commands/Updates/UpdateAlliances.php | 10 +++++----- app/Commands/Updates/UpdateCharacters.php | 10 +++------- app/Commands/Updates/UpdateCorporations.php | 10 +++------- app/Jobs/UpdateAlliance.php | 4 ++-- app/Jobs/UpdateCharacter.php | 3 +-- app/Jobs/UpdateCorporation.php | 3 +-- 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/app/Commands/Updates/UpdateAlliances.php b/app/Commands/Updates/UpdateAlliances.php index 0707bf9..09d0533 100644 --- a/app/Commands/Updates/UpdateAlliances.php +++ b/app/Commands/Updates/UpdateAlliances.php @@ -10,7 +10,7 @@ class UpdateAlliances extends ConsoleCommand { - protected string $signature = 'update:alliances { allianceId? : Process a single allianceId } { --all } { --forceUpdate }'; + protected string $signature = 'update:alliances { allianceId? : Process a single allianceId } { --all } { --updateHistory }'; protected string $description = 'Update the alliances in the database'; public function __construct( @@ -36,10 +36,10 @@ final public function handle(): void protected function handleSingleAlliance(): void { $allianceId = $this->allianceId; - $forceUpdate = $this->forceUpdate ?? false; + $updateHistory = $this->updateHistory ?? false; $this->out("Updating alliance with ID: {$allianceId}"); - $this->esiData->getAllianceInfo($allianceId, $forceUpdate); + $this->esiData->getAllianceInfo($allianceId, $updateHistory); } /** @@ -50,13 +50,13 @@ protected function handleAllAlliances(): void $updatedCriteria = ['updated' => ['$lt' => new UTCDateTime(strtotime('-7 days') * 1000)]]; $allianceCount = $this->alliances->count($this->all ? [] : $updatedCriteria); $this->out('Alliances to update: ' . $allianceCount); - $forceUpdate = $this->forceUpdate ?? false; + $updateHistory = $this->updateHistory ?? false; $progress = $this->progressBar($allianceCount); $alliancesToUpdate = []; foreach ($this->alliances->find($this->all ? [] : $updatedCriteria) as $alliance) { - $alliancesToUpdate[] = ['alliance_id' => $alliance['alliance_id'], 'force_update' => $forceUpdate]; + $alliancesToUpdate[] = ['alliance_id' => $alliance['alliance_id'], 'update_history' => $updateHistory]; $progress->advance(); } diff --git a/app/Commands/Updates/UpdateCharacters.php b/app/Commands/Updates/UpdateCharacters.php index e98175b..c7df948 100644 --- a/app/Commands/Updates/UpdateCharacters.php +++ b/app/Commands/Updates/UpdateCharacters.php @@ -11,7 +11,7 @@ class UpdateCharacters extends ConsoleCommand { - protected string $signature = 'update:characters { characterId? : Process a single characterId } { --all } { --forceUpdate } { --updateHistory }'; + protected string $signature = 'update:characters { characterId? : Process a single characterId } { --all } { --updateHistory }'; protected string $description = 'Update the characters in the database (Default 30 days)'; public function __construct( @@ -38,11 +38,10 @@ final public function handle(): void protected function handleSingleCharacter(): void { $characterId = (int) $this->characterId; - $forceUpdate = $this->forceUpdate ?? false; $updateHistory = $this->updateHistory ?? false; $this->out("Updating character with ID: {$characterId}"); - $this->esiData->getCharacterInfo($characterId, $forceUpdate, $updateHistory); + $this->esiData->getCharacterInfo($characterId, $updateHistory); } /** @@ -53,8 +52,6 @@ protected function handleAllCharacters(): void $updatedCriteria = ['last_modified' => ['$lt' => new UTCDateTime(strtotime('-30 days') * 1000)]]; $characterCount = $this->characters->count($this->all ? [] : $updatedCriteria); $this->out('Characters to update: ' . $characterCount); - $forceUpdate = $this->forceUpdate ?? false; - $updateHistory = $this->updateHistory ?? false; $progress = $this->progressBar($characterCount); $charactersToUpdate = []; @@ -67,8 +64,7 @@ protected function handleAllCharacters(): void foreach ($cursor as $character) { $charactersToUpdate[] = [ - 'character_id' => $character['character_id'], - 'force_update' => $forceUpdate + 'character_id' => $character['character_id'] ]; if ($this->updateHistory) { diff --git a/app/Commands/Updates/UpdateCorporations.php b/app/Commands/Updates/UpdateCorporations.php index e8f4266..42ee27e 100644 --- a/app/Commands/Updates/UpdateCorporations.php +++ b/app/Commands/Updates/UpdateCorporations.php @@ -11,7 +11,7 @@ class UpdateCorporations extends ConsoleCommand { - protected string $signature = 'update:corporations { corporationId? : Process a single corporationId } { --all } { --forceUpdate } { --updateHistory }'; + protected string $signature = 'update:corporations { corporationId? : Process a single corporationId } { --all } { --updateHistory }'; protected string $description = 'Update the corporations in the database'; public function __construct( @@ -38,11 +38,10 @@ final public function handle(): void protected function handleSingleCorporation(): void { $corporationId = $this->corporationId; - $forceUpdate = $this->forceUpdate ?? false; $updateHistory = $this->updateHistory ?? false; $this->out("Updating corporation with ID: {$corporationId}"); - $this->esiData->getCorporationInfo($corporationId, $forceUpdate, $updateHistory); + $this->esiData->getCorporationInfo($corporationId, $updateHistory); } /** @@ -53,8 +52,6 @@ protected function handleAllCorporations(): void $updatedCriteria = ['updated' => ['$lt' => new UTCDateTime(strtotime('-7 days') * 1000)]]; $corporationCount = $this->corporations->count($this->all ? [] : $updatedCriteria); $this->out('Corporations to update: ' . $corporationCount); - $forceUpdate = $this->forceUpdate ?? false; - $updateHistory = $this->updateHistory ?? false; $progress = $this->progressBar($corporationCount); $corporationsToUpdate = []; $corporationsToUpdateHistory = []; @@ -66,8 +63,7 @@ protected function handleAllCorporations(): void foreach ($cursor as $corporation) { $corporationsToUpdate[] = [ - 'corporation_id' => $corporation['corporation_id'], - 'force_update' => $forceUpdate + 'corporation_id' => $corporation['corporation_id'] ]; if ($this->updateHistory) { diff --git a/app/Jobs/UpdateAlliance.php b/app/Jobs/UpdateAlliance.php index b77830e..fac935d 100644 --- a/app/Jobs/UpdateAlliance.php +++ b/app/Jobs/UpdateAlliance.php @@ -24,12 +24,12 @@ public function __construct( public function handle(array $data): void { $allianceId = $data["alliance_id"]; - $forceUpdate = $data["force_update"] ?? false; + $updateHistory = $data["update_history"] ?? false; if ($allianceId === 0) { return; } - $allianceData = $this->esiData->getAllianceInfo($allianceId, $forceUpdate); + $allianceData = $this->esiData->getAllianceInfo($allianceId, $updateHistory); $this->updateMeilisearch->enqueue([ 'id' => $allianceId, diff --git a/app/Jobs/UpdateCharacter.php b/app/Jobs/UpdateCharacter.php index 10a4039..6831c16 100644 --- a/app/Jobs/UpdateCharacter.php +++ b/app/Jobs/UpdateCharacter.php @@ -24,13 +24,12 @@ public function __construct( public function handle(array $data): void { $characterId = $data["character_id"]; - $forceUpdate = $data["force_update"] ?? false; $updateHistory = $data["update_history"] ?? false; if ($characterId === 0) { return; } - $characterData = $this->esiData->getCharacterInfo($characterId, $forceUpdate, $updateHistory); + $characterData = $this->esiData->getCharacterInfo($characterId, $updateHistory); $this->updateMeilisearch->enqueue([ 'id' => $characterId, diff --git a/app/Jobs/UpdateCorporation.php b/app/Jobs/UpdateCorporation.php index 3e6a8d0..e8509d3 100644 --- a/app/Jobs/UpdateCorporation.php +++ b/app/Jobs/UpdateCorporation.php @@ -24,13 +24,12 @@ public function __construct( public function handle(array $data): void { $corporationId = $data["corporation_id"]; - $forceUpdate = $data["force_update"] ?? false; $updateHistory = $data["update_history"] ?? false; if ($corporationId === 0) { return; } - $corporationData = $this->esiData->getCorporationInfo($corporationId, $forceUpdate, $updateHistory); + $corporationData = $this->esiData->getCorporationInfo($corporationId, $updateHistory); $this->updateMeilisearch->enqueue([ 'id' => $corporationId,