<?php
/**
+ * Refresh link tables.
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* @param $id int The page_id of the redirect
*/
private function fixRedirect( $id ) {
- global $wgTitle, $wgArticle;
-
- $wgTitle = Title::newFromID( $id );
+ $title = Title::newFromID( $id );
$dbw = wfGetDB( DB_MASTER );
- if ( is_null( $wgTitle ) ) {
+ if ( is_null( $title ) ) {
// This page doesn't exist (any more)
// Delete any redirect table entry for it
$dbw->delete( 'redirect', array( 'rd_from' => $id ),
__METHOD__ );
return;
}
- $wgArticle = new Article( $wgTitle );
+ $article = new Article( $title );
- $rt = $wgArticle->followRedirect();
+ $rt = $article->followRedirect();
if ( !$rt || !is_object( $rt ) ) {
- // $wgTitle is not a redirect
+ // $title is not a redirect
// Delete any redirect table entry for it
$dbw->delete( 'redirect', array( 'rd_from' => $id ),
__METHOD__ );
} else {
- $wgArticle->updateRedirectOn( $dbw, $rt );
+ $article->updateRedirectOn( $dbw, $rt );
}
}
* @param $id int The page_id
*/
public static function fixLinksFromArticle( $id ) {
- global $wgTitle, $wgParser;
+ global $wgParser;
- $wgTitle = Title::newFromID( $id );
+ $title = Title::newFromID( $id );
$dbw = wfGetDB( DB_MASTER );
LinkCache::singleton()->clear();
- if ( is_null( $wgTitle ) ) {
+ if ( is_null( $title ) ) {
return;
}
$dbw->begin();
- $revision = Revision::newFromTitle( $wgTitle );
+ $revision = Revision::newFromTitle( $title );
if ( !$revision ) {
return;
}
$options = new ParserOptions;
- $parserOutput = $wgParser->parse( $revision->getText(), $wgTitle, $options, true, true, $revision->getId() );
- $update = new LinksUpdate( $wgTitle, $parserOutput, false );
+ $parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() );
+ $update = new LinksUpdate( $title, $parserOutput, false );
$update->doUpdate();
$dbw->commit();
}