Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/240367
Change subject: Try loading moved Flow board content differently
......................................................................
Try loading moved Flow board content differently
Actually, the original code should've been fine.
I couldn't really find a reason why the original code wouldn't
work. It should have the correct ids, read from master, ...
And still, it doesn't seem to work in some cases: it fails to
find the content we expect.
This is an alternative & simpler way to load the content.
Previous one was a lot more complex, with WikiPage caching a lot
of data, then create Revision from there, ...
Even if this doesn't fix the problem, tracking it down will be
slighty easier.
Change-Id: I3b8924f3d74d4ee938e3419233f52d7980dcb018
---
M includes/Content/BoardContentHandler.php
M includes/Import/OptInController.php
2 files changed, 13 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/67/240367/1
diff --git a/includes/Content/BoardContentHandler.php
b/includes/Content/BoardContentHandler.php
index 49faf0e..825dabe 100644
--- a/includes/Content/BoardContentHandler.php
+++ b/includes/Content/BoardContentHandler.php
@@ -62,7 +62,7 @@
* @param string $blob Serialized form of the content
* @param string $format The format used for serialization
*
- * @return Content The Content object created by deserializing $blob
+ * @return BoardContent The Content object created by deserializing
$blob
*/
public function unserializeContent( $blob, $format = null ) {
$info = FormatJson::decode( $blob, true );
diff --git a/includes/Import/OptInController.php
b/includes/Import/OptInController.php
index d979c70..97eb719 100644
--- a/includes/Import/OptInController.php
+++ b/includes/Import/OptInController.php
@@ -398,11 +398,20 @@
* need to read from master here.
* We'll need WorkflowLoader further down anyway, but we'll
* then have the correct workflow ID to initialize it with!
+ *
+ * $title->getLatestRevId() should be fine, it'll be read from
+ * LinkCache, which has been updated.
+ * Revision::newFromId will try slave first. If it can't find
+ * the id, it'll try to find it on master.
*/
- $page = WikiPage::newFromID( $title->getArticleID(),
WikiPage::READ_LATEST );
- $content = $page->getContent();
+ $revId = $title->getLatestRevID();
+ $revision = Revision::newFromId( $revId );
+ $content = $revision->getContent();
if ( !$content instanceof BoardContent ) {
- throw new InvalidDataException( 'Could not find board
page for ' . $title->getPrefixedDBkey() );
+ throw new InvalidDataException(
+ 'Could not find board page for ' .
$title->getPrefixedDBkey() . ' (id: ' . $title->getArticleID() . ').' .
+ 'Found content: ' . var_export( $content, true )
+ );
}
$workflowId = $content->getWorkflowId();
--
To view, visit https://gerrit.wikimedia.org/r/240367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b8924f3d74d4ee938e3419233f52d7980dcb018
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