diff --git a/src/database/seeders/CcpSdeSeeder.php b/src/database/seeders/CcpSdeSeeder.php index 11f57c5e..0d991967 100644 --- a/src/database/seeders/CcpSdeSeeder.php +++ b/src/database/seeders/CcpSdeSeeder.php @@ -48,7 +48,7 @@ class CcpSdeSeeder extends Seeder /** * @var string */ - private const VERSION = '3118350'; + private $version = '3118350'; /** * The SDE file storage path. @@ -86,8 +86,10 @@ public function run() if (! $this->isStorageOk()) throw new DirectoryNotFoundException('Storage path is not OK. Please check permissions.'); - $this->command->info('Authorised Version Found as: ' . self::VERSION); + $this->command->info('Getting latest SDE Version'); + $this->getLatestSdeVersion(); + $this->command->info('Authorised Version Found as: ' . $this->version); $this->command->info('Downloading static files...'); $this->downloadStaticFiles(); @@ -96,14 +98,14 @@ public function run() $this->call($this->seeders); } + /** * Download the EVE Sde from Fuzzwork and save it * in the storage_path/sde folder. */ private function downloadStaticFiles() { - - $sde = sprintf('eve-online-static-data-%d-jsonl.zip', self::VERSION); + $sde = sprintf('eve-online-static-data-%d-jsonl.zip', $this->version); $url = sprintf('https://developers.eveonline.com/static-data/tranquility/%s', $sde); $destination = $this->storage_path . $sde; @@ -122,6 +124,24 @@ private function downloadStaticFiles() } } + private function getLatestSdeVersion() + { + $result = Http::get('https://developers.eveonline.com/static-data/tranquility/latest.jsonl'); + // fallback to const version + if(!$result->successful()){ + $this->command->info('Unable to get latest version, using version: '. $this->version); + return; + } + $firstLine = strtok($result->body(), "\n"); + $data = json_decode($firstLine, true); + if(!$data['buildNumber']){ + this->command->info('Unable to get latest build version from response. using version: '. $this->version); + return; + } + + $this->version = $data['buildNumber']; + } + private function extractZipWithProgress(string $zipPath, string $destination): void { $zip = new \ZipArchive; diff --git a/src/database/seeders/Sde/Ccp/InvTypesSeeder.php b/src/database/seeders/Sde/Ccp/InvTypesSeeder.php index ab8b6a64..faa9d004 100644 --- a/src/database/seeders/Sde/Ccp/InvTypesSeeder.php +++ b/src/database/seeders/Sde/Ccp/InvTypesSeeder.php @@ -43,7 +43,7 @@ protected function getSdeTableDefinition(Blueprint $table): void { $table->integer('typeID')->primary(); $table->integer('groupID'); - $table->string('typeName', 100); + $table->string('typeName', 150); $table->text('description')->nullable(); $table->double('mass')->nullable(); $table->double('volume')->nullable();