Topic on Extension talk:Scribunto

Difficulties in getting this extension to work

6
Leucosticte (talkcontribs)

I don't think I've ever had an extension give me as much trouble as this one. It didn't work and then it worked (and I documented how I got it to work; apparently not all the necessary templates were imported) and then it didn't work anymore (I guess after I imported more templates or something). Good ol' "Script error" with its specifics that aren't described in any of these postings. Anyway, I'm going to keep plugging away at this troubleshooting, and then post the details of what I encountered and how I solved it (because for one thing, I might need the info later too). I did try some of the solutions specified for similar problems; those didn't work, and I'm upgrading all of my extensions just to be safe. I got Scribunto to work on a brand-new MW installation so I know my extension code was good.

I hope others will do the same (i.e. document problems and solutions); even if you figure out how to solve your own problem without needing to ask a question here, please post in the article a description of the symptoms and what you did to fix them. Hopefully by working together we can put together documentation that will help others (and ourselves, if we forget later) figure out how to make this diabolically frustrating extension, with its mysterious error messages and usually unhelpful/uninformative error logs, work properly. Thanks.

Mr. Stradivarius on tour (talkcontribs)

If it worked and then it didn't work after you imported some modules from the English Wikipedia, there's a good chance that you don't have the latest version. Modules on Wikipedia often use the "text" library which doesn't get installed in the default extension shipped with MediaWiki (it will in the future). Try using the latest development version and see if that helps. If it doesn't, please report back here with the specific versions of MediaWiki and Scribunto that you are using, and the exact error message you are getting. Thanks. :)

Leucosticte (talkcontribs)

Well that's the thing. I upgraded to the latest development version of Scribunto and it still didn't work. However, I then installed a fresh MediaWiki installation (with the latest development version of MW) for testing purposes and had it use that same development version of Scribunto that my old wiki was using. The same template that wasn't working on my old wiki worked fine on the new one. At least I think it's all the same template code; I tried to delete all those templates and re-import from Wikipedia, and that didn't help. (The old wiki is just a slightly older, i.e. by a few weeks, development version of MW.)

So it's not the Scribunto code. I can try deleting everything in the Template namespace and re-importing from Wikipedia; that might fix it. I already tried commenting out that strip whitespace line in the namespace detect module, and I deleted everything in Module and re-installed. I linked above to the error message.

It's possible that I inadvertently imported a few templates from another wiki besides Wikipedia that interfered with these templates. E.g., if I imported a documentation template from another wiki, or something.

Mr. Stradivarius on tour (talkcontribs)

When you say "it still didn't work", what behaviour were you seeing, exactly, and what error messages did you get, exactly? We can't help you unless you are more specific about your situation. And also, are you aware that the "Script error" message is clickable? If you click on it it will give you more details about what went wrong.

Leucosticte (talkcontribs)

YesY Resolved Okay, problem solved, but in the spirit of Good Guy Greg (even though the analogy isn't totally apt because someone did reply), I'll post how it was solved:

  1. I had a wiki that lacked Scribunto, so when I imported some newer templates from Wikipedia, they didn't work (the #invoke statements were not supported).
  2. So, I installed Scribunto, but then it still didn't work for some reason; I was getting Script errors, which if memory serves I was eventually able to get rid of by installing the development version of Scribunto, upgrading to the development version of MW (1.22alpha), making sure I imported every single template I needed, etc. So at this point, everything was finally working. Life was good for awhile; all templates were functional.
  3. Next, I imported some pages from other wikis, which also has some pre-Scribunto templates on them. I had the "Include templates" box checked on Special:Export. At some point in this process, Scribunto quit working completely and starting giving script errors on all templates. See this link if you want to see the screenshot; it says 1. (tail call): ? 2. mw.site.lua:32: ? 3. (tail call): ? 4. [C]: in function "xpcall" 5. MWServer.lua:73: in function "handleCall" 6. MWServer.lua:266: function "dispatch" 7. MWServer.lua:33: in function "execute" 8. mw_main.lua:7: in main chunk 9. [C]: ?
  4. I upgraded to the latest development version of Scribunto and it was still giving those errors.
  5. I deleted everything in the Module and MediaWiki namespaces and re-imported and it was still giving those errors.
  6. I deleted Template:Infobox criminal and its dependencies from my wiki and re-imported from Wikipedia with all dependencies and it was still giving those errors. I'm not sure why this didn't work.
  7. I disabled all extensions except Scribunto and it was still giving me those errors.
  8. For testing purposes, I created a new wiki with the latest MW development version (1.23alpha), and did a require_once in LocalSettings.php to the same Scribunto files my other, older MediaWiki installation was using. Then I imported to that test wiki Template:Infobox criminal and its dependencies from Wikipedia. The template worked!
  9. I upgraded the old wiki to the latest MW development version (1.23alpha) and I was still getting a script error. When I clicked on it, it was the exact same description as before.
  10. On the old wiki, I created a new namespace, Backup: I then installed Extension:OneColumnAllPages, ran Special:OneColumnAllPages, copied and pasted a list of all the template page titles into a file along with pipes and new page titles with Backup: prefixes, and then used moveBatch.php to move all the templates over to the Backup: namespace. So now, the Template: namespace was empty.
  11. Then I re-imported the necessary templates from Wikipedia. Everything was now working.

Lesson learned: Be careful about importing pages from wikis that might have pre-Scribunto or otherwise incompatible templates you are importing along with them (if you have the "Include templates" box checked when you export). If you do import those templates, and can't figure out which one it was, then mass deletion and re-importation of templates might be the only option. If an imported bad revision is of a more recent date/time than the Wikipedia templates you try to import on top of them, the Wikipedia revisions will be buried in the revision history and the bad revisions will continue to cause problems. Basically, if you're importing pages from wikis other than Wikipedia, watch out for that "Include templates" option; you could be causing some major problems.

Anomie (talkcontribs)

From the error you linked in step 3, it seems like you somehow got your wiki into a situation where one of the entries returned from $wgContLang->getFormattedNamespaces() had a null name.

I have no idea how importing stuff in step 3 might have given you a broken namespace, nor how what you did in step 10 fixed it (unless you happened to create your "Backup" namespace with the same number as whatever the broken namespace was).

Reply to "Difficulties in getting this extension to work"