IS NULL
* (bug 18018) Deleting a file redirect leaves behind a malfunctioning redirect
* (bug 17537) Disable bad zlib.output_compression output on HTTP 304 responses
+* (bug 11213) [edit] section links in printable version no longer appear when you cut-and-paste article text
== API changes in 1.15 ==
* (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
global $wgDefaultRobotPolicy;
+ # Let the parser know if this is the printable version
+ if( $wgOut->isPrintable() ) {
+ $wgOut->parserOptions()->setIsPrintable( true );
+ }
+
wfProfileIn( __METHOD__ );
# Get variables from query string
global $wgUseETag;
if( $wgUseETag ) {
$parserCache = ParserCache::singleton();
- $wgOut->setETag( $parserCache->getETag($this,$wgUser) );
+ $wgOut->setETag( $parserCache->getETag($this, $wgOut->parserOptions()) );
}
# Is is client cached?
if( $wgOut->checkLastModified( $this->getTouched() ) ) {
$outputDone = false;
wfRunHooks( 'ArticleViewHeader', array( &$this, &$outputDone, &$pcache ) );
- if( $pcache && $wgOut->tryParserCache( $this, $wgUser ) ) {
+ if( $pcache && $wgOut->tryParserCache( $this ) ) {
// Ensure that UI elements requiring revision ID have
// the correct version information.
$wgOut->setRevisionId( $this->mLatest );
}
// Is this the current revision and otherwise cacheable? Try the parser cache...
if( $oldid === $this->getLatest() && $this->useParserCache( false )
- && $wgOut->tryParserCache( $this, $wgUser ) )
+ && $wgOut->tryParserCache( $this ) )
{
$outputDone = true;
}
# Save it to the parser cache
if( $wgEnableParserCache ) {
+ $popts = new ParserOptions;
+ $popts->setTidy( true );
+ $popts->enableLimitReport();
$parserCache = ParserCache::singleton();
- $parserCache->save( $editInfo->output, $this, $wgUser );
+ $parserCache->save( $editInfo->output, $this, $popts );
}
# Update the links tables
$popts->enableLimitReport( false );
if( $wgEnableParserCache && $cache && $this && $parserOutput->getCacheTime() != -1 ) {
$parserCache = ParserCache::singleton();
- $parserCache->save( $parserOutput, $this, $wgUser );
+ $parserCache->save( $parserOutput, $this, $popts );
}
// Make sure file cache is not used on uncacheable content.
// Output that has magic words in it can still use the parser cache
$popts->setTidy(false);
if ( $cache && $article && $parserOutput->getCacheTime() != -1 ) {
$parserCache = ParserCache::singleton();
- $parserCache->save( $parserOutput, $article, $wgUser );
+ $parserCache->save( $parserOutput, $article, $popts);
}
$this->addParserOutput( $parserOutput );
*
* @return bool True if successful, else false.
*/
- public function tryParserCache( &$article, $user ) {
+ public function tryParserCache( &$article ) {
$parserCache = ParserCache::singleton();
- $parserOutput = $parserCache->get( $article, $user );
+ $parserOutput = $parserCache->get( $article, $this->parserOptions() );
if ( $parserOutput !== false ) {
$this->addParserOutput( $parserOutput );
return true;
$p_result = $wgParser->parse($articleObj->getContent(), $titleObj, $popts);
global $wgUseParserCache;
if($wgUseParserCache)
- $pcache->save($p_result, $articleObj, $wgUser);
+ $pcache->save($p_result, $articleObj, $popts);
}
}
}
}
# Inhibit editsection links if requested in the page
- if ( isset( $this->mDoubleUnderscores['noeditsection'] ) ) {
+ if ( isset( $this->mDoubleUnderscores['noeditsection'] ) || $this->mOptions->getIsPrintable() ) {
$showEditLink = 0;
}
$this->mMemc =& $memCached;
}
- function getKey( &$article, &$user ) {
- global $action;
+ function getKey( &$article, $popts ) {
+ global $wgRequest;
+
+ $user = $popts->mUser;
+ $printable = ( $popts->getIsPrintable() ) ? '!printable=1' : '';
$hash = $user->getPageRenderingHash();
if( !$article->mTitle->quickUserCan( 'edit' ) ) {
// section edit links are suppressed even if the user has them on
$edit = '';
}
$pageid = $article->getID();
- $renderkey = (int)($action == 'render');
- $key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}{$edit}" );
+ $renderkey = (int)($wgRequest->getVal('action') == 'render');
+ $key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}{$edit}{$printable}" );
return $key;
}
- function getETag( &$article, &$user ) {
- return 'W/"' . $this->getKey($article, $user) . "--" . $article->mTouched. '"';
+ function getETag( &$article, $popts ) {
+ return 'W/"' . $this->getKey($article, $popts) . "--" . $article->mTouched. '"';
}
- function get( &$article, &$user ) {
+ function get( &$article, $popts ) {
global $wgCacheEpoch;
$fname = 'ParserCache::get';
wfProfileIn( $fname );
- $key = $this->getKey( $article, $user );
+ $key = $this->getKey( $article, $popts );
wfDebug( "Trying parser cache $key\n" );
$value = $this->mMemc->get( $key );
return $value;
}
- function save( $parserOutput, &$article, &$user ){
+ function save( $parserOutput, &$article, $popts ){
global $wgParserCacheExpireTime;
- $key = $this->getKey( $article, $user );
+ $key = $this->getKey( $article, $popts );
if( $parserOutput->getCacheTime() != -1 ) {
var $mUser; # Stored user object, just used to initialise the skin
var $mIsPreview; # Parsing the page for a "preview" operation
var $mIsSectionPreview; # Parsing the page for a "preview" operation on a single section
-
+ var $mIsPrintable; # Parsing the printable version of the page
+
function getUseTeX() { return $this->mUseTeX; }
function getUseDynamicDates() { return $this->mUseDynamicDates; }
function getInterwikiMagic() { return $this->mInterwikiMagic; }
function getExternalLinkTarget() { return $this->mExternalLinkTarget; }
function getIsPreview() { return $this->mIsPreview; }
function getIsSectionPreview() { return $this->mIsSectionPreview; }
-
+ function getIsPrintable() { return $this->mIsPrintable; }
+
function getSkin() {
if ( !isset( $this->mSkin ) ) {
$this->mSkin = $this->mUser->getSkin();
function setExternalLinkTarget( $x ) { return wfSetVar( $this->mExternalLinkTarget, $x ); }
function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); }
function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); }
-
+ function setIsPrintable( $x ) { return wfSetVar( $this->mIsPrintable, $x ); }
+
function __construct( $user = null ) {
$this->initialiseFromUser( $user );
}