Index: trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php |
— | — | @@ -577,7 +577,7 @@ |
578 | 578 | } |
579 | 579 | |
580 | 580 | /** |
581 | | - * Get template and image versions from parsing a revision. |
| 581 | + * Get template and image versions from parsing a revision |
582 | 582 | * @param Article $article |
583 | 583 | * @param Revision $rev |
584 | 584 | * @param User $user |
— | — | @@ -593,9 +593,8 @@ |
594 | 594 | wfProfileIn( __METHOD__ ); |
595 | 595 | $versions = false; |
596 | 596 | $hash = md5( $article->getTitle()->getPrefixedDBkey() ); |
597 | | - # Check process cache first... |
598 | 597 | $key = wfMemcKey( 'flaggedrevs', 'revIncludes', $rev->getId(), $hash ); |
599 | | - if ( $regen !== 'regen' ) { |
| 598 | + if ( $regen !== 'regen' ) { // check cache |
600 | 599 | $versions = FlaggedRevs::getMemcValue( $wgMemc->get( $key ), $article, 'allowStale' ); |
601 | 600 | } |
602 | 601 | if ( !is_array( $versions ) ) { // cache miss |
— | — | @@ -645,4 +644,22 @@ |
646 | 645 | wfProfileOut( __METHOD__ ); |
647 | 646 | return $versions; |
648 | 647 | } |
| 648 | + |
| 649 | + /** |
| 650 | + * Set template and image versions from parsing a revision |
| 651 | + * @param Title $title |
| 652 | + * @param int $revId |
| 653 | + * @param ParserOutput $rev |
| 654 | + * @return void |
| 655 | + */ |
| 656 | + public static function setRevIncludes( Title $title, $revId, ParserOutput $pOut ) { |
| 657 | + global $wgMemc; |
| 658 | + $hash = md5( $title->getPrefixedDBkey() ); |
| 659 | + $key = wfMemcKey( 'flaggedrevs', 'revIncludes', $revId, $hash ); |
| 660 | + # Get the template/file versions used... |
| 661 | + $versions = array( $pOut->getTemplateIds(), $pOut->getImageTimeKeys() ); |
| 662 | + # Save to cache... |
| 663 | + $data = FlaggedRevs::makeMemcObj( $versions ); |
| 664 | + $wgMemc->set( $key, $data, 24*3600 ); // inclusions may be dynamic |
| 665 | + } |
649 | 666 | } |