Open main menu

Extension talk:GetUserName

Breaks on MediaWiki 1.33Edit

This extension caused failure on our Wiki after updating to MediaWiki 1.33.0. The Backtrace is (after accessing any page):

[d46631b531eb32a243afc181] /wiki/index.php/Hauptseite MWException from line 187 of /usr/share/webapps/mediawiki/includes/MagicWord.php: Error: invalid magic word 'USERNAME'

Backtrace:

  1. 0 /usr/share/webapps/mediawiki/includes/MagicWordFactory.php(222): MagicWord->load(string)
  2. 1 /usr/share/webapps/mediawiki/includes/parser/Parser.php(4958): MagicWordFactory->get(string)
  3. 2 /usr/share/webapps/mediawiki/extensions/GetUserName/GetUserName.php(27): Parser->setFunctionHook(string, array, integer)
  4. 3 /usr/share/webapps/mediawiki/includes/Hooks.php(174): ExtGetUserName::setup(Parser)
  5. 4 /usr/share/webapps/mediawiki/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
  6. 5 /usr/share/webapps/mediawiki/includes/parser/Parser.php(384): Hooks::run(string, array)
  7. 6 /usr/share/webapps/mediawiki/includes/StubObject.php(112): Parser->firstCallInit()
  8. 7 /usr/share/webapps/mediawiki/includes/StubObject.php(138): StubObject->_call(string, array)
  9. 8 /usr/share/webapps/mediawiki/includes/cache/MessageCache.php(1210): StubObject->__call(string, array)
  10. 9 /usr/share/webapps/mediawiki/includes/cache/MessageCache.php(1186): MessageCache->getParser()
  11. 10 /usr/share/webapps/mediawiki/includes/Message.php(1291): MessageCache->transform(string, boolean, Language, Title)
  12. 11 /usr/share/webapps/mediawiki/includes/Message.php(895): Message->transformText(string)
  13. 12 /usr/share/webapps/mediawiki/includes/Message.php(955): Message->toString(string)
  14. 13 /usr/share/webapps/mediawiki/includes/OutputPage.php(902): Message->text()
  15. 14 /usr/share/webapps/mediawiki/includes/OutputPage.php(951): OutputPage->setHTMLTitle(Message)
  16. 15 /usr/share/webapps/mediawiki/includes/page/Article.php(621): OutputPage->setPageTitle(string)
  17. 16 /usr/share/webapps/mediawiki/includes/actions/ViewAction.php(68): Article->view()
  18. 17 /usr/share/webapps/mediawiki/includes/MediaWiki.php(499): ViewAction->show()
  19. 18 /usr/share/webapps/mediawiki/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
  20. 19 /usr/share/webapps/mediawiki/includes/MediaWiki.php(865): MediaWiki->performRequest()
  21. 20 /usr/share/webapps/mediawiki/includes/MediaWiki.php(515): MediaWiki->main()
  22. 21 /usr/share/webapps/mediawiki/index.php(42): MediaWiki->run()
  23. 22 {main}

We started using the MyVariables extension instead, which works fine.

Thanks for the note. I archived this extension. --[[kgh]] (talk) 07:58, 17 September 2019 (UTC)
I've moved the extension to github and made it work with MediaWiki 1.33. Tinss (talk) 23:40, 5 October 2019 (UTC)

Parser cacheEdit

The problem with this and similar extensions is that they break the parser cache. This extension doesn't disable the parser cache, so when a page is viewed, you will get the user name of the user who caused it to be entered into the cache (e.g. by viewing it when it was not in the cache, or by editing it). You should disable the cache (see Manual:Parser functions#Caching), and on a small wiki or a short page it won't be much of a problem, but for the purpose you created this extension for, it is better to use Special:Mypage, e.g. Special:Mypage/Draft-20191112014544 (note that because of caching, currenttimestamp is the time the page was entered into the parser cache, so it may be off by several hours compared to real time.) -- Nx / talk 09:46, 22 July 2010 (UTC)

The extension disables the cache when generating the magic word. Tinss (talk) 23:40, 5 October 2019 (UTC)
Return to "GetUserName" page.