From 755aad8da6a88be10b79a18427ad9e23f8ab8939 Mon Sep 17 00:00:00 2001 From: Refringe Date: Thu, 3 Oct 2024 16:11:26 -0400 Subject: [PATCH 1/3] Hub Import Mod Removal Removes mods that are no longer on the hub. --- app/Jobs/ImportHubDataJob.php | 16 ++++++++++++++++ config/horizon.php | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Jobs/ImportHubDataJob.php b/app/Jobs/ImportHubDataJob.php index c429512..669a31b 100644 --- a/app/Jobs/ImportHubDataJob.php +++ b/app/Jobs/ImportHubDataJob.php @@ -51,6 +51,9 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue $this->importMods(); $this->importModVersions(); + // Remove mods that are no longer on the hub. + $this->removeDeletedMods(); + // Ensure that we've disconnected from the Hub database, clearing temporary tables. DB::connection('mysql_hub')->disconnect(); @@ -965,6 +968,19 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue }, 'versionID'); } + /** + * Remove mods that are no longer on the Hub. + */ + private function removeDeletedMods(): void + { + $mods = Mod::select('hub_id')->all(); + foreach ($mods as $mod) { + if (DB::connection('mysql_hub')->table('filebase1_file')->where('fileID', $mod->hub_id)->doesntExist()) { + $mod->delete(); + } + } + } + /** * The job failed to process. */ diff --git a/config/horizon.php b/config/horizon.php index b3a3771..f8cde95 100644 --- a/config/horizon.php +++ b/config/horizon.php @@ -207,7 +207,7 @@ return [ 'maxJobs' => 0, 'memory' => 256, 'tries' => 1, - 'timeout' => 1500, // 25 Minutes + 'timeout' => 2700, // 45 Minutes 'nice' => 0, ], ], From 82b137e816dd89676b7752819213371f0d7b7999 Mon Sep 17 00:00:00 2001 From: Refringe Date: Mon, 25 Nov 2024 16:35:22 -0500 Subject: [PATCH 2/3] Migrate workflows back to Github --- {.gitea => .github}/README.md | 0 .github/dependabot.yml | 40 +++++++++++++++++++++ {.gitea => .github}/logo.spt.png | Bin {.gitea => .github}/workflows/quality.yaml | 0 {.gitea => .github}/workflows/tests.yaml | 0 5 files changed, 40 insertions(+) rename {.gitea => .github}/README.md (100%) create mode 100644 .github/dependabot.yml rename {.gitea => .github}/logo.spt.png (100%) rename {.gitea => .github}/workflows/quality.yaml (100%) rename {.gitea => .github}/workflows/tests.yaml (100%) diff --git a/.gitea/README.md b/.github/README.md similarity index 100% rename from .gitea/README.md rename to .github/README.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4f8bc32 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,40 @@ +version: 2 +updates: + # Composer dependencies (PHP) + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" + time: "15:00" # 10am EST + open-pull-requests-limit: 10 + target-branch: "develop" + labels: + - "dependencies" + assignees: + - "Refringe" + + # GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + time: "15:00" # 10am EST + open-pull-requests-limit: 10 + target-branch: "develop" + labels: + - "dependencies" + assignees: + - "Refringe" + + # npm modules (JavaScript) + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" + time: "15:00" # 10am EST + open-pull-requests-limit: 10 + target-branch: "develop" + labels: + - "dependencies" + assignees: + - "Refringe" diff --git a/.gitea/logo.spt.png b/.github/logo.spt.png similarity index 100% rename from .gitea/logo.spt.png rename to .github/logo.spt.png diff --git a/.gitea/workflows/quality.yaml b/.github/workflows/quality.yaml similarity index 100% rename from .gitea/workflows/quality.yaml rename to .github/workflows/quality.yaml diff --git a/.gitea/workflows/tests.yaml b/.github/workflows/tests.yaml similarity index 100% rename from .gitea/workflows/tests.yaml rename to .github/workflows/tests.yaml From 294ae61e791b4d939c3d32b0c81090e316cabe1c Mon Sep 17 00:00:00 2001 From: Refringe Date: Mon, 25 Nov 2024 22:43:59 -0500 Subject: [PATCH 3/3] Removes deleted mods during import operation --- app/Jobs/Import/ImportHubDataJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/Import/ImportHubDataJob.php b/app/Jobs/Import/ImportHubDataJob.php index a29629c..676e05b 100644 --- a/app/Jobs/Import/ImportHubDataJob.php +++ b/app/Jobs/Import/ImportHubDataJob.php @@ -1084,7 +1084,7 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue */ private function removeDeletedMods(): void { - $mods = Mod::select('hub_id')->all(); + $mods = Mod::select('hub_id')->get(); foreach ($mods as $mod) { if (DB::connection('mysql_hub')->table('filebase1_file')->where('fileID', $mod->hub_id)->doesntExist()) { $mod->delete();