Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5339
protectionexpiry.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
bzimport
Nov 21 2014, 10:26 PM
2014-11-21 22:26:29 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
protectionexpiry.patch
View Options
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
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4900
Default Alt Text
protectionexpiry.patch (1 KB)
Attached To
Mode
T19354: Magic word returning protection expiry
Attached
Detach File
Event Timeline
Log In to Comment