|
|
(One intermediate revision by the same user not shown) |
Line 1: |
Line 1: |
| == Warning and no table creation == | | == Warning and no table creation == |
| | | |
− | Hi! The following code is bogus :
| + | Moved to [[WikiDB/Bugs#Warning and no table creation]]. |
− | <php>$wgWikiDBNamespaces = 100;</php>
| + | |
− | | + | |
− | $wgWikiDBNamespaces is expected to be an array (in classWikiDB_Table.php line 232),
| + | |
− | so this code generate a warning and no table creation.
| + | |
− | | + | |
− | the good way to create the namespace in LocalSettings.php is:
| + | |
− | <php>
| + | |
− | require_once "$IP/extensions/WikiDB/WikiDB.php";
| + | |
− | define('NS_TABLE', 100);
| + | |
− | define('NS_TABLE_TALK', 101);
| + | |
− | $wgExtraNamespaces[NS_TABLE] = "Table";
| + | |
− | $wgExtraNamespaces[NS_TABLE_TALK] = "Table_Talk";
| + | |
− | $wgWikiDBNamespaces = array(NS_TABLE => true);
| + | |
− | </php>
| + | |
− | | + | |
− | ----
| + | |
− | | + | |
− | : Hi - thanks for the bug report.
| + | |
− | : The extension has code to handle this, in WikiDB.php:
| + | |
− | <php>
| + | |
− | | + | |
− | // If $wgWikiDBNamespaces has not been set, or is otherwise blank, initialise it to
| + | |
− | // an empty array.
| + | |
− | if (IsBlank(@$wgWikiDBNamespaces)) {
| + | |
− | $wgWikiDBNamespaces = array();
| + | |
− | }
| + | |
− | // Otherwise, if it has been set, make sure it's a valid array.
| + | |
− | // In this case the value is treated as the namespace ID of a single table
| + | |
− | // namespace, which we convert to the standard array representation used by this
| + | |
− | // variable.
| + | |
− | elseif (!is_array($wgWikiDBNamespaces)) {
| + | |
− | $wgWikiDBNamespaces = array($wgWikiDBNamespaces => true);
| + | |
− | }
| + | |
− | </php>
| + | |
− | : However, this only works if you define the properties before you include the extension. If you moved your <code>require_once</code> line so that it comes after <code>$wgWikiDBNamespaces</code> is defined, then things would work as intended.
| + | |
− | : This is a bug - it is normal to include the extension before configuring it, and so we should definitely support this. I will include a fix for this in the next release.
| + | |
− | : Kind regards,
| + | |
− | : --[[User:HappyDog|HappyDog]] ([[User talk:HappyDog|talk]]) 22:10, 24 November 2019 (GMT)
| + | |