wfDebug( __METHOD__.": target redirect already deleted, ignoring\n" );
return true;
}
- $text = $targetRev->getText();
- $currentDest = Title::newFromRedirect( $text );
+ $content = $targetRev->getContent();
+ $currentDest = $content->getRedirectTarget();
if ( !$currentDest || !$currentDest->equals( $this->redirTitle ) ) {
wfDebug( __METHOD__.": Redirect has changed since the job was queued\n" );
return true;
}
# Check for a suppression tag (used e.g. in periodically archived discussions)
+ $text = ContentHandler::getContentText( $content );
$mw = MagicWord::get( 'staticredirect' );
- if ( $mw->match( $text ) ) {
+ if ( $mw->match( $text ) ) { #FIXME: add support for this to ContentHandler/Content
wfDebug( __METHOD__.": skipping: suppressed with __STATICREDIRECT__\n" );
return true;
}
# so the regex has to be fairly general
$newText = preg_replace( '/ \[ \[ [^\]]* \] \] /x',
'[[' . $newTitle->getFullText() . ']]',
- $text, 1 );
+ $text, 1 ); #FIXME: need a way to do this via ContentHandler!
if ( $newText === $text ) {
$this->setLastError( 'Text unchanged???' );
$oldUser = $wgUser;
$wgUser = $this->getUser();
$article = WikiPage::factory( $this->title );
- $reason = wfMsgForContent( 'double-redirect-fixed-' . $this->reason,
- $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText() );
+ $reason = wfMessage( 'double-redirect-fixed-' . $this->reason,
+ $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText()
+ )->inContentLanguage()->text();
$article->doEdit( $newText, $reason, EDIT_UPDATE | EDIT_SUPPRESS_RC, false, $this->getUser() );
$wgUser = $oldUser;
*/
function getUser() {
if ( !self::$user ) {
- self::$user = User::newFromName( wfMsgForContent( 'double-redirect-fixer' ), false );
+ self::$user = User::newFromName( wfMessage( 'double-redirect-fixer' )->inContentLanguage()->text(), false );
# FIXME: newFromName could return false on a badly configured wiki.
if ( !self::$user->isLoggedIn() ) {
self::$user->addToDatabase();