Skip to content

Commit

Permalink
fix(SFT-1649): purging old submission assets when empty string passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
seandelaney committed Dec 11, 2024
1 parent ee89d7f commit 7c07203
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public function removeSubmissionFiles(Event $event): void

if (\is_array($value)) {
foreach ($value as $id) {
\Craft::$app->elements->deleteElementById($id);
if (\is_int($id)) {
\Craft::$app->elements->deleteElementById($id);
}
}
}
}
Expand Down
12 changes: 7 additions & 5 deletions packages/plugin/src/Services/SubmissionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,13 @@ public function purgeSubmissions(?int $age = null): array

$assetIds = array_unique($assetIds);
foreach ($assetIds as $assetId) {
\Craft::$app->elements->deleteElementById(
$assetId,
hardDelete: true,
);
++$deletedAssets;
if (\is_int($assetId)) {
\Craft::$app->elements->deleteElementById(
$assetId,
hardDelete: true,
);
++$deletedAssets;
}
}
}

Expand Down

0 comments on commit 7c07203

Please sign in to comment.