Skip to content

Commit

Permalink
Merge pull request #12 from utopia-php/improve-firebase-stability
Browse files Browse the repository at this point in the history
Fix pending counters
  • Loading branch information
TorstenDittmann authored Aug 17, 2023
2 parents 8a1d4de + b231a7c commit af4233f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Migration/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ public function getStatusCounters()
];
}

foreach ($this->cache->getAll() as $resources) {
foreach ($resources as $resource) {
/** @var resource $resource */
$status[$resource->getName()][$resource->getStatus()]++;
}
}

if ($this->source->previousReport) {
foreach ($this->source->previousReport as $resource => $data) {
if ($resource != 'size' && $resource != 'version' && isset($status[$resource])) {
Expand All @@ -103,6 +96,16 @@ public function getStatusCounters()
}
}

foreach ($this->cache->getAll() as $resources) {
foreach ($resources as $resource) {
/** @var resource $resource */
$status[$resource->getName()][$resource->getStatus()]++;
if ($status[$resource->getName()]['pending'] > 0) {
$status[$resource->getName()]['pending']--;
}
}
}

// Remove all empty resources
foreach ($status as $resource => $data) {
$allEmpty = true;
Expand Down

0 comments on commit af4233f

Please sign in to comment.