*/
public function view() {
global $wgUser, $wgOut, $wgRequest, $wgParser;
- global $wgUseFileCache;
+ global $wgUseFileCache, $wgUseETag;
wfProfileIn( __METHOD__ );
# Render printable version, use printable version cache
if ( $wgOut->isPrintable() ) {
$parserOptions->setIsPrintable( true );
+ $parserOptions->setEditSection( false );
+ } else if ( $wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) {
+ $parserOptions->setEditSection( false );
}
# Try client and file cache
if ( $oldid === 0 && $this->checkTouched() ) {
- global $wgUseETag;
-
if ( $wgUseETag ) {
$wgOut->setETag( $parserCache->getETag( $this, $parserOptions ) );
}
return;
}
+ if ( !$wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) {
+ $parserOptions->setEditSection( false );
+ }
+
# Should the parser cache be used?
$useParserCache = $this->useParserCache( $oldid );
wfDebug( 'Article::view using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
$parserOptions->setIsPrintable( $wgOut->isPrintable() );
# Don't show section-edit links on old revisions... this way lies madness.
- $parserOptions->setEditSection( $this->isCurrent() );
+ if ( !$this->isCurrent() || $wgOut->isPrintable() ) {
+ $parserOptions->setEditSection( false );
+ }
+
$useParserCache = $this->useParserCache( $oldid );
$this->outputWikiText( $this->getContent(), $useParserCache, $parserOptions );
}
global $wgOut;
$parserCache = ParserCache::singleton();
$options = $this->getParserOptions();
- $options->setIsPrintable( $wgOut->isPrintable() );
+
+ if ( $wgOut->isPrintable() ) {
+ $options->setIsPrintable( true );
+ $parserOptions->setEditSection( false );
+ }
+
$output = $parserCache->getDirty( $this, $options );
if ( $output ) {
global $wgMaxTocLevel, $wgContLang, $wgHtml5, $wgExperimentalHtmlIds;
$doNumberHeadings = $this->mOptions->getNumberHeadings();
- $showEditLink = $this->mOptions->getEditSection();
+
# Do not call quickUserCan unless necessary
if ( $showEditLink && !$this->mTitle->quickUserCan( 'edit' ) ) {
}
# Inhibit editsection links if requested in the page
- if ( isset( $this->mDoubleUnderscores['noeditsection'] ) || $this->mOptions->getIsPrintable() ) {
+ if ( isset( $this->mDoubleUnderscores['noeditsection'] ) ) {
$showEditLink = 0;
+ } else {
+ $showEditLink = $this->mOptions->getEditSection();
}
# Get all headlines for numbering them and adding funky stuff like [edit]