Matthias Mullie has submitted this change and it was merged.

Change subject: Bug: action=purge doesnt purge the topic list sorted by last 
update
......................................................................


Bug: action=purge doesnt purge the topic list sorted by last update

Change-Id: Ib58850b708204ec63ffce484dbb26ecad6d000c1
---
M includes/Actions/PurgeAction.php
1 file changed, 22 insertions(+), 4 deletions(-)

Approvals:
  Matthias Mullie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Actions/PurgeAction.php b/includes/Actions/PurgeAction.php
index ac4899d..c010595 100644
--- a/includes/Actions/PurgeAction.php
+++ b/includes/Actions/PurgeAction.php
@@ -78,18 +78,36 @@
         * @param Workflow $workflow
         */
        protected function fetchDiscussion( Workflow $workflow ) {
+               $results = array();
+               $pagers = array();
                /** @var ManagerGroup $storage */
                $storage = Container::get( 'storage' );
-               $pager = new Pager(
+
+               // 'newest' sort order
+               $pagers[] = new Pager(
                        $storage->getStorage( 'TopicListEntry' ),
                        array( 'topic_list_id' => $workflow->getId() ),
                        array( 'pager-limit' => 499 )
                );
 
-               $results = array();
-               foreach ( $pager->getPage()->getResults() as $entry ) {
-                       $results[] = $entry->getId();
+               // 'updated' sort order
+               $pagers[] = new Pager(
+                       $storage->getStorage( 'TopicListEntry' ),
+                       array( 'topic_list_id' => $workflow->getId() ),
+                       array(
+                               'pager-limit' => 499,
+                               'sort' => 'workflow_last_update_timestamp',
+                               'order' => 'desc',
+                       )
+               );
+
+               foreach ( $pagers as $pager ) {
+                       foreach ( $pager->getPage()->getResults() as $entry ) {
+                               // use array key to de-duplicate
+                               $results[$entry->getId()->getAlphadecimal()] = 
$entry->getId();
+                       }
                }
+
                $this->fetchTopics( $results );
 
                // purge the board history

-- 
To view, visit https://gerrit.wikimedia.org/r/174901
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib58850b708204ec63ffce484dbb26ecad6d000c1
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to