Add wgIsProbablyEditable for editability based on quickUserCan.
authorMatthew Flaschen <mflaschen@wikimedia.org>
Thu, 23 May 2013 04:31:11 +0000 (00:31 -0400)
committerTim Starling <tstarling@wikimedia.org>
Thu, 4 Jul 2013 05:18:49 +0000 (05:18 +0000)
It uses quickUserCan like SkinTemplate, for performance reasons.

Bug: 43790
Change-Id: I2f77b69624cc1a4cd74c8178eea53681f3f2b107

includes/OutputPage.php

index 96a503e..96c7830 100644 (file)
@@ -3051,6 +3051,8 @@ $templates
                if ( $wgContLang->hasVariants() ) {
                        $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
                }
+               // Same test as SkinTemplate
+               $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
                foreach ( $title->getRestrictionTypes() as $type ) {
                        $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
                }