MediaWiki REL1_34
RedirectSpecialArticle.php
Go to the documentation of this file.
1<?php
88 function __construct( $name ) {
89 parent::__construct( $name );
90 $redirectParams = [
91 'action',
92 'redirect', 'rdfrom',
93 # Options for preloaded edits
94 'preload', 'preloadparams', 'editintro', 'preloadtitle', 'summary', 'nosummary',
95 # Options for overriding user settings
96 'preview', 'minor', 'watchthis',
97 # Options for history/diffs
98 'section', 'oldid', 'diff', 'dir',
99 'limit', 'offset', 'feed',
100 # Misc options
101 'redlink',
102 # Options for action=raw; missing ctype can break JS or CSS in some browsers
103 'ctype', 'maxage', 'smaxage',
104 ];
105
106 Hooks::run( "RedirectSpecialArticleRedirectParams", [ &$redirectParams ] );
107 $this->mAllowedRedirectParams = $redirectParams;
108 }
109
113 public function getRedirectQuery( $subpage ) {
114 $query = parent::getRedirectQuery( $subpage );
115 $title = $this->getRedirect( $subpage );
116 // Avoid double redirect for action=edit&redlink=1 for existing pages
117 // (compare to the check in EditPage::edit)
118 if (
119 $query && isset( $query['action'] ) && isset( $query['redlink'] ) &&
120 ( $query['action'] === 'edit' || $query['action'] === 'submit' ) &&
121 (bool)$query['redlink'] &&
122 $title instanceof Title &&
123 $title->exists()
124 ) {
125 return false;
126 }
127 return $query;
128 }
129
130}
Superclass for any RedirectSpecialPage which redirects the user to a particular article (as opposed t...
getRedirectQuery( $subpage)
Return part of the request string for a special redirect page This allows passing,...
Shortcut to construct a special page alias.
getRedirect( $subpage)
If the special page is a redirect, then get the Title object it redirects to.
Represents a title within MediaWiki.
Definition Title.php:42
exists( $flags=0)
Check if page exists.
Definition Title.php:4142