Introduce wgRelevantPageIsProbablyEditable
authorJames D. Forrester <jforrester@wikimedia.org>
Mon, 15 May 2017 10:12:44 +0000 (11:12 +0100)
committerJforrester <jforrester@wikimedia.org>
Thu, 18 May 2017 15:29:18 +0000 (15:29 +0000)
This is equivalent to the existing variable wgIsProbablyEditable and in
keeping with wgRelevantPageName/wgRelevantArticleId; this is done as an
alternative to making a breaking change to the semantics of the former,
as that might cause issues for users who expect wgIsProbablyEditable to
return true on [[Foo]], but false on [[Special:Move/Foo]] and similar.

Change-Id: I6c6ca1cfd93e7be917952980f1e1d57aec3a1292

includes/OutputPage.php

index 85610b9..bab52a3 100644 (file)
@@ -3221,6 +3221,10 @@ class OutputPage extends ContextSource {
                $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user )
                        && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
 
+               $vars['wgRelevantPageIsProbablyEditable'] = $relevantTitle
+                       && $relevantTitle->quickUserCan( 'edit', $user )
+                       && ( $relevantTitle->exists() || $relevantTitle->quickUserCan( 'create', $user ) );
+
                foreach ( $title->getRestrictionTypes() as $type ) {
                        $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
                }