jenkins-bot has submitted this change and it was merged.
Change subject: Allow subpage conversion under limited circumstances
......................................................................
Allow subpage conversion under limited circumstances
Adjusts the pre-checks done on the converter so that we
allow conversion of subpages if and only if they are
within a talk namespace and have a matching subject page.
Note that this will not work in combination with
$wgFlowOccupyNamespaces, as that explicitly does not take
over sub pages. It will work fine on wikis with
$wgContentHandlerUseDb set to true.
Fixes T76772
Bug: T76772
Change-Id: I3fe6be65fbdc4e81c11002e492d821412dd78d2e
---
M includes/Import/Converter.php
1 file changed, 15 insertions(+), 10 deletions(-)
Approvals:
Matthias Mullie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Import/Converter.php b/includes/Import/Converter.php
index 0fc16ea..38d5519 100644
--- a/includes/Import/Converter.php
+++ b/includes/Import/Converter.php
@@ -103,16 +103,8 @@
/** @var Title $title */
foreach ( $titles as $title ) {
try {
- if ( ! $this->isAllowed( $title ) ) {
- continue;
- }
-
- // Filter out sub pages unless we moved them
there. This
- // matches the behaviour of
$wgFlowOccupyNamespaces, where
- // the main pages get converted to Flow but the
sub pages
- // remain wikitext.
$movedFrom = $this->getPageMovedFrom( $title );
- if ( $movedFrom === null && $title->isSubpage()
) {
+ if ( ! $this->isAllowed( $title, $movedFrom ) )
{
continue;
}
@@ -129,7 +121,7 @@
}
}
- protected function isAllowed( Title $title ) {
+ protected function isAllowed( Title $title, Title $movedFrom = null ) {
// Only make changes to wikitext pages
if ( $title->getContentModel() !== CONTENT_MODEL_WIKITEXT ) {
return false;
@@ -141,6 +133,19 @@
return false;
}
+ // If we previously moved this page, continue the import
+ if ( $movedFrom !== null ) {
+ return true;
+ }
+
+ // Don't allow conversion of sub pages unless it is
+ // a talk page with matching subject page. For example
+ // we will convert User_talk:Foo/bar only if User:Foo/bar
+ // exists, and we will never convert User:Baz/bang.
+ if ( $title->isSubPage() && ( !$title->isTalkPage() ||
!$title->getSubjectPage()->exists() ) ) {
+ return false;
+ }
+
return true;
}
--
To view, visit https://gerrit.wikimedia.org/r/179337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3fe6be65fbdc4e81c11002e492d821412dd78d2e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits