As part of Wikidata, I'm rather fundamentally redesigning the namespace
logic of MediaWiki, and I'd like to invite input, specifically on
1) whether I should try to get these changes ready for 1.5, or commit
them to a separate branch,
2) whether there are objections or suggestions regarding any of the below.
Simply put, I am moving namespaces from the language files and from
Namespace.php into the database. In my present implementation, the
namespaces are loaded from the DB on every request, but I will add
support for memcached as well.
The goal is to make it easier to change and add namespace names and
properties (some names cannot currently be changed at all without
editing the Language*.php file, which is impractical when you're using a
shared codebase), and to have an arbitrary number of synonyms for any
namespace.
The table structures are as follows:
mysql> show columns from namespace;
+-------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| ns_id | int(8) | | PRI | 0 | |
| ns_system | varchar(80) | | | 0 | |
| ns_subpages | tinyint(1) | | | 0 | |
| ns_search_default | tinyint(1) | | | 0 | |
| ns_target | varchar(200) | YES | | NULL | |
+-------------------+--------------+------+-----+---------+-------+
(ns_target is a new feature I'm working on which allows you to specify a
default "destination prefix" for any link from within that namespace.
This can be an InterWiki link or a namespace. That will be useful in a
variety of contexts, for example, within a Wikibooks module, all links
could point to pages within the namespace by default; within a Wikidata
page, all links could go to Wikipedia by default, etc.)
mysql> show columns from namespace_names;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| ns_id | int(8) | | | 0 | |
| ns_name | varchar(200) | | | | |
| ns_default | tinyint(1) | | | 0 | |
+------------+--------------+------+-----+---------+-------+
ns_default is the namespace all other namespace names for that ns_id
will redirect to.
I have got the backend fully working and am now working on the namespace
manager frontend and the installer code. Essentially, what it means is
that you can have stuff like:
mysql> select * from namespace_names where ns_id=6;
+-------+---------+------------+
| ns_id | ns_name | ns_default |
+-------+---------+------------+
| 6 | File | 1 |
| 6 | Image | 0 |
| 6 | Video | 0 |
| 6 | Sound | 0 |
+-------+---------+------------+
This means that the default namespace name is "File", and that "Image",
"Video" and "Sound" redirect to it. No more "Image" prefix for sound
files! It's quite a pleasure to see this working. There can be an
arbitrary number of namespace synonyms for any namespace.
The major part of the effort is getting this to work properly with all
language files. Essentially, I intend to import the initial namespace
names and English canonical names during installation or upgrade,
similar to the way the MediaWiki namespace is imported. I would also
like to try to figure out a smooth upgrade procedure for
$wgMetaNamespace and $wgExtraNamespaces, as well as the other
namespace-related settings.
The namespace manager will have a separate set of permissions which can
be atomically assigned to a group. I intend to add some checks here, e.g.:
* don't allow it to delete a namespace that contains pages
* don't allow it to create a namespace if there are existing pages with
that prefix (avoid conflicts with pseudo-namespaces)
* warn if there are conflicts with InterWiki prefixes
Again, please let me know what you think about this, if there are any
questions, and whether I should try to get this ready for 1.5. Are we
near/at the feature freeze stage? Is there going to be a REL1_5 branch soon?
Best,
Erik