[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: FlowFixInconsistentBoards: Don't output non-critical error info

2016-12-09 Thread jenkins-bot (Code Review)
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;
}
  

[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: FlowFixInconsistentBoards: Don't output non-critical error info

2016-12-06 Thread Mattflaschen (Code Review)
Mattflaschen has uploaded a new change for review.

  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 output diagnostic info re $workflowByPageId if it prevents
us from fixing an inconsistent board.

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/30/325730/1

diff --git a/maintenance/FlowFixInconsistentBoards.php 
b/maintenance/FlowFixInconsistentBoards.php
index 08f6a8f..de3ebb8 100644
--- a/maintenance/FlowFixInconsistentBoards.php
+++ b/maintenance/FlowFixInconsistentBoards.php
@@ -121,24 +121,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 ) ) {
$workflowTitle = 
$workflow->getOwnerTitle();
$this->output( "INCONSISTENT: Core 
title for '$workflowIdAlphadecimal' is '$coreTitle', but Flow title is 
'$workflowTitle'\n" );
 
if ( !$dryRun ) {
+   $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;
+   }
+
$this->boardMover->move( 
$pageId, $coreTitle );
$this->boardMover->commit();
$this->output( "FIXED: Updated 
'$workflowIdAlphadecimal' to match core title, '$coreTitle'\n" );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42872d8784298936144c23c6801843a67b2b1bbd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen 

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