update all core usage of deprecated Title::userCanRead()

This commit is contained in:
Robin Pepermans 2011-12-13 11:05:30 +00:00
parent 3ad16ebc9e
commit be2de16942
8 changed files with 9 additions and 9 deletions

View file

@ -116,8 +116,8 @@ function wfImageAuthMain() {
}
// Check user authorization for this title
// UserCanRead Checks Whitelist too
if ( !$title->userCanRead() ) {
// Checks Whitelist too
if ( !$title->userCan( 'read' ) ) {
wfForbidden( 'img-auth-accessdenied', 'img-auth-noread', $name );
return;
}

View file

@ -1534,7 +1534,7 @@ class EditPage {
protected function showCustomIntro() {
if ( $this->editintro ) {
$title = Title::newFromText( $this->editintro );
if ( $title instanceof Title && $title->exists() && $title->userCanRead() ) {
if ( $title instanceof Title && $title->exists() && $title->userCan( 'read' ) ) {
global $wgOut;
// Added using template syntax, to take <noinclude>'s into account.
$wgOut->addWikiTextTitleTidy( '{{:' . $title->getFullText() . '}}', $this->mTitle );

View file

@ -2112,7 +2112,7 @@ class OutputPage extends ContextSource {
# Don't return to a page the user can't read otherwise
# we'll end up in a pointless loop
if ( $displayReturnto && $displayReturnto->userCanRead() ) {
if ( $displayReturnto && $displayReturnto->userCan( 'read' ) ) {
$this->returnToMain( null, $displayReturnto );
}
} else {

View file

@ -483,7 +483,7 @@ class ApiQuery extends ApiBase {
$titles = $pageSet->getGoodTitles();
if ( count( $titles ) ) {
foreach ( $titles as $title ) {
if ( $title->userCanRead() ) {
if ( $title->userCan( 'read' ) ) {
$exportTitles[] = $title;
}
}

View file

@ -378,7 +378,7 @@ class ApiQueryInfo extends ApiQueryBase {
$pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
$pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT );
}
if ( $this->fld_readable && $title->userCanRead() ) {
if ( $this->fld_readable && $title->userCan( 'read' ) ) {
$pageInfo['readable'] = '';
}

View file

@ -191,7 +191,7 @@ class ApiQueryRevisions extends ApiQueryBase {
if ( isset( $prop['content'] ) || !is_null( $this->difftotext ) ) {
// For each page we will request, the user must have read rights for that page
foreach ( $pageSet->getGoodTitles() as $title ) {
if ( !$title->userCanRead() ) {
if ( !$title->userCan( 'read' ) ) {
$this->dieUsage(
'The current user is not allowed to read ' . $title->getPrefixedText(),
'accessdenied' );

View file

@ -326,7 +326,7 @@ class SpecialExport extends SpecialPage {
if( is_null( $title ) ) {
continue; #TODO: perhaps output an <error> tag or something.
}
if( !$title->userCanRead() ) {
if( !$title->userCan( 'read' ) ) {
continue; #TODO: perhaps output an <error> tag or something.
}

View file

@ -118,7 +118,7 @@ function wfStreamThumb( array $params ) {
// Check permissions if there are read restrictions
if ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) {
if ( !$img->getTitle()->userCanRead() ) {
if ( !$img->getTitle()->userCan( 'read' ) ) {
wfThumbError( 403, 'Access denied. You do not have permission to access ' .
'the source file.' );
wfProfileOut( __METHOD__ );