- if ( $t->equals( $parser->getTitle() ) ) {
- // Let the edit saving system know we should parse the page
- // *after* a revision ID has been assigned.
- $parser->mOutput->setFlag( 'vary-revision' );
- wfDebug( __METHOD__ . ": {{REVISIONID}} used, setting vary-revision...\n" );
- return $parser->getRevisionId();
- }
- if ( isset( $cache[$t->getPrefixedText()] ) )
- return $cache[$t->getPrefixedText()];
- elseif ( $parser->incrementExpensiveFunctionCount() ) {
- $a = new Article( $t );
- return $cache[$t->getPrefixedText()] = $a->getRevIdFetched();
- }
- return '';
- }
- static function revisiontimestamp( $parser, $title = null ) {
- static $cache = array ();
- $t = Title::newFromText( $title );
- if ( is_null( $t ) )
- return '';
- if ( $t->equals( $parser->getTitle() ) ) {
- // Let the edit saving system know we should parse the page
- // *after* a revision ID has been assigned. This is for null edits.
- $parser->mOutput->setFlag( 'vary-revision' );
- wfDebug( __METHOD__ . ": {{REVISIONTIMESTAMP}} or related parser function used, setting vary-revision...\n" );
- return $parser->getRevisionTimestamp();
- }
- if ( isset( $cache[$t->getPrefixedText()] ) )
- return $cache[$t->getPrefixedText()];
- elseif ( $parser->incrementExpensiveFunctionCount() ) {
- $a = new Article( $t );
- return $cache[$t->getPrefixedText()] = $a->getTimestamp();
- }
- return '';
- }
- static function revisionday( $parser, $title = null ) {
- $timestamp = self::revisiontimestamp( $parser, $title );
- if ( $timestamp == '' ) return '';
- return intval( substr( $timestamp, 6, 2 ) );
- }
- static function revisionday2( $parser, $title = null ) {
- $timestamp = self::revisiontimestamp( $parser, $title );
- if ( $timestamp == '' ) return '';
- return substr( $timestamp, 6, 2 );
- }
- static function revisionmonth( $parser, $title = null ) {
- $timestamp = self::revisiontimestamp( $parser, $title );
- if ( $timestamp == '' ) return '';
- return intval( substr( $timestamp, 4, 2 ) );