Index: trunk/phase3/includes/Article.php |
— | — | @@ -826,7 +826,7 @@ |
827 | 827 | */ |
828 | 828 | public function view() { |
829 | 829 | global $wgUser, $wgOut, $wgRequest, $wgParser; |
830 | | - global $wgUseFileCache; |
| 830 | + global $wgUseFileCache, $wgUseETag; |
831 | 831 | |
832 | 832 | wfProfileIn( __METHOD__ ); |
833 | 833 | |
— | — | @@ -838,12 +838,13 @@ |
839 | 839 | # Render printable version, use printable version cache |
840 | 840 | if ( $wgOut->isPrintable() ) { |
841 | 841 | $parserOptions->setIsPrintable( true ); |
| 842 | + $parserOptions->setEditSection( false ); |
| 843 | + } else if ( $wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) { |
| 844 | + $parserOptions->setEditSection( false ); |
842 | 845 | } |
843 | 846 | |
844 | 847 | # Try client and file cache |
845 | 848 | if ( $oldid === 0 && $this->checkTouched() ) { |
846 | | - global $wgUseETag; |
847 | | - |
848 | 849 | if ( $wgUseETag ) { |
849 | 850 | $wgOut->setETag( $parserCache->getETag( $this, $parserOptions ) ); |
850 | 851 | } |
— | — | @@ -888,6 +889,10 @@ |
889 | 890 | return; |
890 | 891 | } |
891 | 892 | |
| 893 | + if ( !$wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) { |
| 894 | + $parserOptions->setEditSection( false ); |
| 895 | + } |
| 896 | + |
892 | 897 | # Should the parser cache be used? |
893 | 898 | $useParserCache = $this->useParserCache( $oldid ); |
894 | 899 | wfDebug( 'Article::view using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" ); |
— | — | @@ -1471,7 +1476,10 @@ |
1472 | 1477 | $parserOptions->setIsPrintable( $wgOut->isPrintable() ); |
1473 | 1478 | |
1474 | 1479 | # Don't show section-edit links on old revisions... this way lies madness. |
1475 | | - $parserOptions->setEditSection( $this->isCurrent() ); |
| 1480 | + if ( !$this->isCurrent() || $wgOut->isPrintable() ) { |
| 1481 | + $parserOptions->setEditSection( false ); |
| 1482 | + } |
| 1483 | + |
1476 | 1484 | $useParserCache = $this->useParserCache( $oldid ); |
1477 | 1485 | $this->outputWikiText( $this->getContent(), $useParserCache, $parserOptions ); |
1478 | 1486 | } |
— | — | @@ -1489,7 +1497,12 @@ |
1490 | 1498 | global $wgOut; |
1491 | 1499 | $parserCache = ParserCache::singleton(); |
1492 | 1500 | $options = $this->getParserOptions(); |
1493 | | - $options->setIsPrintable( $wgOut->isPrintable() ); |
| 1501 | + |
| 1502 | + if ( $wgOut->isPrintable() ) { |
| 1503 | + $options->setIsPrintable( true ); |
| 1504 | + $parserOptions->setEditSection( false ); |
| 1505 | + } |
| 1506 | + |
1494 | 1507 | $output = $parserCache->getDirty( $this, $options ); |
1495 | 1508 | |
1496 | 1509 | if ( $output ) { |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3700,7 +3700,7 @@ |
3701 | 3701 | global $wgMaxTocLevel, $wgContLang, $wgHtml5, $wgExperimentalHtmlIds; |
3702 | 3702 | |
3703 | 3703 | $doNumberHeadings = $this->mOptions->getNumberHeadings(); |
3704 | | - $showEditLink = $this->mOptions->getEditSection(); |
| 3704 | + |
3705 | 3705 | |
3706 | 3706 | # Do not call quickUserCan unless necessary |
3707 | 3707 | if ( $showEditLink && !$this->mTitle->quickUserCan( 'edit' ) ) { |
— | — | @@ -3708,8 +3708,10 @@ |
3709 | 3709 | } |
3710 | 3710 | |
3711 | 3711 | # Inhibit editsection links if requested in the page |
3712 | | - if ( isset( $this->mDoubleUnderscores['noeditsection'] ) || $this->mOptions->getIsPrintable() ) { |
| 3712 | + if ( isset( $this->mDoubleUnderscores['noeditsection'] ) ) { |
3713 | 3713 | $showEditLink = 0; |
| 3714 | + } else { |
| 3715 | + $showEditLink = $this->mOptions->getEditSection(); |
3714 | 3716 | } |
3715 | 3717 | |
3716 | 3718 | # Get all headlines for numbering them and adding funky stuff like [edit] |
Index: trunk/phase3/includes/parser/ParserCache.php |
— | — | @@ -41,8 +41,9 @@ |
42 | 42 | $user = $popts->mUser; |
43 | 43 | $printable = ( $popts->getIsPrintable() ) ? '!printable=1' : ''; |
44 | 44 | $hash = $user->getPageRenderingHash(); |
45 | | - if( !$article->mTitle->quickUserCan( 'edit' ) ) { |
46 | | - // section edit links are suppressed even if the user has them on |
| 45 | + |
| 46 | + if( ! $popts->getEditSection() ) { |
| 47 | + // section edit links have been suppressed |
47 | 48 | $edit = '!edit=0'; |
48 | 49 | } else { |
49 | 50 | $edit = ''; |
Index: trunk/phase3/includes/parser/ParserOptions.php |
— | — | @@ -165,6 +165,7 @@ |
166 | 166 | $this->mExternalLinkTarget = $wgExternalLinkTarget; |
167 | 167 | $this->mIsPreview = false; |
168 | 168 | $this->mIsSectionPreview = false; |
| 169 | + $this->mIsPrintable = false; |
169 | 170 | |
170 | 171 | wfProfileOut( __METHOD__ ); |
171 | 172 | } |