Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/239151
Change subject: Read board content from master db
......................................................................
Read board content from master db
createWorkflowLoader would create a new workflow because it
couldn't find the existing workflow (since it read from slaves)
The result was a different workflow id than the header we're
looking to modify, so the whole thing blew up.
Bug: T112784
Change-Id: I0e65385d2d470ce1170924ec66e51df454fc841f
---
M includes/Import/OptInController.php
1 file changed, 15 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/51/239151/1
diff --git a/includes/Import/OptInController.php
b/includes/Import/OptInController.php
index 465e6f8..7168116 100644
--- a/includes/Import/OptInController.php
+++ b/includes/Import/OptInController.php
@@ -6,11 +6,12 @@
use DateTimeZone;
use DerivativeContext;
use Flow\Collection\HeaderCollection;
+use Flow\Content\BoardContent;
+use Flow\Exception\InvalidDataException;
use Flow\NotificationController;
use Flow\OccupationController;
use Flow\Parsoid\Utils;
use Flow\RevisionActionPermissions;
-use Flow\WorkflowLoader;
use Flow\WorkflowLoaderFactory;
use IContextSource;
use MovePage;
@@ -396,13 +397,20 @@
* @throws \Flow\Exception\InvalidDataException
*/
private function editBoardDescription( Title $title, callable
$newDescriptionCallback, $format = 'html' ) {
- /** @var WorkflowLoaderFactory $loader */
- $factory = Container::get( 'factory.loader.workflow' );
+ /*
+ * We could use WorkflowLoaderFactory::createWorkflowLoader
+ * to get to the workflow ID, but that uses WikiPage::factory
+ * to build the wikipage & get the content. For most requests,
+ * that'll be better (it reads from slaves), but we really
+ * need to read from master here.
+ */
+ $page = WikiPage::newFromID( $title->getArticleID(),
WikiPage::READ_LATEST );
+ $content = $page->getContent();
+ if ( !$content instanceof BoardContent ) {
+ throw new InvalidDataException( 'Could not find board
page for ' . $title->getPrefixedDBkey() );
+ }
- /** @var WorkflowLoader $loader */
- $loader = $factory->createWorkflowLoader( $title );
-
- $collection = HeaderCollection::newFromId(
$loader->getWorkflow()->getId() );
+ $collection = HeaderCollection::newFromId(
$content->getWorkflowId() );
$revision = $collection->getLastRevision();
$content = $revision->getContent();
--
To view, visit https://gerrit.wikimedia.org/r/239151
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e65385d2d470ce1170924ec66e51df454fc841f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits