Index: branches/REL1_19/phase3/docs/hooks.txt |
— | — | @@ -587,6 +587,11 @@ |
588 | 588 | Change $bad and return false to override. If an image is "bad", it is not |
589 | 589 | rendered inline in wiki pages or galleries in category pages. |
590 | 590 | |
| 591 | +'BeforeDisplayNoArticleText': before displaying noarticletext or noarticletext-nopermission |
| 592 | +at Article::showMissingArticle() |
| 593 | + |
| 594 | +$article: article object |
| 595 | + |
591 | 596 | 'BeforeInitialize': before anything is initialized in MediaWiki::performRequest() |
592 | 597 | &$title: Title being used for request |
593 | 598 | $unused: null |
Index: branches/REL1_19/phase3/includes/Article.php |
— | — | @@ -988,6 +988,18 @@ |
989 | 989 | 'msgKey' => array( 'moveddeleted-notice' ) ) |
990 | 990 | ); |
991 | 991 | |
| 992 | + if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) { |
| 993 | + // If there's no backing content, send a 404 Not Found |
| 994 | + // for better machine handling of broken links. |
| 995 | + $wgRequest->response()->header( "HTTP/1.1 404 Not Found" ); |
| 996 | + } |
| 997 | + |
| 998 | + $hookResult = wfRunHooks( 'BeforeDisplayNoArticleText', array( $this ) ); |
| 999 | + |
| 1000 | + if ( ! $hookResult ) { |
| 1001 | + return; |
| 1002 | + } |
| 1003 | + |
992 | 1004 | # Show error message |
993 | 1005 | $oldid = $this->getOldID(); |
994 | 1006 | if ( $oldid ) { |
— | — | @@ -1010,12 +1022,6 @@ |
1011 | 1023 | } |
1012 | 1024 | $text = "<div class='noarticletext'>\n$text\n</div>"; |
1013 | 1025 | |
1014 | | - if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) { |
1015 | | - // If there's no backing content, send a 404 Not Found |
1016 | | - // for better machine handling of broken links. |
1017 | | - $wgRequest->response()->header( "HTTP/1.1 404 Not Found" ); |
1018 | | - } |
1019 | | - |
1020 | 1026 | $wgOut->addWikiText( $text ); |
1021 | 1027 | } |
1022 | 1028 | |
Index: branches/REL1_19/phase3/includes/filerepo/backend/FSFileBackend.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | * Sharding can be accomplished by using FileRepo-style hash paths. |
18 | 18 | * |
19 | 19 | * Status messages should avoid mentioning the internal FS paths. |
20 | | - * Likewise, error suppression should be used to avoid path disclosure. |
| 20 | + * PHP warnings are assumed to be logged rather than output. |
21 | 21 | * |
22 | 22 | * @ingroup FileBackend |
23 | 23 | * @since 1.19 |
— | — | @@ -41,14 +41,13 @@ |
42 | 42 | parent::__construct( $config ); |
43 | 43 | |
44 | 44 | // Remove any possible trailing slash from directories |
45 | | - |
46 | 45 | if ( isset( $config['basePath'] ) ) { |
47 | 46 | $this->basePath = rtrim( $config['basePath'], '/' ); // remove trailing slash |
48 | 47 | } else { |
49 | 48 | $this->basePath = null; // none; containers must have explicit paths |
50 | 49 | } |
51 | 50 | |
52 | | - if( isset( $config['containerPaths'] ) ) { |
| 51 | + if ( isset( $config['containerPaths'] ) ) { |
53 | 52 | $this->containerPaths = (array)$config['containerPaths']; |
54 | 53 | foreach ( $this->containerPaths as &$path ) { |
55 | 54 | $path = rtrim( $path, '/' ); // remove trailing slash |
— | — | @@ -138,13 +137,11 @@ |
139 | 138 | } |
140 | 139 | $parentDir = dirname( $fsPath ); |
141 | 140 | |
142 | | - wfSuppressWarnings(); |
143 | 141 | if ( file_exists( $fsPath ) ) { |
144 | 142 | $ok = is_file( $fsPath ) && is_writable( $fsPath ); |
145 | 143 | } else { |
146 | 144 | $ok = is_dir( $parentDir ) && is_writable( $parentDir ); |
147 | 145 | } |
148 | | - wfRestoreWarnings(); |
149 | 146 | |
150 | 147 | return $ok; |
151 | 148 | } |
— | — | @@ -163,9 +160,7 @@ |
164 | 161 | |
165 | 162 | if ( file_exists( $dest ) ) { |
166 | 163 | if ( !empty( $params['overwrite'] ) ) { |
167 | | - wfSuppressWarnings(); |
168 | 164 | $ok = unlink( $dest ); |
169 | | - wfRestoreWarnings(); |
170 | 165 | if ( !$ok ) { |
171 | 166 | $status->fatal( 'backend-fail-delete', $params['dst'] ); |
172 | 167 | return $status; |
— | — | @@ -176,9 +171,7 @@ |
177 | 172 | } |
178 | 173 | } |
179 | 174 | |
180 | | - wfSuppressWarnings(); |
181 | 175 | $ok = copy( $params['src'], $dest ); |
182 | | - wfRestoreWarnings(); |
183 | 176 | if ( !$ok ) { |
184 | 177 | $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] ); |
185 | 178 | return $status; |
— | — | @@ -209,9 +202,7 @@ |
210 | 203 | |
211 | 204 | if ( file_exists( $dest ) ) { |
212 | 205 | if ( !empty( $params['overwrite'] ) ) { |
213 | | - wfSuppressWarnings(); |
214 | 206 | $ok = unlink( $dest ); |
215 | | - wfRestoreWarnings(); |
216 | 207 | if ( !$ok ) { |
217 | 208 | $status->fatal( 'backend-fail-delete', $params['dst'] ); |
218 | 209 | return $status; |
— | — | @@ -222,9 +213,7 @@ |
223 | 214 | } |
224 | 215 | } |
225 | 216 | |
226 | | - wfSuppressWarnings(); |
227 | 217 | $ok = copy( $source, $dest ); |
228 | | - wfRestoreWarnings(); |
229 | 218 | if ( !$ok ) { |
230 | 219 | $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] ); |
231 | 220 | return $status; |
— | — | @@ -257,9 +246,7 @@ |
258 | 247 | if ( !empty( $params['overwrite'] ) ) { |
259 | 248 | // Windows does not support moving over existing files |
260 | 249 | if ( wfIsWindows() ) { |
261 | | - wfSuppressWarnings(); |
262 | 250 | $ok = unlink( $dest ); |
263 | | - wfRestoreWarnings(); |
264 | 251 | if ( !$ok ) { |
265 | 252 | $status->fatal( 'backend-fail-delete', $params['dst'] ); |
266 | 253 | return $status; |
— | — | @@ -271,10 +258,8 @@ |
272 | 259 | } |
273 | 260 | } |
274 | 261 | |
275 | | - wfSuppressWarnings(); |
276 | 262 | $ok = rename( $source, $dest ); |
277 | 263 | clearstatcache(); // file no longer at source |
278 | | - wfRestoreWarnings(); |
279 | 264 | if ( !$ok ) { |
280 | 265 | $status->fatal( 'backend-fail-move', $params['src'], $params['dst'] ); |
281 | 266 | return $status; |
— | — | @@ -302,9 +287,7 @@ |
303 | 288 | return $status; // do nothing; either OK or bad status |
304 | 289 | } |
305 | 290 | |
306 | | - wfSuppressWarnings(); |
307 | 291 | $ok = unlink( $source ); |
308 | | - wfRestoreWarnings(); |
309 | 292 | if ( !$ok ) { |
310 | 293 | $status->fatal( 'backend-fail-delete', $params['src'] ); |
311 | 294 | return $status; |
— | — | @@ -327,9 +310,7 @@ |
328 | 311 | |
329 | 312 | if ( file_exists( $dest ) ) { |
330 | 313 | if ( !empty( $params['overwrite'] ) ) { |
331 | | - wfSuppressWarnings(); |
332 | 314 | $ok = unlink( $dest ); |
333 | | - wfRestoreWarnings(); |
334 | 315 | if ( !$ok ) { |
335 | 316 | $status->fatal( 'backend-fail-delete', $params['dst'] ); |
336 | 317 | return $status; |
— | — | @@ -340,9 +321,7 @@ |
341 | 322 | } |
342 | 323 | } |
343 | 324 | |
344 | | - wfSuppressWarnings(); |
345 | 325 | $bytes = file_put_contents( $dest, $params['content'] ); |
346 | | - wfRestoreWarnings(); |
347 | 326 | if ( $bytes === false ) { |
348 | 327 | $status->fatal( 'backend-fail-create', $params['dst'] ); |
349 | 328 | return $status; |
— | — | @@ -381,9 +360,7 @@ |
382 | 361 | $dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; |
383 | 362 | // Seed new directories with a blank index.html, to prevent crawling... |
384 | 363 | if ( !empty( $params['noListing'] ) && !file_exists( "{$dir}/index.html" ) ) { |
385 | | - wfSuppressWarnings(); |
386 | 364 | $bytes = file_put_contents( "{$dir}/index.html", '' ); |
387 | | - wfRestoreWarnings(); |
388 | 365 | if ( !$bytes ) { |
389 | 366 | $status->fatal( 'backend-fail-create', $params['dir'] . '/index.html' ); |
390 | 367 | return $status; |
— | — | @@ -392,9 +369,7 @@ |
393 | 370 | // Add a .htaccess file to the root of the container... |
394 | 371 | if ( !empty( $params['noAccess'] ) ) { |
395 | 372 | if ( !file_exists( "{$contRoot}/.htaccess" ) ) { |
396 | | - wfSuppressWarnings(); |
397 | 373 | $bytes = file_put_contents( "{$contRoot}/.htaccess", "Deny from all\n" ); |
398 | | - wfRestoreWarnings(); |
399 | 374 | if ( !$bytes ) { |
400 | 375 | $storeDir = "mwstore://{$this->name}/{$shortCont}"; |
401 | 376 | $status->fatal( 'backend-fail-create', "{$storeDir}/.htaccess" ); |
— | — | @@ -430,7 +405,7 @@ |
431 | 406 | return false; // invalid storage path |
432 | 407 | } |
433 | 408 | |
434 | | - $this->trapWarnings(); |
| 409 | + $this->trapWarnings(); // don't trust 'false' if there were errors |
435 | 410 | $stat = is_file( $source ) ? stat( $source ) : false; // regular files only |
436 | 411 | $hadError = $this->untrapWarnings(); |
437 | 412 | |
— | — | @@ -460,16 +435,12 @@ |
461 | 436 | list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] ); |
462 | 437 | $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid |
463 | 438 | $dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot; |
464 | | - wfSuppressWarnings(); |
465 | 439 | $exists = is_dir( $dir ); |
466 | | - wfRestoreWarnings(); |
467 | 440 | if ( !$exists ) { |
468 | 441 | wfDebug( __METHOD__ . "() given directory does not exist: '$dir'\n" ); |
469 | 442 | return array(); // nothing under this dir |
470 | 443 | } |
471 | | - wfSuppressWarnings(); |
472 | 444 | $readable = is_readable( $dir ); |
473 | | - wfRestoreWarnings(); |
474 | 445 | if ( !$readable ) { |
475 | 446 | wfDebug( __METHOD__ . "() given directory is unreadable: '$dir'\n" ); |
476 | 447 | return null; // bad permissions? |
— | — | @@ -506,9 +477,7 @@ |
507 | 478 | $tmpPath = $tmpFile->getPath(); |
508 | 479 | |
509 | 480 | // Copy the source file over the temp file |
510 | | - wfSuppressWarnings(); |
511 | 481 | $ok = copy( $source, $tmpPath ); |
512 | | - wfRestoreWarnings(); |
513 | 482 | if ( !$ok ) { |
514 | 483 | return null; |
515 | 484 | } |
— | — | @@ -533,17 +502,18 @@ |
534 | 503 | } |
535 | 504 | |
536 | 505 | /** |
537 | | - * Suppress E_WARNING errors and track whether any happen |
| 506 | + * Listen for E_WARNING errors and track whether any happen |
538 | 507 | * |
539 | | - * @return void |
| 508 | + * @return bool |
540 | 509 | */ |
541 | 510 | protected function trapWarnings() { |
542 | 511 | $this->hadWarningErrors[] = false; // push to stack |
543 | 512 | set_error_handler( array( $this, 'handleWarning' ), E_WARNING ); |
| 513 | + return false; // invoke normal PHP error handler |
544 | 514 | } |
545 | 515 | |
546 | 516 | /** |
547 | | - * Unsuppress E_WARNING errors and return true if any happened |
| 517 | + * Stop listening for E_WARNING errors and return true if any happened |
548 | 518 | * |
549 | 519 | * @return bool |
550 | 520 | */ |
Index: branches/REL1_19/phase3/includes/filerepo/backend/FileBackend.php |
— | — | @@ -1236,7 +1236,7 @@ |
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | // Set output buffer and HTTP headers for stream |
1240 | | - $extraHeaders = $params['headers'] ? $params['headers'] : array(); |
| 1240 | + $extraHeaders = isset( $params['headers'] ) ? $params['headers'] : array(); |
1241 | 1241 | $res = StreamFile::prepareForStream( $params['src'], $info, $extraHeaders ); |
1242 | 1242 | if ( $res == StreamFile::NOT_MODIFIED ) { |
1243 | 1243 | // do nothing; client cache is up to date |
Index: branches/REL1_19/phase3/includes/api/ApiQueryLogEvents.php |
— | — | @@ -197,26 +197,44 @@ |
198 | 198 | * @param $ts |
199 | 199 | * @return array |
200 | 200 | */ |
201 | | - public static function addLogParams( $result, &$vals, $params, $type, $action, $ts ) { |
202 | | - $params = explode( "\n", $params ); |
| 201 | + public static function addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy = false ) { |
203 | 202 | switch ( $type ) { |
204 | 203 | case 'move': |
205 | | - if ( isset( $params[0] ) ) { |
206 | | - $title = Title::newFromText( $params[0] ); |
| 204 | + if ( $legacy ){ |
| 205 | + $targetKey = 0; |
| 206 | + $noredirKey = 1; |
| 207 | + } else { |
| 208 | + $targetKey = '4::target'; |
| 209 | + $noredirKey = '5::noredir'; |
| 210 | + } |
| 211 | + |
| 212 | + if ( isset( $params[ $targetKey ] ) ) { |
| 213 | + $title = Title::newFromText( $params[ $targetKey ] ); |
207 | 214 | if ( $title ) { |
208 | 215 | $vals2 = array(); |
209 | 216 | ApiQueryBase::addTitleInfo( $vals2, $title, 'new_' ); |
210 | 217 | $vals[$type] = $vals2; |
211 | 218 | } |
212 | 219 | } |
213 | | - if ( isset( $params[1] ) && $params[1] ) { |
| 220 | + if ( isset( $params[ $noredirKey ] ) && $params[ $noredirKey ] ) { |
214 | 221 | $vals[$type]['suppressedredirect'] = ''; |
215 | 222 | } |
216 | 223 | $params = null; |
217 | 224 | break; |
218 | 225 | case 'patrol': |
| 226 | + if ( $legacy ){ |
| 227 | + $cur = 0; |
| 228 | + $prev = 1; |
| 229 | + $auto = 2; |
| 230 | + } else { |
| 231 | + $cur = '4::curid'; |
| 232 | + $prev = '5::previd'; |
| 233 | + $auto = '6::auto'; |
| 234 | + } |
219 | 235 | $vals2 = array(); |
220 | | - list( $vals2['cur'], $vals2['prev'], $vals2['auto'] ) = $params; |
| 236 | + $vals2['cur'] = $params[$cur]; |
| 237 | + $vals2['prev'] = $params[$prev]; |
| 238 | + $vals2['auto'] = $params[$auto]; |
221 | 239 | $vals[$type] = $vals2; |
222 | 240 | $params = null; |
223 | 241 | break; |
— | — | @@ -250,6 +268,7 @@ |
251 | 269 | } |
252 | 270 | |
253 | 271 | private function extractRowInfo( $row ) { |
| 272 | + $logEntry = DatabaseLogEntry::newFromRow( $row ); |
254 | 273 | $vals = array(); |
255 | 274 | |
256 | 275 | if ( $this->fld_ids ) { |
— | — | @@ -281,10 +300,11 @@ |
282 | 301 | self::addLogParams( |
283 | 302 | $this->getResult(), |
284 | 303 | $vals, |
285 | | - $row->log_params, |
286 | | - $row->log_type, |
287 | | - $row->log_action, |
288 | | - $row->log_timestamp |
| 304 | + $logEntry->getParameters(), |
| 305 | + $logEntry->getType(), |
| 306 | + $logEntry->getSubtype(), |
| 307 | + $logEntry->getTimestamp(), |
| 308 | + $logEntry->isLegacy() |
289 | 309 | ); |
290 | 310 | } |
291 | 311 | } |
Property changes on: branches/REL1_19/phase3/includes/api |
___________________________________________________________________ |
Modified: svn:mergeinfo |
292 | 312 | Merged /trunk/phase3/includes/api:r112374,112383,112700,112750,112855 |
Index: branches/REL1_19/phase3/includes/AjaxResponse.php |
— | — | @@ -180,11 +180,11 @@ |
181 | 181 | $this->disable(); |
182 | 182 | $this->mLastModified = $lastmod; |
183 | 183 | |
184 | | - wfDebug( "$fname: CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false ); |
| 184 | + wfDebug( "$fname: CACHED client: $ismodsince ; user: {$wgUser->getTouched()} ; page: $timestamp ; site $wgCacheEpoch\n", false ); |
185 | 185 | |
186 | 186 | return true; |
187 | 187 | } else { |
188 | | - wfDebug( "$fname: READY client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false ); |
| 188 | + wfDebug( "$fname: READY client: $ismodsince ; user: {$wgUser->getTouched()} ; page: $timestamp ; site $wgCacheEpoch\n", false ); |
189 | 189 | $this->mLastModified = $lastmod; |
190 | 190 | } |
191 | 191 | } else { |
Property changes on: branches/REL1_19/phase3/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
192 | 192 | Merged /trunk/phase3/includes:r111427,112347,112374,112383,112700,112750,112855 |
Index: branches/REL1_19/phase3/resources/mediawiki.action/mediawiki.action.history.diff.css |
— | — | @@ -1,54 +1,39 @@ |
2 | | -/** |
3 | | - * Diff rendering |
4 | | - */ |
5 | | - |
| 2 | +/* |
| 3 | +** Diff rendering |
| 4 | +*/ |
| 5 | +table.diff, td.diff-otitle, td.diff-ntitle { |
| 6 | + background-color: white; |
| 7 | +} |
6 | 8 | td.diff-otitle, |
7 | 9 | td.diff-ntitle { |
8 | 10 | text-align: center; |
9 | 11 | } |
10 | | - |
11 | 12 | td.diff-marker { |
12 | 13 | text-align: right; |
13 | 14 | } |
14 | | - |
15 | 15 | td.diff-lineno { |
16 | 16 | font-weight: bold; |
17 | 17 | } |
18 | | - |
19 | | -td.diff-addedline, |
20 | | -td.diff-deletedline, |
21 | | -td.diff-context { |
22 | | - font-size: 88%; |
23 | | - vertical-align: top; |
24 | | - white-space: -moz-pre-wrap; |
25 | | - white-space: pre-wrap; |
26 | | -} |
27 | | - |
28 | 18 | td.diff-addedline { |
29 | | - background: #E0ECFF; |
| 19 | + background: #cfc; |
| 20 | + font-size: smaller; |
30 | 21 | } |
31 | | - |
32 | 22 | td.diff-deletedline { |
33 | | - background: #FCF8CC; |
| 23 | + background: #ffa; |
| 24 | + font-size: smaller; |
34 | 25 | } |
35 | | - |
36 | 26 | td.diff-context { |
37 | | - background: #F2F2F2; |
| 27 | + background: #eee; |
| 28 | + font-size: smaller; |
38 | 29 | } |
39 | | - |
40 | 30 | .diffchange { |
| 31 | + color: red; |
41 | 32 | font-weight: bold; |
| 33 | + white-space: -moz-pre-wrap; |
| 34 | + white-space: pre-wrap; |
42 | 35 | text-decoration: none; |
43 | 36 | } |
44 | 37 | |
45 | | -td.diff-addedline .diffchange { |
46 | | - background: #B0C8FF; |
47 | | -} |
48 | | - |
49 | | -td.diff-deletedline .diffchange { |
50 | | - background: #FFD084; |
51 | | -} |
52 | | - |
53 | 38 | table.diff { |
54 | 39 | border: none; |
55 | 40 | width: 98%; |
— | — | @@ -57,25 +42,20 @@ |
58 | 43 | /* Ensure that colums are of equal width */ |
59 | 44 | table-layout: fixed; |
60 | 45 | } |
61 | | - |
62 | 46 | table.diff td { |
63 | 47 | padding: 0; |
64 | 48 | } |
65 | | - |
66 | 49 | table.diff col.diff-marker { |
67 | 50 | width: 2%; |
68 | 51 | } |
69 | | - |
70 | 52 | table.diff col.diff-content { |
71 | 53 | width: 48%; |
72 | 54 | } |
73 | | - |
74 | 55 | table.diff td div { |
75 | 56 | /* Force-wrap very long lines such as URLs or page-widening char strings.*/ |
76 | 57 | word-wrap: break-word; |
77 | 58 | |
78 | 59 | /* As fallback (FF<3.5, Opera <10.5), scrollbars will be added for very wide cells |
79 | | - * instead of text overflowing or widening |
80 | | - */ |
| 60 | + instead of text overflowing or widening */ |
81 | 61 | overflow: auto; |
82 | 62 | } |
Property changes on: branches/REL1_19/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
83 | 63 | Merged /trunk/phase3:r111427,112347,112374,112383,112700,112750,112855 |