Nik has uploaded a new change for review.
https://gerrit.wikimedia.org/r/134079
Change subject: Correctly parse 'redirect' XML tag during Special:Import.
......................................................................
Correctly parse 'redirect' XML tag during Special:Import.
Fixes bug 65481
Change-Id: Id9b3b7878b2e7b6fc7a06b163e5bac60e700490e
---
M includes/Import.php
1 file changed, 22 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/79/134079/1
diff --git a/includes/Import.php b/includes/Import.php
index 59fa583..2f32363 100644
--- a/includes/Import.php
+++ b/includes/Import.php
@@ -388,6 +388,15 @@
}
/**
+ * Retrieves the contents of the named attribute of the current element.
+ * @param string $attr the name of the attribute
+ * @return string the value of the attribute or an empty string if it
is not set in the current element.
+ */
+ public function nodeAttribute( $attr ) {
+ return $this->reader->getAttribute( $attr );
+ }
+
+ /**
* Shouldn't something like this be built-in to XMLReader?
* Fetches text contents of the current element, assuming
* no sub-elements or such scary things.
@@ -612,17 +621,21 @@
&$pageInfo ) ) ) {
// Do nothing
} elseif ( in_array( $tag, $normalFields ) ) {
- $pageInfo[$tag] = $this->nodeContents();
- if ( $tag == 'title' ) {
- $title = $this->processTitle(
$pageInfo['title'] );
+ if ( $tag == 'redirect' ) {
+ $pageInfo[$tag] = $this->nodeAttribute(
'title' );
+ } else {
+ $pageInfo[$tag] = $this->nodeContents();
+ if ( $tag == 'title' ) {
+ $title = $this->processTitle(
$pageInfo['title'] );
- if ( !$title ) {
- $badTitle = true;
- $skip = true;
+ if ( !$title ) {
+ $badTitle = true;
+ $skip = true;
+ }
+
+ $this->pageCallback( $title );
+ list( $pageInfo['_title'],
$origTitle ) = $title;
}
-
- $this->pageCallback( $title );
- list( $pageInfo['_title'], $origTitle )
= $title;
}
} elseif ( $tag == 'revision' ) {
$this->handleRevision( $pageInfo );
--
To view, visit https://gerrit.wikimedia.org/r/134079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9b3b7878b2e7b6fc7a06b163e5bac60e700490e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nik <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits