Topic on Extension talk:AutoCreatePage

Jump to navigation Jump to search

here it's working, there it's not

6
أحمد (talkcontribs)

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?

Oetterer (talkcontribs)

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.

أحمد (talkcontribs)

Do you mean that the initialisation of $egAutoCreatePageNamespaces takes place upon the first run and is somehow persisted for later invocations?

Oetterer (talkcontribs)

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.

أحمد (talkcontribs)

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.

Oetterer (talkcontribs)

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.

Reply to "here it's working, there it's not"