Page MenuHomePhabricator

protectionexpiry.patch

Authored By
bzimport
Nov 21 2014, 10:26 PM
Size
1 KB
Referenced Files
None
Subscribers
None

protectionexpiry.patch

Index: CoreParserFunctions.php
===================================================================
--- CoreParserFunctions.php (revision 64623)
+++ CoreParserFunctions.php (working copy)
@@ -49,6 +49,7 @@
$parser->setFunctionHook( 'pagesincategory', array( __CLASS__, 'pagesincategory' ), SFH_NO_HASH );
$parser->setFunctionHook( 'pagesize', array( __CLASS__, 'pagesize' ), SFH_NO_HASH );
$parser->setFunctionHook( 'protectionlevel', array( __CLASS__, 'protectionlevel' ), SFH_NO_HASH );
+ $parser->setFunctionHook( 'protectionexpiry', array( __CLASS__, 'protectionexpiry' ), SFH_NO_HASH );
$parser->setFunctionHook( 'namespace', array( __CLASS__, 'mwnamespace' ), SFH_NO_HASH );
$parser->setFunctionHook( 'namespacee', array( __CLASS__, 'namespacee' ), SFH_NO_HASH );
$parser->setFunctionHook( 'talkspace', array( __CLASS__, 'talkspace' ), SFH_NO_HASH );
@@ -511,6 +512,21 @@
# multiple values in the future
return implode( $restrictions, ',' );
}
+
+ /**
+ * Returns the requested protection expiry time for the current page
+ * as a 14-character timestamp
+ */
+ static function protectionexpiry ( $parser, $type = '' ) {
+ $expiry = $parser->mTitle->getRestrictionExpiry( strtolower( $type ) );
+
+ // getRestrictionExpiry() returns false on invalid type; trying to
+ // match protectionlevel() function that returns empty string instead
+ if ( $expiry === false) {
+ $expiry = '';
+ }
+ return $expiry;
+ }
static function language( $parser, $arg = '' ) {
global $wgContLang;

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4900
Default Alt Text
protectionexpiry.patch (1 KB)

Event Timeline