Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't make it work from subpages #11

Open
JeremiPlazas opened this issue Jun 6, 2018 · 6 comments
Open

Can't make it work from subpages #11

JeremiPlazas opened this issue Jun 6, 2018 · 6 comments

Comments

@JeremiPlazas
Copy link

JeremiPlazas commented Jun 6, 2018

Tried everything to make this parser function work from a subpage but it doesn't seem to. Works fine on root pages. Any ideas?

Running:
MediaWiki | 1.29.2
PHP | 5.6.36 (apache2handler)
MySQL | 5.6.40
ICU | 50.1.2
Elasticsearch | 5.3.3

Issue on extension talk page:
https://www.mediawiki.org/wiki/Topic:Uehxiz2cyqldjevc

@mkroetzsch
Copy link
Owner

I don't have an immediate idea and I won't have time to look into it soon, but the code is rather short and should not be hard to debug for anyone who has some basic programming experience (with PHP or without). Of course, only for someone who can reproduce the issue (does it occur on other wikis?).

@JeremiPlazas
Copy link
Author

JeremiPlazas commented Jun 6, 2018

Not the exact same problem no, however, on another wiki on the same wiki farm, it crashed the whole thing, with the following back trace:

[85b369eaf612a29031da2ec0] /index.php/Main_Page MWException from line 336 of /mnt/centaurdata/websites/MediaWikiFarm/includes/MagicWord.php: Error: invalid magic word 'createPage'
Backtrace:
#0 /mnt/centaurdata/websites/MediaWikiFarm/includes/MagicWord.php(261): MagicWord->load(string)
#1 /mnt/centaurdata/websites/MediaWikiFarm/includes/parser/Parser.php(4858): MagicWord::get(string)
#2 /mnt/centaurdata/websites/MediaWikiFarm/extensions/AutoCreatePage/AutoCreatePage.php(55): Parser->setFunctionHook(string, Closure)
#3 [internal function]: {closure}(Parser)
#4 /mnt/centaurdata/websites/MediaWikiFarm/includes/Hooks.php(186): call_user_func_array(Closure, array)
#5 /mnt/centaurdata/websites/MediaWikiFarm/includes/parser/Parser.php(337): Hooks::run(string, array)
#6 [internal function]: Parser->firstCallInit()
#7 /mnt/centaurdata/websites/MediaWikiFarm/includes/StubObject.php(113): call_user_func_array(array, array)
#8 /mnt/centaurdata/websites/MediaWikiFarm/includes/StubObject.php(139): StubObject->_call(string, array)
#9 /mnt/centaurdata/websites/MediaWikiFarm/includes/cache/MessageCache.php(1112): StubObject->__call(string, array)
#10 /mnt/centaurdata/websites/MediaWikiFarm/includes/cache/MessageCache.php(1112): StubObject->firstCallInit()
#11 /mnt/centaurdata/websites/MediaWikiFarm/includes/cache/MessageCache.php(1088): MessageCache->getParser()
#12 /mnt/centaurdata/websites/MediaWikiFarm/includes/Message.php(1259): MessageCache->transform(string, boolean, Language, Title)
#13 /mnt/centaurdata/websites/MediaWikiFarm/includes/Message.php(874): Message->transformText(string)
#14 /mnt/centaurdata/websites/MediaWikiFarm/includes/Message.php(934): Message->toString(string)
#15 /mnt/centaurdata/websites/MediaWikiFarm/includes/OutputPage.php(936): Message->text()
#16 /mnt/centaurdata/websites/MediaWikiFarm/includes/OutputPage.php(984): OutputPage->setHTMLTitle(Message)
#17 /mnt/centaurdata/websites/MediaWikiFarm/includes/page/Article.php(464): OutputPage->setPageTitle(string)
#18 /mnt/centaurdata/websites/MediaWikiFarm/includes/actions/ViewAction.php(68): Article->view()
#19 /mnt/centaurdata/websites/MediaWikiFarm/includes/MediaWiki.php(499): ViewAction->show()
#20 /mnt/centaurdata/websites/MediaWikiFarm/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)
#21 /mnt/centaurdata/websites/MediaWikiFarm/includes/MediaWiki.php(862): MediaWiki->performRequest()
#22 /mnt/centaurdata/websites/MediaWikiFarm/includes/MediaWiki.php(523): MediaWiki->main()
#23 /mnt/centaurdata/websites/MediaWikiFarm/index.php(43): MediaWiki->run()
#24 {main}

Interestingly, in the first wiki, the problem seems to be two-fold. First, it doesn't seem to work on subpages on the Main namespace (works on subpages of the User namespace for some reason). Second, it does not work if i include a magic word in the text to insert, which for me is code for a redirect.
{{#createpageifnotex: {{SUBPAGENAME}} | #REDIRECT[[{{PAGENAME}}]] [[Category: Redirects]] }}
When i try without magic words, in a root level page. It works.

@JeremiPlazas
Copy link
Author

I should specify i am using a custom skin, though i couldn't find how that would be causing the problem.

@JeremiPlazas
Copy link
Author

Is it possible to access an older version of the extension? 0.5 for example?

@mkroetzsch
Copy link
Owner

The older version was completely different and only worked with very old versions of MediaWiki, so you wouldn't learn anything from this. The code released here is my re-implementation in its first version (I just incremented the previous version number for clarity).

@JeremiPlazas
Copy link
Author

JeremiPlazas commented Jun 7, 2018

Understood. I realized for one that REDIRECTS can't take in magic words without <nowiki> tags. So that explained that bit. But they are still not functioning on subpages. For now i've implemented a workaround for the wiki, so not as pressing an issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants