jenkins-bot has submitted this change and it was merged.
Change subject: Make sure flow entries are created with correct content
......................................................................
Make sure flow entries are created with correct content
BoardContent objects will store a string of json that includes
the workflow id. However, when creating the board, the workflow
has not yet been stored (and the workflow can't be stored until
the page has been stored)
SubmissionHandler used to initialize BoardContent with null if
the workflow was new, which led to revision with invalid content
(the workflow id was not in there) so it wasn't possible to,
for example, delete the page.
Let's just create the board with the workflow id of the board
we're about to commit a couple of lines later. In the unlikely
event that goes wrong (validation has already occured at this
point), we can remove the page again, thus ensuring a page
can't exist without a workfow and vice versa.
Bug: T109768
Change-Id: I67e547c17b3b4660425e98f46a8e6292957666e1
---
M includes/SubmissionHandler.php
M includes/TalkpageManager.php
2 files changed, 10 insertions(+), 1 deletion(-)
Approvals:
Sbisson: Looks good to me, but someone else must approve
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/SubmissionHandler.php b/includes/SubmissionHandler.php
index 6631d6a..d83fbd7 100644
--- a/includes/SubmissionHandler.php
+++ b/includes/SubmissionHandler.php
@@ -132,6 +132,7 @@
$occupationController = Container::get( 'occupation_controller'
);
$title = $workflow->getOwnerTitle();
$occupationController->ensureFlowRevision( new \Article( $title
), $workflow );
+ $isNew = $workflow->isNew();
try {
$dbw->begin();
@@ -151,6 +152,14 @@
while( !$this->deferredQueue->isEmpty() ) {
$this->deferredQueue->dequeue();
}
+
+ if ( $isNew ) {
+ $article = new \Article( $title );
+ $page = $article->getPage();
+ $reason = '/* Failed to create Flow board */';
+ $page->doDeleteArticleReal( $reason, false, 0,
true, $errors, $occupationController->getTalkpageManager() );
+ }
+
$dbw->rollback();
$cache->rollback();
throw $e;
diff --git a/includes/TalkpageManager.php b/includes/TalkpageManager.php
index dfa61bb..f59669b 100644
--- a/includes/TalkpageManager.php
+++ b/includes/TalkpageManager.php
@@ -92,7 +92,7 @@
}
$status = $page->doEditContent(
- new BoardContent( CONTENT_MODEL_FLOW_BOARD,
$workflow->isNew() ? null : $workflow->getId() ),
+ new BoardContent( CONTENT_MODEL_FLOW_BOARD,
$workflow->getId() ),
wfMessage( 'flow-talk-taken-over-comment' )->plain(),
EDIT_FORCE_BOT | EDIT_SUPPRESS_RC,
false,
--
To view, visit https://gerrit.wikimedia.org/r/234515
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I67e547c17b3b4660425e98f46a8e6292957666e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Sbisson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits