jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/325730 )

Change subject: FlowFixInconsistentBoards: Don't output non-critical error info
......................................................................


FlowFixInconsistentBoards: Don't output non-critical error info

Only check $workflowByPageId if we're about to fix a board
with an inconsistent title.

If we're not even attempting a title fix, this hurts performance and
makes the output longer.

Bug: T148057
Change-Id: I42872d8784298936144c23c6801843a67b2b1bbd
---
M maintenance/FlowFixInconsistentBoards.php
1 file changed, 25 insertions(+), 18 deletions(-)

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



diff --git a/maintenance/FlowFixInconsistentBoards.php 
b/maintenance/FlowFixInconsistentBoards.php
index 08f6a8f..fe3468c 100644
--- a/maintenance/FlowFixInconsistentBoards.php
+++ b/maintenance/FlowFixInconsistentBoards.php
@@ -98,6 +98,10 @@
 
                $checkedCount = 0;
                $inconsistentCount = 0;
+
+               // Not all of $inconsistentCount are fixable by the current 
script.
+               $fixableInconsistentCount = 0;
+
                foreach ( $iterator as $rows ) {
                        foreach ( $rows as $row ) {
                                $checkedCount++;
@@ -121,22 +125,24 @@
                                        continue;
                                }
 
-                               $pageId = (int)$row->page_id;
-
-                               // Sanity check, or this will fail in BoardMover
-                               $workflowByPageId = $this->storage->find( 
'Workflow', array(
-                                       'workflow_wiki' => wfWikiID(),
-                                       'workflow_page_id' => $pageId,
-                               ) );
-
-                               if ( !$workflowByPageId ) {
-                                       $this->error( "ERROR: '$coreTitle' has 
page ID '$pageId', but no workflow is linked to this page ID" );
-                                       continue;
-                               }
-
                                if ( !$workflow->matchesTitle( $coreTitle ) ) {
+                                       $pageId = (int)$row->page_id;
+
                                        $workflowTitle = 
$workflow->getOwnerTitle();
                                        $this->output( "INCONSISTENT: Core 
title for '$workflowIdAlphadecimal' is '$coreTitle', but Flow title is 
'$workflowTitle'\n" );
+
+                                       $inconsistentCount++;
+
+                                       // Sanity check, or this will fail in 
BoardMover
+                                       $workflowByPageId = 
$this->storage->find( 'Workflow', array(
+                                                       'workflow_wiki' => 
wfWikiID(),
+                                                       'workflow_page_id' => 
$pageId,
+                                               ) );
+
+                                       if ( !$workflowByPageId ) {
+                                               $this->error( "ERROR: 
'$coreTitle' has page ID '$pageId', but no workflow is linked to this page ID" 
);
+                                               continue;
+                                       }
 
                                        if ( !$dryRun ) {
                                                $this->boardMover->move( 
$pageId, $coreTitle );
@@ -144,16 +150,17 @@
                                                $this->output( "FIXED: Updated 
'$workflowIdAlphadecimal' to match core title, '$coreTitle'\n" );
                                        }
 
-                                       $inconsistentCount++;
-                                       if ( $limit !== null && 
$inconsistentCount >= $limit ) {
+                                       $fixableInconsistentCount++;
+
+                                       if ( $limit !== null && 
$fixableInconsistentCount >= $limit ) {
                                                break;
                                        }
                                }
                        }
 
-                       $action = $dryRun ? 'Identified' : 'Fixed';
-                       $this->output( "Checked a total of $checkedCount Flow 
boards.  $action a total of $inconsistentCount inconsistent boards.\n" );
-                       if ( $limit !== null && $inconsistentCount >= $limit ) {
+                       $action = $dryRun ? 'identified as fixable' : 'fixed';
+                       $this->output( "\nChecked a total of $checkedCount Flow 
boards.  Of those, $inconsistentCount boards had an inconsistent title; 
$fixableInconsistentCount were $action.\n" );
+                       if ( $limit !== null && $fixableInconsistentCount >= 
$limit ) {
                                break;
                        }
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I42872d8784298936144c23c6801843a67b2b1bbd
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Catrope <r...@wikimedia.org>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to