Topic on Extension talk:AutoSitemap

Jump to navigation Jump to search
Fokebox (talkcontribs)

Hello! Do you have any plans to update the extension for MW 1.35? I tried to use it, but had problems with VisualEditor and saving a page via this tool.

Martynov Maxim (talkcontribs)

Hello.


Can you please share the issues you've faced with? I'm not using the latest MW version, so this is the only way to get useful information about these problems.

Fokebox (talkcontribs)

Here is what I have:

MediaWiki 1.35.0
PHP 7.4.11 (cgi-fcgi)
MySQL 5.7.27-30
ICU 50.1.2
Lua 5.1.5

As soon as I switch on the extension now all works fine, but as soon as I want exclude some pages from xml file adding following code:

$wgAutoSitemap["exclude_namespaces"] = [
    NS_WIDGET,
    NS_WIDGET_TALK,
];

I Have error appeared on the top of each page:

Warning: Use of undefined constant NS_WIDGET - assumed 'NS_WIDGET' (this will throw an Error in a future version of PHP) in /var/www/u0402490/data/www/wikireshebnik.ru/LocalSettings.php on line 261

Warning: Use of undefined constant NS_WIDGET_TALK - assumed 'NS_WIDGET_TALK' (this will throw an Error in a future version of PHP) in /var/www/u0402490/data/www/mysite.ru/LocalSettings.php on line 262

Warning: session_name(): Cannot change session name when headers already sent in /var/www/u0402490/data/www/mysite.ru/includes/Setup.php on line 713

Warning: session_id(): Cannot change session id when headers already sent in /var/www/u0402490/data/www/mysite.ru/includes/Setup.php on line 757

Warning: session_start(): Cannot start session when headers already sent in /var/www/u0402490/data/www/mysite.ru/includes/Setup.php on line 758

Warning: Cannot modify header information - headers already sent by (output started at /var/www/u0402490/data/www/wikireshebnik.ru/LocalSettings.php:261) in /var/www/u0402490/data/www/mysite.ru/includes/WebResponse.php on line 74

Warning: Cannot modify header information - headers already sent by (output started at /var/www/u0402490/data/www/wikireshebnik.ru/LocalSettings.php:261) in /var/www/u0402490/data/www/mysite.ru/includes/WebResponse.php on line 74
Martynov Maxim (talkcontribs)

These namespaces are added by Extension:Widgets. Do you add these lines before or after lines where you enable this extension?

Fokebox (talkcontribs)

I add these lines after I enable Widget extension

Martynov Maxim (talkcontribs)

The issue is connected with Widgets extensions and the way it defines namespace NS_WIDGET - there is no such constant in LocalSettings file.


In previous versions of MediaWiki, an import style like that was used:

require_once "$IP/extensions/Widgets/Widgets.php";

This style executed the whole source code of extension, and new global variables could be accessed just on the next lines of LocalSettings file.

But it looks that new style of import (wfLoadExtension) does not add global constant with namespace ID, and that's why you're facing with this error message.


Can you please try to use old style import of Widgets extension? Or try replace these constants with ID values (they are just hard coded, see Extension default namespaces#270–279: Widgets).