Index: includes/MagicWord.php =================================================================== --- includes/MagicWord.php (revision 35825) +++ includes/MagicWord.php (working copy) @@ -105,6 +105,7 @@ 'numberofadmins', 'defaultsort', 'pagesincategory', + 'lastedit', ); /* Array of caching hints for ParserCache */ Index: includes/CoreParserFunctions.php =================================================================== --- includes/CoreParserFunctions.php (revision 35825) +++ includes/CoreParserFunctions.php (working copy) @@ -44,6 +44,7 @@ $parser->setFunctionHook( 'pagesincategory', array( __CLASS__, 'pagesincategory' ), SFH_NO_HASH ); $parser->setFunctionHook( 'pagesize', array( __CLASS__, 'pagesize' ), SFH_NO_HASH ); $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS ); + $parser->setFunctionHook( 'lastedit', array( __CLASS__, 'lastedit' ), SFH_NO_HASH ); if ( $wgAllowDisplayTitle ) { $parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH ); @@ -382,4 +383,31 @@ ); return $parser->extensionSubstitution( $params, $frame ); } + + static function lastedit( $parser, $s = '' ) { + static $cache = array(); + + $user = User::newFromName( trim( $s ) ); + if ($user == null) return ''; + $s = $user->getName(); + + if( isset( $cache[$s] ) ) { + $ts = $cache[$s]; + } elseif ( $parser->incrementExpensiveFunctionCount() ) { + $db = wfGetDB( DB_SLAVE ); + $ts = $db->selectField( + 'revision', + 'rev_timestamp', + array( 'rev_user_text' => $s ), + __METHOD__, + array( 'ORDER BY' => 'rev_timestamp DESC' ) + ); + + $cache[$s] = $ts; + } + + if ($ts === false) return ''; + + return wfTimestamp(TS_ISO_8601, $ts); + } } Index: languages/messages/MessagesEn.php =================================================================== --- languages/messages/MessagesEn.php (revision 35825) +++ languages/messages/MessagesEn.php (working copy) @@ -340,6 +340,7 @@ 'hiddencat' => array( 1, '__HIDDENCAT__' ), 'pagesincategory' => array( 1, 'PAGESINCATEGORY', 'PAGESINCAT' ), 'pagesize' => array( 1, 'PAGESIZE' ), + 'lastedit' => array( 0, '#LASTEDIT:' ), ); /**