48 parent::__construct(
'fixDoubleRedirect', $title,
$params );
49 $this->reason =
$params[
'reason'];
50 $this->redirTitle = Title::newFromText(
$params[
'redirTitle'] );
62 # Need to use the master to get the redirect table updated in the same transaction
65 [
'redirect',
'page' ],
66 [
'page_namespace',
'page_title' ],
72 if ( !
$res->numRows() ) {
76 foreach (
$res as $row ) {
77 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
82 $jobs[] =
new self(
$title, [
85 # Avoid excessive memory usage
86 if ( count( $jobs ) > 10000 ) {
98 if ( !$this->redirTitle ) {
106 wfDebug( __METHOD__ .
": target redirect already deleted, ignoring\n" );
110 $content = $targetRev->getContent();
111 $currentDest = $content ? $content->getRedirectTarget() :
null;
112 if ( !$currentDest || !$currentDest->equals( $this->redirTitle ) ) {
113 wfDebug( __METHOD__ .
": Redirect has changed since the job was queued\n" );
120 if ( $content->matchMagicWord( $mw ) ) {
121 wfDebug( __METHOD__ .
": skipping: suppressed with __STATICREDIRECT__\n" );
130 ": skipping: single redirect, circular redirect or invalid redirect destination\n" );
134 if ( $newTitle->equals( $this->redirTitle ) ) {
137 wfDebug( __METHOD__ .
" : skipping, already good\n" );
141 $newTitle = Title::makeTitle( $newTitle->getNamespace(), $newTitle->getDBkey(),
142 $currentDest->getFragment(), $newTitle->getInterwiki() );
145 $newContent = $content->updateRedirect( $newTitle );
147 if ( $newContent->equals( $content ) ) {
168 $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText()
169 )->inContentLanguage()->text();
171 $article->doEditContent( $newContent,
$reason,
$flags,
false, $user );
193 $titleText = $title->getPrefixedDBkey();
194 if ( isset( $seenTitles[$titleText] ) ) {
195 wfDebug( __METHOD__,
"Circular redirect detected, aborting\n" );
199 $seenTitles[$titleText] =
true;
201 if ( $title->isExternal() ) {
209 $row = $dbw->selectRow(
210 [
'redirect',
'page' ],
211 [
'rd_namespace',
'rd_title',
'rd_interwiki' ],
214 'page_namespace' => $title->getNamespace(),
215 'page_title' => $title->getDBkey()
218 # No redirect from here, chain terminates
221 $dest = $title = Title::makeTitle(
241 if ( !self::$user ) {
243 self::$user = User::newFromName(
$username );
244 # User::newFromName() can return false on a badly configured wiki.
245 if ( self::$user && !self::$user->isLoggedIn() ) {
246 self::$user->addToDatabase();
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Job to fix double redirects after moving a page.
static getFinalDestination( $title)
Get the final destination of a redirect.
getUser()
Get a user object for doing edits, from a request-lifetime cache False will be returned if the user n...
static fixRedirects( $reason, $redirTitle, $destTitle=false)
Insert jobs into the job queue to fix redirects to the given title.
__construct(Title $title, array $params)
Title $redirTitle
The title which has changed, redirects pointing to this title are fixed.
string $reason
Reason for the change, 'maintenance' or 'move'.
static singleton( $wiki=false)
Class to both describe a background job and handle jobs.
array $params
Array of job parameters.
static & get( $id)
Factory: creates an object representing an ID.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
Represents a title within MediaWiki.
getNamespace()
Get the namespace index, i.e.
getPrefixedDBkey()
Get the prefixed database key form.
getDBkey()
Get the main part with underscores.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
it s the revision text itself In either if gzip is the revision text is gzipped $flags
this hook is for auditing only or null if authentication failed before getting that far $username