Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/101814
Change subject: Store title as a job parameter
......................................................................
Store title as a job parameter
In some cases, a namespace on a target site will be an
interwiki prefix on the submission site. This, along with
bug 58524 will cause the namespace to be dropped, so the
job would use the wrong title.
We work around this by storing the real title as text in the job's
parameters. When the job is pulled from the queue on the target
site, the full title, as the user intended, will be evaluated in
the context of the target site.
Bug: 57464
Change-Id: Ie3ecb22001b4f9bc8d9b891cd096061da5151505
---
M MassMessageJob.php
M MassMessageSubmitJob.php
2 files changed, 5 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage
refs/changes/14/101814/1
diff --git a/MassMessageJob.php b/MassMessageJob.php
index 670bfac..3488c01 100644
--- a/MassMessageJob.php
+++ b/MassMessageJob.php
@@ -12,15 +12,10 @@
*/
class MassMessageJob extends Job {
public function __construct( Title $title, array $params, $id = 0 ) {
- parent::__construct( 'MassMessageJob', $title, $params, $id );
- // More debug logging for bug 57464
- wfDebugLog( 'MassMessage', "Before re-normalizing, title is
\"{$this->title->getPrefixedText()}\", "
- . "interwiki is \"{$this->title->getInterwiki()}\", ns
is \"{$this->title->getNamespace()}\"" );
// Create a fresh Title object so namespaces are evaluated
// in the context of the target site. Bug 57464
- $this->title = Title::newFromText(
$this->title->getPrefixedText() );
- wfDebugLog( 'MassMessage', "After re-normalizing, title is
\"{$this->title->getPrefixedText()}\", "
- . "interwiki is \"{$this->title->getInterwiki()}\", ns
is \"{$this->title->getNamespace()}\"" );
+ $title = Title::newFromText( $params['title'] );
+ parent::__construct( 'MassMessageJob', $title, $params, $id );
}
/**
diff --git a/MassMessageSubmitJob.php b/MassMessageSubmitJob.php
index ca25805..727fa8b 100644
--- a/MassMessageSubmitJob.php
+++ b/MassMessageSubmitJob.php
@@ -25,6 +25,9 @@
foreach ( $pages as $page ) {
$title = Title::newFromText( $page['title'] );
+ // Store the title as plain text to avoid
namespace/interwiki prefix
+ // colisions, see bug 57464 and 58524
+ $data['title'] = $page['title'];
$jobsByTarget[$page['wiki']][] = new MassMessageJob(
$title, $data );
}
--
To view, visit https://gerrit.wikimedia.org/r/101814
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3ecb22001b4f9bc8d9b891cd096061da5151505
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits