Skip to content

Commit

Permalink
Merge pull request #12649 from jdalsem/finished-upgrade-sort
Browse files Browse the repository at this point in the history
feat(upgrades): completed upgrades are sorted by completion time
  • Loading branch information
jeabakker committed May 28, 2019
2 parents 09292ec + beebaec commit 62d65bd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion engine/classes/Elgg/UpgradeService.php
Expand Up @@ -14,6 +14,7 @@
use React\Promise\Promise;
use RuntimeException;
use Throwable;
use Elgg\Database\Clauses\EntitySortByClause;

/**
* Upgrade service for Elgg
Expand Down Expand Up @@ -489,7 +490,7 @@ public function getPendingUpgrades($async = true) {
}

/**
* Get completed (async) upgrades
* Get completed (async) upgrades ordered by recently completed first
*
* @param bool $async Include async upgrades
*
Expand All @@ -498,6 +499,11 @@ public function getPendingUpgrades($async = true) {
public function getCompletedUpgrades($async = true) {
$completed = [];

$order_by_completed_time = new EntitySortByClause();
$order_by_completed_time->direction = 'DESC';
$order_by_completed_time->property = 'completed_time';
$order_by_completed_time->property_type = 'private_setting';

$upgrades = elgg_get_entities([
'type' => 'object',
'subtype' => 'elgg_upgrade',
Expand All @@ -506,6 +512,7 @@ public function getCompletedUpgrades($async = true) {
'name' => 'is_completed',
'value' => true,
],
'order_by' => $order_by_completed_time,
'limit' => false,
'batch' => true,
]);
Expand Down

0 comments on commit 62d65bd

Please sign in to comment.