Index: trunk/phase3/includes/ParserOutput.php |
— | — | @@ -165,6 +165,17 @@ |
166 | 166 | return $this->displayTitle; |
167 | 167 | } |
168 | 168 | |
| 169 | + /** |
| 170 | + * Fairly generic flag setter thingy. |
| 171 | + */ |
| 172 | + public function setFlag( $flag ) { |
| 173 | + $this->mFlags[$flag] = true; |
| 174 | + } |
| 175 | + |
| 176 | + public function getFlag( $flag ) { |
| 177 | + return isset( $this->mFlags[$flag] ); |
| 178 | + } |
| 179 | + |
169 | 180 | } |
170 | 181 | |
171 | 182 | |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -2425,18 +2425,19 @@ |
2426 | 2426 | * Prepare text which is about to be saved. |
2427 | 2427 | * Returns a stdclass with source, pst and output members |
2428 | 2428 | */ |
2429 | | - function prepareTextForEdit( $text ) { |
2430 | | - if ( $this->mPreparedEdit && $this->mPreparedEdit->newText == $text ) { |
| 2429 | + function prepareTextForEdit( $text, $revid=null ) { |
| 2430 | + if ( $this->mPreparedEdit && $this->mPreparedEdit->newText == $text && $this->mPreparedEdit->revid == $revid) { |
2431 | 2431 | // Already prepared |
2432 | 2432 | return $this->mPreparedEdit; |
2433 | 2433 | } |
2434 | 2434 | global $wgParser; |
2435 | 2435 | $edit = (object)array(); |
| 2436 | + $edit->revid = $revid; |
2436 | 2437 | $edit->newText = $text; |
2437 | 2438 | $edit->pst = $this->preSaveTransform( $text ); |
2438 | 2439 | $options = new ParserOptions; |
2439 | 2440 | $options->setTidy( true ); |
2440 | | - $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true ); |
| 2441 | + $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true, $revid ); |
2441 | 2442 | $edit->oldText = $this->getContent(); |
2442 | 2443 | $this->mPreparedEdit = $edit; |
2443 | 2444 | return $edit; |
— | — | @@ -2462,9 +2463,11 @@ |
2463 | 2464 | |
2464 | 2465 | # Parse the text |
2465 | 2466 | # Be careful not to double-PST: $text is usually already PST-ed once |
2466 | | - if ( !$this->mPreparedEdit ) { |
2467 | | - $editInfo = $this->prepareTextForEdit( $text ); |
| 2467 | + if ( !$this->mPreparedEdit || $this->mPreparedEdit->output->getFlag( 'vary-revision' ) ) { |
| 2468 | + wfDebug( __METHOD__ . ": No prepared edit or vary-revision is set...\n" ); |
| 2469 | + $editInfo = $this->prepareTextForEdit( $text, $newid ); |
2468 | 2470 | } else { |
| 2471 | + wfDebug( __METHOD__ . ": No vary-revision, using prepared edit...\n" ); |
2469 | 2472 | $editInfo = $this->mPreparedEdit; |
2470 | 2473 | } |
2471 | 2474 | |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -2528,6 +2528,10 @@ |
2529 | 2529 | $subjPage = $this->mTitle->getSubjectPage(); |
2530 | 2530 | return $subjPage->getPrefixedUrl(); |
2531 | 2531 | case 'revisionid': |
| 2532 | + // Let the edit saving system know we should parse the page |
| 2533 | + // *after* a revision ID has been assigned. |
| 2534 | + $this->mOutput->setFlag( 'vary-revision' ); |
| 2535 | + wfDebug( __METHOD__ . ": {{REVISIONID}} used, setting vary-revision...\n" ); |
2532 | 2536 | return $this->mRevisionId; |
2533 | 2537 | case 'revisionday': |
2534 | 2538 | return intval( substr( $this->getRevisionTimestamp(), 6, 2 ) ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -20,10 +20,6 @@ |
21 | 21 | |
22 | 22 | === Configuration changes in 1.12 === |
23 | 23 | |
24 | | -=== Removed features in 1.12 === |
25 | | -* {{REVISIONID}} will no longer give the correct revision ID for current revision |
26 | | - views. It will still work for history views. |
27 | | - |
28 | 24 | === New features in 1.12 === |
29 | 25 | * (bug 10735) Add a warning for non-descriptive filenames at Special:Upload |
30 | 26 | * Add {{filepath:}} parser function to get full path to an uploaded file, |