MediaWiki REL1_39
RedirectSpecialArticle.php
Go to the documentation of this file.
1<?php
90
96 public function __construct( $name ) {
97 parent::__construct( $name );
98 $redirectParams = [
99 'action',
100 'redirect', 'rdfrom',
101 # Options for preloaded edits
102 'preload', 'preloadparams', 'editintro', 'preloadtitle', 'summary', 'nosummary',
103 # Options for overriding user settings
104 'preview', 'minor', 'watchthis',
105 # Options for history/diffs
106 'section', 'oldid', 'diff', 'dir',
107 'limit', 'offset', 'feed',
108 # Misc options
109 'redlink',
110 # Options for action=raw; missing ctype can break JS or CSS in some browsers
111 'ctype', 'maxage', 'smaxage',
112 ];
113
114 $this->getHookRunner()->onRedirectSpecialArticleRedirectParams( $redirectParams );
115 $this->mAllowedRedirectParams = $redirectParams;
116 }
117
121 public function getRedirectQuery( $subpage ) {
122 $query = parent::getRedirectQuery( $subpage );
123 $title = $this->getRedirect( $subpage );
124 // Avoid double redirect for action=edit&redlink=1 for existing pages
125 // (compare to the check in EditPage::edit)
126 if (
127 $query && isset( $query['action'] ) && isset( $query['redlink'] ) &&
128 ( $query['action'] === 'edit' || $query['action'] === 'submit' ) &&
129 (bool)$query['redlink'] &&
130 $title instanceof Title &&
131 $title->exists()
132 ) {
133 return false;
134 }
135 return $query;
136 }
137
138}
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:49
exists( $flags=0)
Check if page exists.
Definition Title.php:3477