From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- includes/content/JavaScriptContentHandler.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'includes/content/JavaScriptContentHandler.php') diff --git a/includes/content/JavaScriptContentHandler.php b/includes/content/JavaScriptContentHandler.php index d2218971..65e3a6f0 100644 --- a/includes/content/JavaScriptContentHandler.php +++ b/includes/content/JavaScriptContentHandler.php @@ -41,4 +41,22 @@ class JavaScriptContentHandler extends CodeContentHandler { protected function getContentClass() { return 'JavaScriptContent'; } + + public function supportsRedirects() { + return true; + } + + /** + * Create a redirect that is also valid JavaScript + * + * @param Title $destination + * @param string $text ignored + * @return JavaScriptContent + */ + public function makeRedirectContent( Title $destination, $text = '' ) { + // The parameters are passed as a string so the / is not url-encoded by wfArrayToCgi + $url = $destination->getFullURL( 'action=raw&ctype=text/javascript', false, PROTO_RELATIVE ); + $class = $this->getContentClass(); + return new $class( '/* #REDIRECT */' . Xml::encodeJsCall( 'mw.loader.load', array( $url ) ) ); + } } -- cgit v1.2.2