=== Configuration changes in 1.12 ===
-=== Removed features in 1.12 ===
-* {{REVISIONID}} will no longer give the correct revision ID for current revision
- views. It will still work for history views.
-
=== New features in 1.12 ===
* (bug 10735) Add a warning for non-descriptive filenames at Special:Upload
* Add {{filepath:}} parser function to get full path to an uploaded file,
* Prepare text which is about to be saved.
* Returns a stdclass with source, pst and output members
*/
- function prepareTextForEdit( $text ) {
- if ( $this->mPreparedEdit && $this->mPreparedEdit->newText == $text ) {
+ function prepareTextForEdit( $text, $revid=null ) {
+ if ( $this->mPreparedEdit && $this->mPreparedEdit->newText == $text && $this->mPreparedEdit->revid == $revid) {
// Already prepared
return $this->mPreparedEdit;
}
global $wgParser;
$edit = (object)array();
+ $edit->revid = $revid;
$edit->newText = $text;
$edit->pst = $this->preSaveTransform( $text );
$options = new ParserOptions;
$options->setTidy( true );
- $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true );
+ $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true, $revid );
$edit->oldText = $this->getContent();
$this->mPreparedEdit = $edit;
return $edit;
# Parse the text
# Be careful not to double-PST: $text is usually already PST-ed once
- if ( !$this->mPreparedEdit ) {
- $editInfo = $this->prepareTextForEdit( $text );
+ if ( !$this->mPreparedEdit || $this->mPreparedEdit->output->getFlag( 'vary-revision' ) ) {
+ wfDebug( __METHOD__ . ": No prepared edit or vary-revision is set...\n" );
+ $editInfo = $this->prepareTextForEdit( $text, $newid );
} else {
+ wfDebug( __METHOD__ . ": No vary-revision, using prepared edit...\n" );
$editInfo = $this->mPreparedEdit;
}
$subjPage = $this->mTitle->getSubjectPage();
return $subjPage->getPrefixedUrl();
case 'revisionid':
+ // Let the edit saving system know we should parse the page
+ // *after* a revision ID has been assigned.
+ $this->mOutput->setFlag( 'vary-revision' );
+ wfDebug( __METHOD__ . ": {{REVISIONID}} used, setting vary-revision...\n" );
return $this->mRevisionId;
case 'revisionday':
return intval( substr( $this->getRevisionTimestamp(), 6, 2 ) );
return $this->displayTitle;
}
+ /**
+ * Fairly generic flag setter thingy.
+ */
+ public function setFlag( $flag ) {
+ $this->mFlags[$flag] = true;
+ }
+
+ public function getFlag( $flag ) {
+ return isset( $this->mFlags[$flag] );
+ }
+
}