Jump to content

Manual talk:$wgEnableScaryTranscluding

Add topic
From mediawiki.org
Latest comment: 9 years ago by Nemo bis in topic MITRE uses

Transcluding from Wikimedia projects

[edit]

I can't get these to work at all. I'm using MediaWiki 1.9.3 with PHP 5.2.1. Whenever I try to include an external template, I get an error message that looks like this:

[Template fetch failed for w:en:Template:User_en?action=render; sorry]

I don't think I'm the only person with this problem. I've googled the phrase "Template fetch failed for" and have found several other wikis with this problem as well. The setup for this feature is so simple and so straightforward -- I can't imagine how I could be doing it wrong. - Big Brother 1984 08:24, 11 April 2007 (UTC)Reply

Alter the interwiki table and change the URL for Wikipedia (assuming the above example) to http://en.wikipedia.org/w/index.php?title=$1; I recall some problems with the rewritten form. There should also be some more on this in the mediawiki-l mailing list archives. robchurch | talk 08:30, 11 April 2007 (UTC)Reply
Changing the URL for Wikipedia made the difference for me. I had to create a new interwiki prefix though to get the system to recognize it. Jlerner 22:07, 19 March 2009 (UTC)Reply
Update - I found the problem. It appears that Wikipedia doesn't allow scripts to access its site. Take a look at the user_agent setting in your php.ini. ^>^ However, the function still doesn't work like it's supposed to. Instead of grabbing just the template, it grabs everything that appears on the 'render' page. (Including template usage information) -- Big Brother 1984 08:35, 11 April 2007 (UTC)Reply
Another Update - It appears that the software is ignoring the <noinclude> tag. Or rather, the 'render' action causes the template to be returned from the external site without any <noinclude> tags. In other words, when my site requests a template with the parameter "action=render", the external site sends me the everything on the template page, including the text between the <noinclude> tags. This should not be how this works. Perhaps another "action=" parameter needs to be added to the software that will cause the external site to return the template without the data between the <noinlude> tags??? -- Big Brother 1984 09:52, 11 April 2007 (UTC)Reply
3rd Update -- In Parser.php there is a boolean named $forceRawInterwiki. I'm wondering if this could provide a solution to this problem. I tried setting it to TRUE, but that only results in the following error message:
[Template fetch failed for w:en:Template:user_en?action=raw; sorry]
When I try navigating to that page manually I get a HTTP Error 403 - Forbidden message in my browser. I can't find any documentation for this "raw" feature anywhere, so it's entirely possible that I may be barking up the wrong tree. The only clue as to what $forceRawInterwiki does is a comment in the source code that says that this variable "Forces interwiki transclusion to be done in raw mode not rendered". Can anybody enlighten me as to what this option is actually supposed to do? -- Big Brother 1984 10:55, 11 April 2007 (UTC)Reply
Solution -- If you're trying to pull your templates from Wikipedia you'll need to up the $wgHTTPTimeout from 3 to a higher number like 20. To fix up your personal wiki you'll then need to set the $wgTranscludeCacheExpiry to 0 and then you can resave so it'll cache a copy local to your mediawiki. Afterwards set the $wgTranscludeCacheExpiry back to 3600 (1 hour). Cheers -- (ddarcy@digipen.edu) 64.183.53.166 06:25, 25 November 2008 (UTC)Reply
4th Update -- Regarding the 3rd update above. The $forceRawInterwiki variable in Parser.php is relavent. When this is false, the transcluded template is not parsed as template from the local wiki would be. In particular, template parameters are not substituted. It will only work as you would like if $forceRawInterwiki is true. This can be done by setting it directly in Parser.php, but the intention appears to be that you force it by starting the template declaration with the Template Modifier raw. So while {{otherwiki:tmpl|value}} will fail to substitute {{{1}}} in the template, we will get the desired effect with {{raw:otherwiki:tmpl|value}}. This raw modifier will result in the error reported above if your interwiki URL is configured incorrectly. The documentation on action=raw states that it may only be allowed when the page is accessed as a primary script access point, that is, when using the "ugly" URL form with index.php?title=.... Changing the URL in your interwiki table to use the ugly form should fix the problem. This whole thing seems nasty, does anyone have a nicer solution? --Mbmcloughlin 19:56, 13 June 2009 (UTC)Reply
after following these steps, the pages pulling the templates are full of errors and markup stuff, for example
Template:Infobox{{#if:|}}{{#if:|}}{{#if:|}}{{#if:|}}{{#if:|}}{{#if:|}}{{#if:|}} ... 
I've activated interwiki and corrected the wiki link in the database to the long ugly format, set $forceRawInterwiki to true. I did not see a difference when using {{raw:wiki:Infobox}} and {{wiki:Infobox}}. Please Help! -- 24.140.145.42 20:13, 29 June 2011 (UTC)Reply

What syntax  ?

[edit]

Everything is in the title : can anyone give an example of inter-wiki transcluding ? How should it be written to get a transclusion from here to w:Wikipedia:Transclusion ? --NewMorning 12:55, 29 June 2008 (UTC)Reply

Switch the [[ and ]] with {{ and }} in your link above, and you've got it. --Skizzerz 12:58, 6 August 2008 (UTC)Reply

Turning on other namespaces

[edit]

Is there related work to make this support transclusion from other namespaces? Sj 22:31, 5 August 2008 (UTC)Reply

Transclusion from other namespaces is always possible (unless you explicitly forbid it using $wgNonincludableNamespaces). To include a user page, use {{User:Foo}}. To include from the main namespace, use {{:Foo}}. HTH -- Duesentrieb 08:35, 6 August 2008 (UTC)Reply
I'm reading Sj's request as being able to transclude from foreign wikis in namespaces other than Template:. For example, I run two wikis on a site that are very similar and that share the user table via $wgSharedDB and $wgSharedTables. I'd like for a user to optionally be able to transclude their user page in one wiki to the other so that they only have to maintain one user page. But right now, it's not possible because everything is being forced through a Template: prefix. --TonyV 16:37, 22 March 2009 (UTC)Reply
Solution -- Just add a colon to the beginning after the site prefix. For example, {{w::User:Me}} (that's a double colon). If you use only {{w:User:Me}}, it'll fetch Template:User:Me. The reason for this is that the server has no way of knowing what is and isn't a namespace on the other Wiki, so it just assumes it isn't one. --71.112.238.184 00:25, 24 March 2009 (UTC)Reply

Is it scary because it doesn't work?

[edit]

Tisane 09:50, 29 March 2010 (UTC)Reply

it's scary because it is totally inefficient and perhaps even broken (I'm not sure). See GSOC#Reasonably_efficient_interwiki_template_transclusion for an alternative we hope to have soon --Church of emacs talk · contrib 16:33, 30 May 2010 (UTC)Reply
this is the updated link for the one above Summer_of_Code_2010#Reasonably_efficient_interwiki_template_transclusion --24.140.145.42 18:51, 29 June 2011 (UTC)Reply

Does not work on MW 1.16.x

[edit]
  • MediaWiki 1.16.2, the same in 1.16.4 and 1.16.5
  • PHP 5.2.17 (apache2handler), the same in 5.3.6
  • MySQL 5.0.77-log

Got an error in php error log:

PHP Fatal error:  Cannot redeclare class HttpRequest in /local_path_to_site/w/includes/HttpFunctions.php on line 122

when try to transclude template from another wiki in the same wiki-farm

{{WikiName:Template:TemplateName}} 

WikiName is in interwiki table

In another installation of MediaWiki 1.16.4 it does not work with a different error. In browser I have: [Template fetch failed for http://my.domain/wiki/Template:TemplateName&action=render]

and with the "ugly URL" in interwiki table:

[Template fetch failed for http://my.domain/w/index.php?title=Template:TemplateName&action=render]

Does anybody have a suggestion, please? Is it a PHP configuration problem or a MediaWiki bug? Pavel Malakhov 10:24, 4 May 2011 (UTC)Reply

The issue was due to HMTL extention for PHP, disabling it solved the problem. See bugzilla for details. Pavel Malakhov 09:39, 20 May 2011 (UTC)Reply

Searchable?

[edit]

Will the pages transcluded from another site show up in my search index? I'm currently using SphinxSearch, and the answer appears to be no. Do I need to switch to Lucene, or is there no hope for indexing transcluded pages?

Thanks!

--Jlemley 17:34, 11 November 2011 (UTC)Reply

  • External/third party search engines should index the transcluded content to your site, Google indexes Wikisource mainspace even when the content is transcluded from pagespace. The internal mediawiki search engine apparently looks directly at the database and therefore does not index transcluded content to the page that it transcludes to, only to the page it comes from (which are only local pages in the case of WMF) and this is a known and quite serious issue (see bug 18861). I don't know about SphinxSearch, especially when used as an extension, but there is some mention (no solutions) of this issue at Extension talk:SphinxSearch. These should be the same for scary transclusion as the search engine shouldn't make any distinction. I will research it further though. Does your SpinxSearch index locally transcluded content to the page where it's transcluded?--Doug.(talk contribs) 10:09, 7 December 2011 (UTC)Reply

oldwikisource:MediaWiki:InterWikiTransclusion.js

[edit]

Wikisource has implemented a JavaScript solution. Nemo 19:41, 14 November 2011 (UTC)Reply

This is awesome

[edit]

This works incredibly well, especially considering all the bad press. I have no problems with it and have successfully transcluded non-mediawiki wikis; specifically MoinMoin wikis - I've even successfully substituted them. It doesn't quite work if you try to transclude from an html site and it does really poorly if you try to transclude a text or code page that includes wikimarkup (e.g. a page of python code for the Pywikipediabot will look really messy because it will recognize elements of wikitext and html included in the code). Extension:Interwiki is a good way to manage what is and what isn't transcludable. --Doug.(talk contribs) 20:29, 6 December 2011 (UTC)Reply

Interlanguage Transcluding

[edit]

Is there a way for interwiki-interlanguage transclusions too. I did expected sth like {{wikipedia:de::user:xqt}} or {{wikipedia::de:user:xqt}} likewise normal interwiki-interlanguage link [[wikipedia::de:user:xqt]] works for me. Xqt 05:26, 14 January 2012 (UTC)Reply

Thanks for the question, this would be helpful for me, too. I'm maintaining a wiki in German (SMBwiki) where transclusions of Wikipedia articles would be a great help. The error message (e.g. [Vorlageneinbindung für http://en.wikipedia.org/wiki/de:Wikimedia_Commons?action=render ist gescheitert]) contains a working link (http://en.wikipedia.org/wiki/de:Wikimedia_Commons), therefore I'm hopeful, that there is a solution. --ThT (talk) 14:31, 5 March 2012 (UTC)Reply

check if transclusion successful

[edit]

hi folks, is there a possibility to check if the scary transclusion was successful?

background: I am transcluding a page with the same name from another wiki. If this page is not available I get following error:

[Vorlageneinbindung für http://www.cnc-ktn.net/wiki/index.php/G%C3%BCnter_Gr%C3%B6ssl?action=raw ist gescheitert]

That's ok, but I want to provide additional information to the user if the transclusion fails.

thx for any hints, cheers, --Rolze (talk) 07:32, 1 August 2012 (UTC)Reply

MITRE uses

[edit]

MITRE told us that they are using transclusion from Wikipedia pages to their enterprise wikis without issues. --Nemo 10:59, 25 May 2015 (UTC)Reply

Transcluding and SSL Self Signed Certificate

[edit]

Mediawiki 1.26, Ubuntu 16.04.1.

Transcluding stopped working when we moved Wikis to HTTPS only. Were getting error scarytranscludefailed ("[Template fetch failed for $1]").

Turned out being that we are using self signed certificates.

Had to dive into includes/parser/Parser.php, function fetchScaryTemplateMaybeFromCache, and var_dump($status) after line 4125 to understand what was going on:

object(Status)#405 (6) {
 ["sv":protected]=>
 object(StatusValue)#403 (6) {
   ["ok":protected]=>
   bool(false)
   ["errors":protected]=>
   array(1) {
     [0]=>
     array(3) {
       ["type"]=>
       string(5) "error"
       ["message"]=>
       string(15) "http-curl-error"
       ["params"]=>
       array(1) {
         [0]=>
         string(113) "error setting certificate verify locations:
 CAfile: /etc/ssl/certs/ca-certificates.crt
 CApath: /etc/ssl/certs"
       }
     }
   }

After importing the certificate into /etc/ssl/certs/ca-certificates.crt it began working again.

openssl s_client -showcerts -connect domain:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem
sudo su
cat mycertfile.pem >>/etc/ssl/certs/ca-certificates.crt

Remember to set $wgTranscludeCacheExpiry = 0 during tests, or the cache will drive you mad.