update all core usage of deprecated Title::userCanRead()
authorRobin Pepermans <robin@users.mediawiki.org>
Tue, 13 Dec 2011 11:05:30 +0000 (11:05 +0000)
committerRobin Pepermans <robin@users.mediawiki.org>
Tue, 13 Dec 2011 11:05:30 +0000 (11:05 +0000)
img_auth.php
includes/EditPage.php
includes/OutputPage.php
includes/api/ApiQuery.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryRevisions.php
includes/specials/SpecialExport.php
thumb.php

index 8b12181..968a60e 100644 (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;
        }
index 7b2355a..52831dd 100644 (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 );
index 5d17ec1..4495714 100644 (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 {
index b3be027..4ac98a3 100644 (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;
                                }
                        }
index f344229..f0d0faa 100644 (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'] = '';
                }
 
index dcadc41..7323d29 100644 (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' );
index ae7d865..814d204 100644 (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.
                        }
 
index f9b58b9..74cc711 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -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__ );