Added explicit DB flags for Revision loading calls.

Change-Id: Ie90d4197ad7a16009c96273eeae1a658678a8200
This commit is contained in:
Aaron Schulz 2012-08-29 20:04:30 -07:00
parent e6aeec01c4
commit a53de31828
5 changed files with 19 additions and 13 deletions

View file

@ -3820,7 +3820,7 @@ class Title {
return false;
}
# Get the article text
$rev = Revision::newFromTitle( $nt );
$rev = Revision::newFromTitle( $nt, false, Revision::READ_LATEST );
if( !is_object( $rev ) ){
return false;
}
@ -4113,11 +4113,11 @@ class Title {
if ( in_array( 'include_old', $options ) ) {
$old_cmp = '>=';
}
if ( in_array( 'include_new', $options ) ) {
$new_cmp = '<=';
}
if ( in_array( 'include_both', $options ) ) {
$old_cmp = '>=';
if ( in_array( 'include_new', $options ) ) {
$new_cmp = '<=';
}
if ( in_array( 'include_both', $options ) ) {
$old_cmp = '>=';
$new_cmp = '<=';
}
// No DB query needed if $old and $new are the same or successive revisions:
@ -4128,7 +4128,7 @@ class Title {
return ( $old_cmp === '>' && $new_cmp === '<' ) ? 0 : 1;
}
return ( $old->getRawUserText() === $new->getRawUserText() ) ? 1 : 2;
}
}
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'revision', 'DISTINCT rev_user_text',
array(

View file

@ -60,7 +60,11 @@ class ApiEditPage extends ApiBase {
if ( $titleObj->isRedirect() ) {
$oldTitle = $titleObj;
$titles = Title::newFromRedirectArray( Revision::newFromTitle( $oldTitle )->getText( Revision::FOR_THIS_USER ) );
$titles = Title::newFromRedirectArray(
Revision::newFromTitle(
$oldTitle, false, Revision::READ_LATEST
)->getText( Revision::FOR_THIS_USER )
);
// array_shift( $titles );
$redirValues = array();
@ -182,7 +186,7 @@ class ApiEditPage extends ApiBase {
if ( !is_null( $params['summary'] ) ) {
$requestArray['wpSummary'] = $params['summary'];
}
if ( !is_null( $params['sectiontitle'] ) ) {
$requestArray['wpSectionTitle'] = $params['sectiontitle'];
}

View file

@ -766,7 +766,9 @@ class MessageCache {
}
# Try loading it from the database
$revision = Revision::newFromTitle( Title::makeTitle( NS_MEDIAWIKI, $title ) );
$revision = Revision::newFromTitle(
Title::makeTitle( NS_MEDIAWIKI, $title ), false, Revision::READ_LATEST
);
if ( $revision ) {
$message = $revision->getText();
if ($message === false) {

View file

@ -89,7 +89,7 @@ class DoubleRedirectJob extends Job {
return false;
}
$targetRev = Revision::newFromTitle( $this->title );
$targetRev = Revision::newFromTitle( $this->title, false, Revision::READ_LATEST );
if ( !$targetRev ) {
wfDebug( __METHOD__.": target redirect already deleted, ignoring\n" );
return true;

View file

@ -77,7 +77,7 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
if ( !$title->isCssJsSubpage() && !$title->isCssOrJsPage() ) {
return null;
}
$revision = Revision::newFromTitle( $title );
$revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
if ( !$revision ) {
return null;
}
@ -182,7 +182,7 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
// We're dealing with a subclass that doesn't have a DB
return array();
}
$hash = $context->getHash();
if ( isset( $this->titleMtimes[$hash] ) ) {
return $this->titleMtimes[$hash];