Index: trunk/phase3/includes/specials/SpecialExport.php |
— | — | @@ -38,9 +38,8 @@ |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function execute( $par ) { |
42 | | - global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors; |
| 42 | + global $wgSitename, $wgExportAllowListContributors, $wgExportFromNamespaces; |
43 | 43 | global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth; |
44 | | - global $wgExportFromNamespaces; |
45 | 44 | |
46 | 45 | $this->setHeaders(); |
47 | 46 | $this->outputHeader(); |
— | — | @@ -48,16 +47,17 @@ |
49 | 48 | // Set some variables |
50 | 49 | $this->curonly = true; |
51 | 50 | $this->doExport = false; |
52 | | - $this->templates = $wgRequest->getCheck( 'templates' ); |
53 | | - $this->images = $wgRequest->getCheck( 'images' ); // Doesn't do anything yet |
| 51 | + $request = $this->getRequest(); |
| 52 | + $this->templates = $request->getCheck( 'templates' ); |
| 53 | + $this->images = $request->getCheck( 'images' ); // Doesn't do anything yet |
54 | 54 | $this->pageLinkDepth = $this->validateLinkDepth( |
55 | | - $wgRequest->getIntOrNull( 'pagelink-depth' ) |
| 55 | + $request->getIntOrNull( 'pagelink-depth' ) |
56 | 56 | ); |
57 | 57 | $nsindex = ''; |
58 | 58 | |
59 | | - if ( $wgRequest->getCheck( 'addcat' ) ) { |
60 | | - $page = $wgRequest->getText( 'pages' ); |
61 | | - $catname = $wgRequest->getText( 'catname' ); |
| 59 | + if ( $request->getCheck( 'addcat' ) ) { |
| 60 | + $page = $request->getText( 'pages' ); |
| 61 | + $catname = $request->getText( 'catname' ); |
62 | 62 | |
63 | 63 | if ( $catname !== '' && $catname !== null && $catname !== false ) { |
64 | 64 | $t = Title::makeTitleSafe( NS_MAIN, $catname ); |
— | — | @@ -74,9 +74,9 @@ |
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
78 | | - elseif( $wgRequest->getCheck( 'addns' ) && $wgExportFromNamespaces ) { |
79 | | - $page = $wgRequest->getText( 'pages' ); |
80 | | - $nsindex = $wgRequest->getText( 'nsindex', '' ); |
| 78 | + elseif( $request->getCheck( 'addns' ) && $wgExportFromNamespaces ) { |
| 79 | + $page = $request->getText( 'pages' ); |
| 80 | + $nsindex = $request->getText( 'nsindex', '' ); |
81 | 81 | |
82 | 82 | if ( strval( $nsindex ) !== '' ) { |
83 | 83 | /** |
— | — | @@ -88,10 +88,10 @@ |
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | | - elseif( $wgRequest->wasPosted() && $par == '' ) { |
93 | | - $page = $wgRequest->getText( 'pages' ); |
94 | | - $this->curonly = $wgRequest->getCheck( 'curonly' ); |
95 | | - $rawOffset = $wgRequest->getVal( 'offset' ); |
| 92 | + elseif( $request->wasPosted() && $par == '' ) { |
| 93 | + $page = $request->getText( 'pages' ); |
| 94 | + $this->curonly = $request->getCheck( 'curonly' ); |
| 95 | + $rawOffset = $request->getVal( 'offset' ); |
96 | 96 | |
97 | 97 | if( $rawOffset ) { |
98 | 98 | $offset = wfTimestamp( TS_MW, $rawOffset ); |
— | — | @@ -99,14 +99,14 @@ |
100 | 100 | $offset = null; |
101 | 101 | } |
102 | 102 | |
103 | | - $limit = $wgRequest->getInt( 'limit' ); |
104 | | - $dir = $wgRequest->getVal( 'dir' ); |
| 103 | + $limit = $request->getInt( 'limit' ); |
| 104 | + $dir = $request->getVal( 'dir' ); |
105 | 105 | $history = array( |
106 | 106 | 'dir' => 'asc', |
107 | 107 | 'offset' => false, |
108 | 108 | 'limit' => $wgExportMaxHistory, |
109 | 109 | ); |
110 | | - $historyCheck = $wgRequest->getCheck( 'history' ); |
| 110 | + $historyCheck = $request->getCheck( 'history' ); |
111 | 111 | |
112 | 112 | if ( $this->curonly ) { |
113 | 113 | $history = WikiExporter::CURRENT; |
— | — | @@ -127,8 +127,8 @@ |
128 | 128 | } |
129 | 129 | } else { |
130 | 130 | // Default to current-only for GET requests. |
131 | | - $page = $wgRequest->getText( 'pages', $par ); |
132 | | - $historyCheck = $wgRequest->getCheck( 'history' ); |
| 131 | + $page = $request->getText( 'pages', $par ); |
| 132 | + $historyCheck = $request->getCheck( 'history' ); |
133 | 133 | |
134 | 134 | if( $historyCheck ) { |
135 | 135 | $history = WikiExporter::FULL; |
— | — | @@ -146,23 +146,23 @@ |
147 | 147 | $history = WikiExporter::CURRENT; |
148 | 148 | } |
149 | 149 | |
150 | | - $list_authors = $wgRequest->getCheck( 'listauthors' ); |
| 150 | + $list_authors = $request->getCheck( 'listauthors' ); |
151 | 151 | if ( !$this->curonly || !$wgExportAllowListContributors ) { |
152 | 152 | $list_authors = false ; |
153 | 153 | } |
154 | 154 | |
155 | 155 | if ( $this->doExport ) { |
156 | | - $wgOut->disable(); |
| 156 | + $this->getOutput()->disable(); |
157 | 157 | |
158 | 158 | // Cancel output buffering and gzipping if set |
159 | 159 | // This should provide safer streaming for pages with history |
160 | 160 | wfResetOutputBuffers(); |
161 | | - $wgRequest->response()->header( "Content-type: application/xml; charset=utf-8" ); |
| 161 | + $request->response()->header( "Content-type: application/xml; charset=utf-8" ); |
162 | 162 | |
163 | | - if( $wgRequest->getCheck( 'wpDownload' ) ) { |
| 163 | + if( $request->getCheck( 'wpDownload' ) ) { |
164 | 164 | // Provide a sane filename suggestion |
165 | 165 | $filename = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' ); |
166 | | - $wgRequest->response()->header( "Content-disposition: attachment;filename={$filename}" ); |
| 166 | + $request->response()->header( "Content-disposition: attachment;filename={$filename}" ); |
167 | 167 | } |
168 | 168 | |
169 | 169 | $this->doExport( $page, $history, $list_authors ); |
— | — | @@ -170,7 +170,8 @@ |
171 | 171 | return; |
172 | 172 | } |
173 | 173 | |
174 | | - $wgOut->addWikiMsg( 'exporttext' ); |
| 174 | + $out = $this->getOutput(); |
| 175 | + $out->addWikiMsg( 'exporttext' ); |
175 | 176 | |
176 | 177 | $form = Xml::openElement( 'form', array( 'method' => 'post', |
177 | 178 | 'action' => $this->getTitle()->getLocalUrl( 'action=submit' ) ) ); |
— | — | @@ -190,17 +191,17 @@ |
191 | 192 | wfMsg( 'exportcuronly' ), |
192 | 193 | 'curonly', |
193 | 194 | 'curonly', |
194 | | - $wgRequest->wasPosted() ? $wgRequest->getCheck( 'curonly' ) : true |
| 195 | + $request->wasPosted() ? $request->getCheck( 'curonly' ) : true |
195 | 196 | ) . '<br />'; |
196 | 197 | } else { |
197 | | - $wgOut->addHTML( wfMsgExt( 'exportnohistory', 'parse' ) ); |
| 198 | + $out->addHTML( wfMsgExt( 'exportnohistory', 'parse' ) ); |
198 | 199 | } |
199 | 200 | |
200 | 201 | $form .= Xml::checkLabel( |
201 | 202 | wfMsg( 'export-templates' ), |
202 | 203 | 'templates', |
203 | 204 | 'wpExportTemplates', |
204 | | - $wgRequest->wasPosted() ? $wgRequest->getCheck( 'templates' ) : false |
| 205 | + $request->wasPosted() ? $request->getCheck( 'templates' ) : false |
205 | 206 | ) . '<br />'; |
206 | 207 | |
207 | 208 | if( $wgExportMaxLinkDepth || $this->userCanOverrideExportDepth() ) { |
— | — | @@ -212,18 +213,17 @@ |
213 | 214 | wfMsg( 'export-download' ), |
214 | 215 | 'wpDownload', |
215 | 216 | 'wpDownload', |
216 | | - $wgRequest->wasPosted() ? $wgRequest->getCheck( 'wpDownload' ) : true |
| 217 | + $request->wasPosted() ? $request->getCheck( 'wpDownload' ) : true |
217 | 218 | ) . '<br />'; |
218 | 219 | |
219 | 220 | $form .= Xml::submitButton( wfMsg( 'export-submit' ), Linker::tooltipAndAccesskeyAttribs( 'export' ) ); |
220 | 221 | $form .= Xml::closeElement( 'form' ); |
221 | 222 | |
222 | | - $wgOut->addHTML( $form ); |
| 223 | + $out->addHTML( $form ); |
223 | 224 | } |
224 | 225 | |
225 | 226 | private function userCanOverrideExportDepth() { |
226 | | - global $wgUser; |
227 | | - return $wgUser->isAllowed( 'override-export-depth' ); |
| 227 | + return $this->getUser()->isAllowed( 'override-export-depth' ); |
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |