https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113040
Revision: 113040
Author: reedy
Date: 2012-03-05 15:15:43 +0000 (Mon, 05 Mar 2012)
Log Message:
-----------
MFT r111427, r112347, r112374, r112383, r112700, r112750, r112855
Modified Paths:
--------------
branches/REL1_19/phase3/docs/hooks.txt
branches/REL1_19/phase3/includes/AjaxResponse.php
branches/REL1_19/phase3/includes/Article.php
branches/REL1_19/phase3/includes/api/ApiQueryLogEvents.php
branches/REL1_19/phase3/includes/filerepo/backend/FSFileBackend.php
branches/REL1_19/phase3/includes/filerepo/backend/FileBackend.php
branches/REL1_19/phase3/resources/mediawiki.action/mediawiki.action.history.diff.css
Property Changed:
----------------
branches/REL1_19/phase3/
branches/REL1_19/phase3/includes/
branches/REL1_19/phase3/includes/api/
Property changes on: branches/REL1_19/phase3
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting:100352-107913
/branches/REL1_15/phase3:51646
/branches/REL1_17/phase3:81445,81448
/branches/new-installer/phase3:43664-66004
/branches/sqlite:58211-58321
/branches/wmf/1.18wmf1:97508,111667
/trunk/phase3:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251,111380,111478,111571,111574,111580,111597,111658,111673,111695,111697,111809,111832,111983,112021,112034,112037,112045-112046,112049,112061,112066,112079,112128,112152,112169-112170,112172-112173,112179,112184,112290,112313,112384,112400,112408,112451,112456,112474,112526,112533-112534,112538,112567
+ /branches/JSTesting:100352-107913
/branches/REL1_15/phase3:51646
/branches/REL1_17/phase3:81445,81448
/branches/new-installer/phase3:43664-66004
/branches/sqlite:58211-58321
/branches/wmf/1.18wmf1:97508,111667
/trunk/phase3:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251,111380,111427,111478,111571,111574,111580,111597,111658,111673,111695,111697,111809,111832,111983,112021,112034,112037,112045-112046,112049,112061,112066,112079,112128,112152,112169-112170,112172-112173,112179,112184,112290,112313,112347,112374,112383-112384,112400,112408,112451,112456,112474,112526,112533-112534,112538,112567,112700,112750,112855
Modified: branches/REL1_19/phase3/docs/hooks.txt
===================================================================
--- branches/REL1_19/phase3/docs/hooks.txt 2012-03-05 15:13:26 UTC (rev
113039)
+++ branches/REL1_19/phase3/docs/hooks.txt 2012-03-05 15:15:43 UTC (rev
113040)
@@ -587,6 +587,11 @@
Change $bad and return false to override. If an image is "bad", it is not
rendered inline in wiki pages or galleries in category pages.
+'BeforeDisplayNoArticleText': before displaying noarticletext or
noarticletext-nopermission
+at Article::showMissingArticle()
+
+$article: article object
+
'BeforeInitialize': before anything is initialized in
MediaWiki::performRequest()
&$title: Title being used for request
$unused: null
Property changes on: branches/REL1_19/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting/includes:100352-107913
/branches/REL1_15/phase3/includes:51646
/branches/new-installer/phase3/includes:43664-66004
/branches/sqlite/includes:58211-58321
/branches/wmf/1.18wmf1/includes:97508,111667
/branches/wmf-deployment/includes:53381
/trunk/phase3/includes:111029,111034,111067,111085,111128,111144,111251,111380,111571,111574,111597,111658,111673,111695,111697,111809,111832,111983,112021,112034,112037,112045-112046,112049,112061,112066,112079,112128,112152,112184,112290,112313,112408,112451,112456,112474,112526,112533-112534,112538,112567
+ /branches/JSTesting/includes:100352-107913
/branches/REL1_15/phase3/includes:51646
/branches/new-installer/phase3/includes:43664-66004
/branches/sqlite/includes:58211-58321
/branches/wmf/1.18wmf1/includes:97508,111667
/branches/wmf-deployment/includes:53381
/trunk/phase3/includes:111029,111034,111067,111085,111128,111144,111251,111380,111427,111571,111574,111597,111658,111673,111695,111697,111809,111832,111983,112021,112034,112037,112045-112046,112049,112061,112066,112079,112128,112152,112184,112290,112313,112347,112374,112383,112408,112451,112456,112474,112526,112533-112534,112538,112567,112700,112750,112855
Modified: branches/REL1_19/phase3/includes/AjaxResponse.php
===================================================================
--- branches/REL1_19/phase3/includes/AjaxResponse.php 2012-03-05 15:13:26 UTC
(rev 113039)
+++ branches/REL1_19/phase3/includes/AjaxResponse.php 2012-03-05 15:15:43 UTC
(rev 113040)
@@ -180,11 +180,11 @@
$this->disable();
$this->mLastModified = $lastmod;
- wfDebug( "$fname: CACHED client: $ismodsince ;
user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
+ wfDebug( "$fname: CACHED client: $ismodsince ;
user: {$wgUser->getTouched()} ; page: $timestamp ; site $wgCacheEpoch\n", false
);
return true;
} else {
- wfDebug( "$fname: READY client: $ismodsince ;
user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
+ wfDebug( "$fname: READY client: $ismodsince ;
user: {$wgUser->getTouched()} ; page: $timestamp ; site $wgCacheEpoch\n", false
);
$this->mLastModified = $lastmod;
}
} else {
Modified: branches/REL1_19/phase3/includes/Article.php
===================================================================
--- branches/REL1_19/phase3/includes/Article.php 2012-03-05 15:13:26 UTC
(rev 113039)
+++ branches/REL1_19/phase3/includes/Article.php 2012-03-05 15:15:43 UTC
(rev 113040)
@@ -988,6 +988,18 @@
'msgKey' => array( 'moveddeleted-notice' ) )
);
+ if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) {
+ // If there's no backing content, send a 404 Not Found
+ // for better machine handling of broken links.
+ $wgRequest->response()->header( "HTTP/1.1 404 Not
Found" );
+ }
+
+ $hookResult = wfRunHooks( 'BeforeDisplayNoArticleText', array(
$this ) );
+
+ if ( ! $hookResult ) {
+ return;
+ }
+
# Show error message
$oldid = $this->getOldID();
if ( $oldid ) {
@@ -1010,12 +1022,6 @@
}
$text = "<div class='noarticletext'>\n$text\n</div>";
- if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) {
- // If there's no backing content, send a 404 Not Found
- // for better machine handling of broken links.
- $wgRequest->response()->header( "HTTP/1.1 404 Not
Found" );
- }
-
$wgOut->addWikiText( $text );
}
Property changes on: branches/REL1_19/phase3/includes/api
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting/includes/api:100352-107913
/branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636,69357
/branches/sqlite/includes/api:58211-58321
/branches/wmf/1.16wmf4/includes/api:69521
/branches/wmf/1.18wmf1/includes/api:97789,111667
/branches/wmf-deployment/includes/api:53381,59952
/trunk/phase3/includes/api:111673,112290,112313
+ /branches/JSTesting/includes/api:100352-107913
/branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636,69357
/branches/sqlite/includes/api:58211-58321
/branches/wmf/1.16wmf4/includes/api:69521
/branches/wmf/1.18wmf1/includes/api:97789,111667
/branches/wmf-deployment/includes/api:53381,59952
/trunk/phase3/includes/api:111673,112290,112313,112374,112383,112700,112750,112855
Modified: branches/REL1_19/phase3/includes/api/ApiQueryLogEvents.php
===================================================================
--- branches/REL1_19/phase3/includes/api/ApiQueryLogEvents.php 2012-03-05
15:13:26 UTC (rev 113039)
+++ branches/REL1_19/phase3/includes/api/ApiQueryLogEvents.php 2012-03-05
15:15:43 UTC (rev 113040)
@@ -197,26 +197,44 @@
* @param $ts
* @return array
*/
- public static function addLogParams( $result, &$vals, $params, $type,
$action, $ts ) {
- $params = explode( "\n", $params );
+ public static function addLogParams( $result, &$vals, $params, $type,
$action, $ts, $legacy = false ) {
switch ( $type ) {
case 'move':
- if ( isset( $params[0] ) ) {
- $title = Title::newFromText( $params[0]
);
+ if ( $legacy ){
+ $targetKey = 0;
+ $noredirKey = 1;
+ } else {
+ $targetKey = '4::target';
+ $noredirKey = '5::noredir';
+ }
+
+ if ( isset( $params[ $targetKey ] ) ) {
+ $title = Title::newFromText( $params[
$targetKey ] );
if ( $title ) {
$vals2 = array();
ApiQueryBase::addTitleInfo(
$vals2, $title, 'new_' );
$vals[$type] = $vals2;
}
}
- if ( isset( $params[1] ) && $params[1] ) {
+ if ( isset( $params[ $noredirKey ] ) &&
$params[ $noredirKey ] ) {
$vals[$type]['suppressedredirect'] = '';
}
$params = null;
break;
case 'patrol':
+ if ( $legacy ){
+ $cur = 0;
+ $prev = 1;
+ $auto = 2;
+ } else {
+ $cur = '4::curid';
+ $prev = '5::previd';
+ $auto = '6::auto';
+ }
$vals2 = array();
- list( $vals2['cur'], $vals2['prev'],
$vals2['auto'] ) = $params;
+ $vals2['cur'] = $params[$cur];
+ $vals2['prev'] = $params[$prev];
+ $vals2['auto'] = $params[$auto];
$vals[$type] = $vals2;
$params = null;
break;
@@ -250,6 +268,7 @@
}
private function extractRowInfo( $row ) {
+ $logEntry = DatabaseLogEntry::newFromRow( $row );
$vals = array();
if ( $this->fld_ids ) {
@@ -281,10 +300,11 @@
self::addLogParams(
$this->getResult(),
$vals,
- $row->log_params,
- $row->log_type,
- $row->log_action,
- $row->log_timestamp
+ $logEntry->getParameters(),
+ $logEntry->getType(),
+ $logEntry->getSubtype(),
+ $logEntry->getTimestamp(),
+ $logEntry->isLegacy()
);
}
}
Modified: branches/REL1_19/phase3/includes/filerepo/backend/FSFileBackend.php
===================================================================
--- branches/REL1_19/phase3/includes/filerepo/backend/FSFileBackend.php
2012-03-05 15:13:26 UTC (rev 113039)
+++ branches/REL1_19/phase3/includes/filerepo/backend/FSFileBackend.php
2012-03-05 15:15:43 UTC (rev 113040)
@@ -16,7 +16,7 @@
* Sharding can be accomplished by using FileRepo-style hash paths.
*
* Status messages should avoid mentioning the internal FS paths.
- * Likewise, error suppression should be used to avoid path disclosure.
+ * PHP warnings are assumed to be logged rather than output.
*
* @ingroup FileBackend
* @since 1.19
@@ -41,14 +41,13 @@
parent::__construct( $config );
// Remove any possible trailing slash from directories
-
if ( isset( $config['basePath'] ) ) {
$this->basePath = rtrim( $config['basePath'], '/' ); //
remove trailing slash
} else {
$this->basePath = null; // none; containers must have
explicit paths
}
- if( isset( $config['containerPaths'] ) ) {
+ if ( isset( $config['containerPaths'] ) ) {
$this->containerPaths =
(array)$config['containerPaths'];
foreach ( $this->containerPaths as &$path ) {
$path = rtrim( $path, '/' ); // remove
trailing slash
@@ -138,13 +137,11 @@
}
$parentDir = dirname( $fsPath );
- wfSuppressWarnings();
if ( file_exists( $fsPath ) ) {
$ok = is_file( $fsPath ) && is_writable( $fsPath );
} else {
$ok = is_dir( $parentDir ) && is_writable( $parentDir );
}
- wfRestoreWarnings();
return $ok;
}
@@ -163,9 +160,7 @@
if ( file_exists( $dest ) ) {
if ( !empty( $params['overwrite'] ) ) {
- wfSuppressWarnings();
$ok = unlink( $dest );
- wfRestoreWarnings();
if ( !$ok ) {
$status->fatal( 'backend-fail-delete',
$params['dst'] );
return $status;
@@ -176,9 +171,7 @@
}
}
- wfSuppressWarnings();
$ok = copy( $params['src'], $dest );
- wfRestoreWarnings();
if ( !$ok ) {
$status->fatal( 'backend-fail-store', $params['src'],
$params['dst'] );
return $status;
@@ -209,9 +202,7 @@
if ( file_exists( $dest ) ) {
if ( !empty( $params['overwrite'] ) ) {
- wfSuppressWarnings();
$ok = unlink( $dest );
- wfRestoreWarnings();
if ( !$ok ) {
$status->fatal( 'backend-fail-delete',
$params['dst'] );
return $status;
@@ -222,9 +213,7 @@
}
}
- wfSuppressWarnings();
$ok = copy( $source, $dest );
- wfRestoreWarnings();
if ( !$ok ) {
$status->fatal( 'backend-fail-copy', $params['src'],
$params['dst'] );
return $status;
@@ -257,9 +246,7 @@
if ( !empty( $params['overwrite'] ) ) {
// Windows does not support moving over
existing files
if ( wfIsWindows() ) {
- wfSuppressWarnings();
$ok = unlink( $dest );
- wfRestoreWarnings();
if ( !$ok ) {
$status->fatal(
'backend-fail-delete', $params['dst'] );
return $status;
@@ -271,10 +258,8 @@
}
}
- wfSuppressWarnings();
$ok = rename( $source, $dest );
clearstatcache(); // file no longer at source
- wfRestoreWarnings();
if ( !$ok ) {
$status->fatal( 'backend-fail-move', $params['src'],
$params['dst'] );
return $status;
@@ -302,9 +287,7 @@
return $status; // do nothing; either OK or bad status
}
- wfSuppressWarnings();
$ok = unlink( $source );
- wfRestoreWarnings();
if ( !$ok ) {
$status->fatal( 'backend-fail-delete', $params['src'] );
return $status;
@@ -327,9 +310,7 @@
if ( file_exists( $dest ) ) {
if ( !empty( $params['overwrite'] ) ) {
- wfSuppressWarnings();
$ok = unlink( $dest );
- wfRestoreWarnings();
if ( !$ok ) {
$status->fatal( 'backend-fail-delete',
$params['dst'] );
return $status;
@@ -340,9 +321,7 @@
}
}
- wfSuppressWarnings();
$bytes = file_put_contents( $dest, $params['content'] );
- wfRestoreWarnings();
if ( $bytes === false ) {
$status->fatal( 'backend-fail-create', $params['dst'] );
return $status;
@@ -381,9 +360,7 @@
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
// Seed new directories with a blank index.html, to prevent
crawling...
if ( !empty( $params['noListing'] ) && !file_exists(
"{$dir}/index.html" ) ) {
- wfSuppressWarnings();
$bytes = file_put_contents( "{$dir}/index.html", '' );
- wfRestoreWarnings();
if ( !$bytes ) {
$status->fatal( 'backend-fail-create',
$params['dir'] . '/index.html' );
return $status;
@@ -392,9 +369,7 @@
// Add a .htaccess file to the root of the container...
if ( !empty( $params['noAccess'] ) ) {
if ( !file_exists( "{$contRoot}/.htaccess" ) ) {
- wfSuppressWarnings();
$bytes = file_put_contents(
"{$contRoot}/.htaccess", "Deny from all\n" );
- wfRestoreWarnings();
if ( !$bytes ) {
$storeDir =
"mwstore://{$this->name}/{$shortCont}";
$status->fatal( 'backend-fail-create',
"{$storeDir}/.htaccess" );
@@ -430,7 +405,7 @@
return false; // invalid storage path
}
- $this->trapWarnings();
+ $this->trapWarnings(); // don't trust 'false' if there were
errors
$stat = is_file( $source ) ? stat( $source ) : false; //
regular files only
$hadError = $this->untrapWarnings();
@@ -460,16 +435,12 @@
list( $b, $shortCont, $r ) = FileBackend::splitStoragePath(
$params['dir'] );
$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); //
must be valid
$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
- wfSuppressWarnings();
$exists = is_dir( $dir );
- wfRestoreWarnings();
if ( !$exists ) {
wfDebug( __METHOD__ . "() given directory does not
exist: '$dir'\n" );
return array(); // nothing under this dir
}
- wfSuppressWarnings();
$readable = is_readable( $dir );
- wfRestoreWarnings();
if ( !$readable ) {
wfDebug( __METHOD__ . "() given directory is
unreadable: '$dir'\n" );
return null; // bad permissions?
@@ -506,9 +477,7 @@
$tmpPath = $tmpFile->getPath();
// Copy the source file over the temp file
- wfSuppressWarnings();
$ok = copy( $source, $tmpPath );
- wfRestoreWarnings();
if ( !$ok ) {
return null;
}
@@ -533,17 +502,18 @@
}
/**
- * Suppress E_WARNING errors and track whether any happen
+ * Listen for E_WARNING errors and track whether any happen
*
- * @return void
+ * @return bool
*/
protected function trapWarnings() {
$this->hadWarningErrors[] = false; // push to stack
set_error_handler( array( $this, 'handleWarning' ), E_WARNING );
+ return false; // invoke normal PHP error handler
}
/**
- * Unsuppress E_WARNING errors and return true if any happened
+ * Stop listening for E_WARNING errors and return true if any happened
*
* @return bool
*/
Modified: branches/REL1_19/phase3/includes/filerepo/backend/FileBackend.php
===================================================================
--- branches/REL1_19/phase3/includes/filerepo/backend/FileBackend.php
2012-03-05 15:13:26 UTC (rev 113039)
+++ branches/REL1_19/phase3/includes/filerepo/backend/FileBackend.php
2012-03-05 15:15:43 UTC (rev 113040)
@@ -1236,7 +1236,7 @@
}
// Set output buffer and HTTP headers for stream
- $extraHeaders = $params['headers'] ? $params['headers'] :
array();
+ $extraHeaders = isset( $params['headers'] ) ?
$params['headers'] : array();
$res = StreamFile::prepareForStream( $params['src'], $info,
$extraHeaders );
if ( $res == StreamFile::NOT_MODIFIED ) {
// do nothing; client cache is up to date
Modified:
branches/REL1_19/phase3/resources/mediawiki.action/mediawiki.action.history.diff.css
===================================================================
---
branches/REL1_19/phase3/resources/mediawiki.action/mediawiki.action.history.diff.css
2012-03-05 15:13:26 UTC (rev 113039)
+++
branches/REL1_19/phase3/resources/mediawiki.action/mediawiki.action.history.diff.css
2012-03-05 15:15:43 UTC (rev 113040)
@@ -1,54 +1,39 @@
-/**
- * Diff rendering
- */
-
+/*
+** Diff rendering
+*/
+table.diff, td.diff-otitle, td.diff-ntitle {
+ background-color: white;
+}
td.diff-otitle,
td.diff-ntitle {
text-align: center;
}
-
td.diff-marker {
text-align: right;
}
-
td.diff-lineno {
font-weight: bold;
}
-
-td.diff-addedline,
-td.diff-deletedline,
-td.diff-context {
- font-size: 88%;
- vertical-align: top;
- white-space: -moz-pre-wrap;
- white-space: pre-wrap;
-}
-
td.diff-addedline {
- background: #E0ECFF;
+ background: #cfc;
+ font-size: smaller;
}
-
td.diff-deletedline {
- background: #FCF8CC;
+ background: #ffa;
+ font-size: smaller;
}
-
td.diff-context {
- background: #F2F2F2;
+ background: #eee;
+ font-size: smaller;
}
-
.diffchange {
+ color: red;
font-weight: bold;
+ white-space: -moz-pre-wrap;
+ white-space: pre-wrap;
text-decoration: none;
}
-td.diff-addedline .diffchange {
- background: #B0C8FF;
-}
-
-td.diff-deletedline .diffchange {
- background: #FFD084;
-}
-
table.diff {
border: none;
width: 98%;
@@ -57,25 +42,20 @@
/* Ensure that colums are of equal width */
table-layout: fixed;
}
-
table.diff td {
padding: 0;
}
-
table.diff col.diff-marker {
width: 2%;
}
-
table.diff col.diff-content {
width: 48%;
}
-
table.diff td div {
/* Force-wrap very long lines such as URLs or page-widening char
strings.*/
word-wrap: break-word;
/* As fallback (FF<3.5, Opera <10.5), scrollbars will be added for very
wide cells
- * instead of text overflowing or widening
- */
+ instead of text overflowing or widening */
overflow: auto;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs