Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/208636

Change subject: Fix more than just workflow_page_id === 0
......................................................................

Fix more than just workflow_page_id === 0

It's also possible that a board has been deleted & restored,
in which case the page id changed. Flow didn't always handle
this, so we also want the script to re-associate those.

We just have to make sure to only occupy the page if
workflow_page_id === 0: we don't want to create a new page if
it was deleted!

Bug: T97664
Change-Id: I165ba1e9cf57f8b0cbfd7ede19f30bf1e891ea43
---
M maintenance/FlowUpdateWorkflowPageId.php
1 file changed, 5 insertions(+), 3 deletions(-)


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

diff --git a/maintenance/FlowUpdateWorkflowPageId.php 
b/maintenance/FlowUpdateWorkflowPageId.php
index a4a61ac..982912c 100644
--- a/maintenance/FlowUpdateWorkflowPageId.php
+++ b/maintenance/FlowUpdateWorkflowPageId.php
@@ -42,7 +42,6 @@
                $it->setFetchColumns( array( '*' ) );
                $it->addConditions( array(
                        'workflow_wiki' => wfWikiId(),
-                       'workflow_page_id' => 0,
                ) );
 
                $gen = new WorkflowPageIdUpdateGenerator( $wgLang );
@@ -87,8 +86,10 @@
                        ) );
                }
 
-               // title doesn't exist, so create it
-               if ( $title->getArticleID() === 0 ) {
+               // at some point, we failed to create page entries for new 
workflows: only
+               // create that page if the workflow was stored with a 0 page id 
(otherwise,
+               // we could mistake the $title for a deleted page)
+               if ( $row->workflow_page_id === 0 && $title->getArticleID() === 
0 ) {
                        // build workflow object (yes, loading them piecemeal 
is suboptimal, but
                        // this is just a one-time script; considering the 
alternative is
                        // creating a derivative EchoBatchRowIterator that 
returns workflows,
@@ -111,6 +112,7 @@
                        }
                }
 
+               // re-associate the workflow with the correct page
                if ( $title->getArticleID() !== (int) $row->workflow_page_id ) {
                        // This makes the assumption the page has not moved or 
been deleted?
                        ++$this->fixedCount;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I165ba1e9cf57f8b0cbfd7ede19f30bf1e891ea43
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

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

Reply via email to