Index: trunk/extensions/FlaggedRevs/maintenance/cachePendingRevs.php |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | $rev = new Revision( $row ); |
41 | 41 | // Trigger cache regeneration |
42 | 42 | $start = microtime( true ); |
43 | | - RevisionReviewForm::getRevIncludes( $article, $rev, $wgUser, 'regen' ); |
| 43 | + FRInclusionCache::getRevIncludes( $article, $rev, $wgUser, 'regen' ); |
44 | 44 | $elapsed = intval( ( microtime( true ) - $start ) * 1000 ); |
45 | 45 | $this->cachePendingRevsLog( |
46 | 46 | $title->getPrefixedDBkey() . " rev:" . $rev->getId() . " {$elapsed}ms" ); |
Index: trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php |
— | — | @@ -575,91 +575,4 @@ |
576 | 576 | } |
577 | 577 | return array( $templateIds, $fileSHA1Keys ); |
578 | 578 | } |
579 | | - |
580 | | - /** |
581 | | - * Get template and image versions from parsing a revision |
582 | | - * @param Article $article |
583 | | - * @param Revision $rev |
584 | | - * @param User $user |
585 | | - * @param string $regen use 'regen' to force regeneration |
586 | | - * @return array( templateIds, fileSHA1Keys ) |
587 | | - * templateIds like ParserOutput->mTemplateIds |
588 | | - * fileSHA1Keys like ParserOutput->mImageTimeKeys |
589 | | - */ |
590 | | - public static function getRevIncludes( |
591 | | - Article $article, Revision $rev, User $user, $regen = '' |
592 | | - ) { |
593 | | - global $wgParser, $wgMemc; |
594 | | - wfProfileIn( __METHOD__ ); |
595 | | - $versions = false; |
596 | | - $hash = md5( $article->getTitle()->getPrefixedDBkey() ); |
597 | | - $key = wfMemcKey( 'flaggedrevs', 'revIncludes', $rev->getId(), $hash ); |
598 | | - if ( $regen !== 'regen' ) { // check cache |
599 | | - $versions = FlaggedRevs::getMemcValue( $wgMemc->get( $key ), $article, 'allowStale' ); |
600 | | - } |
601 | | - if ( !is_array( $versions ) ) { // cache miss |
602 | | - $pOut = false; |
603 | | - if ( $rev->isCurrent() ) { |
604 | | - $parserCache = ParserCache::singleton(); |
605 | | - # Try current version parser cache (as anon)... |
606 | | - $pOut = $parserCache->get( $article, $article->makeParserOptions( $user ) ); |
607 | | - if ( $pOut == false && $rev->getUser() ) { // try the user who saved the change |
608 | | - $author = User::newFromId( $rev->getUser() ); |
609 | | - $pOut = $parserCache->get( $article, $article->makeParserOptions( $author ) ); |
610 | | - } |
611 | | - } |
612 | | - if ( $pOut == false ) { |
613 | | - $title = $article->getTitle(); |
614 | | - $pOpts = ParserOptions::newFromUser( $user ); // Note: tidy off |
615 | | - # Disable slow crap that doesn't matter for getting templates/files... |
616 | | - $parser = clone $wgParser; |
617 | | - $parser->clearTagHook( 'ref' ); |
618 | | - $parser->clearTagHook( 'references' ); |
619 | | - $pOut = $parser->parse( |
620 | | - $rev->getText(), $title, $pOpts, true, true, $rev->getId() ); |
621 | | - } |
622 | | - # Get the template/file versions used... |
623 | | - $versions = array( $pOut->getTemplateIds(), $pOut->getImageTimeKeys() ); |
624 | | - # Save to cache... |
625 | | - $data = FlaggedRevs::makeMemcObj( $versions ); |
626 | | - $wgMemc->set( $key, $data, 24*3600 ); // inclusions may be dynamic |
627 | | - } else { |
628 | | - # Do a link batch query for page_latest... |
629 | | - $lb = new LinkBatch(); |
630 | | - foreach ( $versions as $ns => $tmps ) { |
631 | | - foreach ( $tmps as $dbKey => $revIdDraft ) { |
632 | | - $lb->add( $ns, $dbKey ); |
633 | | - } |
634 | | - } |
635 | | - $lb->execute(); |
636 | | - # Update array with the current page_latest values. |
637 | | - # This kludge is there since $newTemplates (thus $revIdDraft) is cached. |
638 | | - foreach ( $versions as $ns => $tmps ) { |
639 | | - foreach ( $tmps as $dbKey => &$revIdDraft ) { |
640 | | - $title = new Title( $ns, $dbKey ); |
641 | | - $revIdDraft = (int)$title->getLatestRevID(); |
642 | | - } |
643 | | - } |
644 | | - } |
645 | | - wfProfileOut( __METHOD__ ); |
646 | | - return $versions; |
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 | | - } |
666 | 579 | } |