Mattflaschen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/209647
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
(cherry picked from commit 8d31605e885eccd299c4a415bc38d6a8028c83e5)
---
M maintenance/FlowUpdateWorkflowPageId.php
1 file changed, 6 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/47/209647/1
diff --git a/maintenance/FlowUpdateWorkflowPageId.php
b/maintenance/FlowUpdateWorkflowPageId.php
index a4a61ac..5872bd6 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,7 +112,8 @@
}
}
- if ( $title->getArticleID() !== (int) $row->workflow_page_id ) {
+ // re-associate the workflow with the correct page; only if a
page exists
+ if ( $title->getArticleID() !== 0 && $title->getArticleID() !==
(int) $row->workflow_page_id ) {
// This makes the assumption the page has not moved or
been deleted?
++$this->fixedCount;
return array(
--
To view, visit https://gerrit.wikimedia.org/r/209647
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: wmf/1.26wmf5
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits