Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/226718

Change subject: Re-restrict the Scribunto content handler to NS_MODULE
......................................................................

Re-restrict the Scribunto content handler to NS_MODULE

I94ae07bc arbitrarily removed this restriction, which seems liable to
result in confusion where non-Module-namespace pages can be marked as
modules but can't be #invoked.

Change-Id: Ia80f49d14b1f5cded0d3f5bffb6b450fb26cd986
---
M common/ScribuntoContentHandler.php
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/18/226718/1

diff --git a/common/ScribuntoContentHandler.php 
b/common/ScribuntoContentHandler.php
index 1df4913..a9ff487 100644
--- a/common/ScribuntoContentHandler.php
+++ b/common/ScribuntoContentHandler.php
@@ -73,4 +73,17 @@
        public function getPageViewLanguage( Title $title, Content $content = 
null ) {
                return wfGetLangObj( 'en' );
        }
+
+       /**
+        * Only allow this content handler to be used in the Module namespace
+        * @param Title $title
+        * @return bool
+        */
+       public function canBeUsedOn( Title $title ) {
+               if ( $title->getNamespace() !== NS_MODULE ) {
+                       return false;
+               }
+
+               return parent::canBeUsedOn( $title );
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/226718
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia80f49d14b1f5cded0d3f5bffb6b450fb26cd986
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to