Skip to content

Commit

Permalink
Merge pull request #571 from matomo-org/PG-4108-race-condition-handle
Browse files Browse the repository at this point in the history
Handles site deletion edge case, #PG-4108
  • Loading branch information
AltamashShaikh authored Jan 30, 2025
2 parents 25ab59d + dcfd907 commit bfb9dae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

# 5.1.1 - 2025-02-03
- Handled an edge case to delete the import if website is deleted

# 5.1.0 - 2025-01-20
- Added code to make GA4 imports work with a proxy
- Added missing license file
Expand Down
9 changes: 6 additions & 3 deletions Commands/ImportGA4Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ protected function executeImpl(): int
$gaClient = $googleAuth->getClient();
$gaAdminClient = $googleAuth->getAdminClient();
} catch (\Exception $ex) {
$output->writeln(LogToSingleFileProcessor::$cliOutputPrefix . "Cannot continue with import, client is misconfigured: " . $ex->getMessage());
if (!empty($idSite)) {
$importStatus->erroredImport($idSite, $ex->getMessage());
$errorMessage = $ex->getMessage();
$output->writeln(LogToSingleFileProcessor::$cliOutputPrefix . "Cannot continue with import, client is misconfigured: " . $errorMessage);
if ($idSite && stripos($errorMessage, 'an unexpected website was found in the request') !== false) {
$importStatus->deleteStatus($idSite);
} elseif (!empty($idSite)) {
$importStatus->erroredImport($idSite, $errorMessage);
}
return self::FAILURE;
}
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "GoogleAnalyticsImporter",
"description": "Import reports from a Google Analytics account into Matomo.",
"version": "5.1.0",
"version": "5.1.1",
"theme": false,
"require": {
"matomo": ">=5.0.0-rc5,<6.0.0-b1"
Expand Down

0 comments on commit bfb9dae

Please sign in to comment.