global $wgMaxTocLevel, $wgContLang;
$doNumberHeadings = $this->mOptions->getNumberHeadings();
- if( !$this->mTitle->userCanEdit() ) {
+ if( !$this->mTitle->quickUserCanEdit() ) {
$showEditLink = 0;
} else {
$showEditLink = $this->mOptions->getEditSection();
function getKey( &$article, &$user ) {
global $action;
$hash = $user->getPageRenderingHash();
- if( !$article->mTitle->userCanEdit() ) {
+ if( !$article->mTitle->quickUserCanEdit() ) {
// section edit links are suppressed even if the user has them on
$edit = '!edit=0';
} else {
true);
wfProfileIn( "$fname-edit" );
- if ( $this->mTitle->userCanEdit() && ( $this->mTitle->exists() || $this->mTitle->userCanCreate() ) ) {
+ if ( $this->mTitle->quickUserCanEdit() && ( $this->mTitle->exists() || $this->mTitle->userCanCreate( false ) ) ) {
$istalk = $this->mTitle->isTalkPage();
$istalkclass = $istalk?' istalk':'';
$content_actions['edit'] = array(
return $this->mWatched;
}
+ function quickUserCan( $action ) {
+ return $this->userCan( $action, false );
+ }
+
/**
* Can $wgUser perform $action this page?
* @param string $action action that permission needs to be checked for
+ * @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary queries.
* @return boolean
* @private
*/
- function userCan($action) {
+ function userCan( $action, $doExpensiveQueries = true ) {
$fname = 'Title::userCan';
wfProfileIn( $fname );
+ !$doExpensiveQueries or die(wfBacktrace() );
+
global $wgUser, $wgNamespaceProtection;
$result = null;
* @return boolean
* @access public
*/
- function userCanEdit() {
- return $this->userCan('edit');
+ function userCanEdit( $doExpensiveQueries = true ) {
+ return $this->userCan( 'edit', $doExpensiveQueries );
+ }
+
+ function quickUserCanEdit( ) {
+ return $this->userCanEdit( false );
}
/**
* @return boolean
* @access public
*/
- function userCanCreate() {
- return $this->userCan('create');
+ function userCanCreate( $doExpensiveQueries = true ) {
+ return $this->userCan( 'create', $doExpensiveQueries );
}
/**
* @return boolean
* @access public
*/
- function userCanMove() {
- return $this->userCan('move');
+ function userCanMove( $doExpensiveQueries = true ) {
+ return $this->userCan( 'move', $doExpensiveQueries );
}
/**