I have one wiki where #createpageifnotex is working flawlessly on custom domains whose names are in $wgContentNamespaces, but not in a another wiki in a custom domain that is also in $wgContentNamespaces.
Am I missing something?
I have one wiki where #createpageifnotex is working flawlessly on custom domains whose names are in $wgContentNamespaces, but not in a another wiki in a custom domain that is also in $wgContentNamespaces.
Am I missing something?
The documentation might be a bit misleading: $egAutoCreatePageNamespaces will be initialized with $wgContentNamespaces. If you add namespaces later, you have to add them to both config settings.
Do you mean that the initialisation of $egAutoCreatePageNamespaces takes place upon the first run and is somehow persisted for later invocations?
I'm not shure what you mean with later invocations. In your config, you should have an entry that looks like this:
require_once "$IP/extensions/AutoCreatePage/AutoCreatePage.php"; $egAutoCreatePageNamespaces = [ NS_MAIN, NS_CUSTOM ];
Where NS_CUSTOM is the constant you defined for an additional namespace the extension should work in. Note that this is only an example, you can have as many entries in that array as you need.
I now understand what you mean: If $egAutoCreatePageNamespaces is set to any value in config, then it no longer merges the values from $wgContentNamespaces. In other words the setting in config overrides the default, instead of appending to it.
Correct. AutoCreatePage does not use the new extension loader, so the moment the require command in your config is executed, $egAutoCreatePageNamespaces will be initialized with $wgContentNamespaces. After that, they will be treated separately. You can have
$wgContentNamespaces = [ NS_MAIN, NS_CUSTOM ]; require_once "$IP/extensions/AutoCreatePage/AutoCreatePage.php";
but not
require_once "$IP/extensions/AutoCreatePage/AutoCreatePage.php"; $wgContentNamespaces = [ NS_MAIN, NS_CUSTOM ];
You could have something like this
$wgContentNamespaces = [ NS_MAIN, NS_CUSTOM ]; require_once "$IP/extensions/AutoCreatePage/AutoCreatePage.php"; $egAutoCreatePageNamespaces[] = NS_CUSTOM2
Which will result in $egAutoCreatePageNamespaces containing three values.
Does anyone know of an alternative that works with 1.35? Or an effort to create one? Or to update this one?
Just tested in 1.37.1. No error message but no page created either. Pity because this functionality is useful.
It is indeed no longer working starting with 1.35.x or even earlier. Indeed it will be great to get a working version again.
There is also https://github.com/Universal-Omega/AutoCreatePage, the repo the extension's page currently links to.
Works for MW 1.31.x (LTS)
After I had installed the extension and added the parser function to an existing template that's used on a bunch of pages, new pages weren't being created as I had hoped. It turns out that new page creation isn't triggered until the page that contains the template is edited and saved (a null edit works), but purge (refresh) doesn't seem to trigger this. I hadn't read the instruction on GitHub, but it does mention this, just not on the MediaWiki extension page. I'm assuming this is because the name of the edit user is required so that the new page can be attributed to the same user.
Is it possible to trigger this somehow for multiple pages? I have 300+ pages that I'd like to use this on and not too thrill about null-editing 300+ pages. I could use ReplaceText on the pages, but I also have the ApprovedRevs extension installed, which means that I would then have to approve all the pages. I don't want to then use the mass approve script that comes with ApprovedRevs, since there are existing unapproved pages that I cannot approve (cannot as in I don't have the authorisation to approve those pages).
Edit: ReplaceText doesn't trigger the new page creation.
Hi there,
Working on
Product | Version |
---|---|
MediaWiki | 1.29.2 |
PHP | 5.6.36 (apache2handler) |
MySQL | 5.6.40 |
ICU | 50.1.2 |
Elasticsearch | 5.3.3 |
Extension was working until a little while ago. Not sure what happened. It was inside #if function. Multiple instances of #createpageifnotex function on same page. Tried reducing to one instance inside a template. Tried increasing $egAutoCreatePageMaxRecursion and toggle $egAutoCreatePageIgnoreEmptyTitle to true. Nothing is working. Even specified $egAutoCreatePageNamespaces to include TEMPLATE namespace. No errors, even with debug on. Just nothing happening. Tried running the jobs list. still nothing.
Any clues anyone?
Thanks
> Extension was working until a little while ago. Not sure what happened.
Did you upgrade MediaWiki, PHP, etc.? If yes which versions were you using before.? This will probably help developers to assess the situation a bit better.
I have installed this extension on sandbox.semantic-mediawiki.org so you @ JeremiPlazas: may test. @Oetterer: I am not sure how "resposive" Markus is so it will be great if you could follow this discussion. Thanks and cheers
Thanks much. Logged in to sandbox and tested. Everything working fine there. Of course the software setup is newer. But still...
Thanks
I'm running it succesfully on 1.27.4. Just to be sure: you added NS_TEMPLATE
to the array $egAutoCreatePageNamespaces?
Yes I did. And no I did not update MW or PHP. It just stopped working at some point. Also it is now breaking another wiki on that same farm:
[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}
Hey all, so it seems i've figured out why it wouldn't work on my initial wiki. (Still don't know why it's breaking this other wiki above, if you have info on that, t'would be great.) But i was trying to run the parser function from a subpage, which doesn't seem to work. When i call the function from a root page it works fine. Is there any way to make it work from subpages?
Thanks again for the help!
That is at least partially good news. It would be best, if you could add an issue on the extension’s github page concerning the problem with subpages. This way you maximize your chances for a fix.
Just did,
https://github.com/mkroetzsch/AutoCreatePage/issues/11
Thanks!
@Oetter: On sandbox I added the template namespace to the configuration parameter though I am not sure why this is needed.
@JeremiPlazas You claim in your original report that it worked from subpages before. Thus it will be nice if you could add the info what exactly changed in your setup.
Apart from that it is great to see that the extension at least works from regular pages.
Also, tested the #createpageifnotex parser function from a subpage on sandbox and that works fine. So something preventing it for me. Version issue?
Works with MW 1.30.x and 1.31.x
Few questions:
$egAutoCreatePageNamespaces = [ NS_MAIN, NS_USER, NS_CUSTOM ];
, does it mean that it will work in template included in a page in the main namespace? Or Do I should add "NS_TEMPLATE"?Hi,
I added 3 lines to AutoCreatePage.php behind line 94:
$newPageContent = str_replace ( "{" , "{" , str_replace ( "}" , "}" , $newPageContent ) );
$newPageContent = str_replace ( "|" , "|" , $newPageContent );
$newPageContent = str_replace ( """ , "#" , $newPageContent );
This makes the use of templates much easier. Just write in the template what you need with {;, };, and |; and "; into a template. Include the template in the parameter, and all works as expected. Made my life much easier...
Heiya, thank you for sharing your improvement. Why not creating a pull request at GitHub? Cheers
I'm a bit in war with git...
Wanted to place an extension there, failed, and didn't have time to learn all about git...
I'm not English native, and did not find good documentation.
No worries. I just added this as issue 8 on GitHub. Let's see what Markus thinks.
You can just write <nowiki> around your content to achieve this, like so:
{{#createpageifnotex:New page title|<nowiki>{{Template|parameter=value}}</nowiki>}}
Maybe the documentation on the extension page needs to be extended to clarify this.
It's not so easy sometimes. If you place the new content into a template, and you pass parameters to the template, you can get fast a lot of blocks like:<nowik>...some content...</nowiki>{{{...|}}}<nowik>...some content...</nowiki> inside the template, while replacing the "&#xxx;" makes the source much easier to read.
My call looks like this:
{{#createpageifnotex:New page title|{{Template|parameter=value}} }}
Meaning, I call the template with params, and want the params to get placed into the template content. But I don't want to get the template functions executed.
Used wrong parameter. Works now! THANK YOU FOR AN AMAZING EXTENSION!
This extension works perfectly with explicitly stated strings and text, but I'm having trouble transcluding parameters from a template onto this magic word.
Example:
{{#createpageifnotex:{{{1|}}}|#REDIRECT [[{{{2|}}}]]}}
I keep getting an error of: Error: this function must be given a valid title text for the page to be created. What am I doing wrong?
Thanks!
I'm using your extension for my new project and I must say: it's a real life saver! Thank you very much for your work, it is really appreciated! :)
During development, I was wondering: since a similar parser functions #ifexist is categorized as expensive does that apply to #createpageifnotex as well. And if so: regarding performance is it better to use #createpageifnotex directly without #ifexist?
Thanks in advance! :)
Regards, Tobi