[Toolserver-l] Small (non-breaking) change of toolserver.namespacename
DaB.
WP at daniel.baur4.info
Wed May 18 12:59:30 UTC 2011
Hello all,
some user complained of the new way toolserver.namespacename handles cases in
which the primary name of namespace is identical to the canonical name.
To fix this without breaking tools that rely on the new behavior, I add a new
column "ns_is_favorite" to the table today (this solution was found with the
help of valhallasw and Krinkle in IRC yesterday). The coloumn is a boolean
field that describe if this ns_name is the best solution for a ns_id or not.
See the following examples:
mysql> SELECT ns_name,ns_type FROM namespacename WHERE
domain="en.wikipedia.org" AND ns_id=4;
+-----------+-----------+
| ns_name | ns_type |
+-----------+-----------+
| Wikipedia | primary |
| Project | canonical |
| WP | alias |
+-----------+-----------+
mysql> SELECT ns_name,ns_type FROM namespacename WHERE
domain="en.wikipedia.org" AND ns_id=4 AND ns_is_favorite=1;
+-----------+---------+
| ns_name | ns_type |
+-----------+---------+
| Wikipedia | primary |
+-----------+---------+
mysql> SELECT ns_name,ns_type FROM namespacename WHERE
domain="en.wikipedia.org" AND ns_id=2;
+---------+-----------+
| ns_name | ns_type |
+---------+-----------+
| User | canonical |
+---------+-----------+
mysql> SELECT ns_name,ns_type FROM namespacename WHERE
domain="en.wikipedia.org" AND ns_id=2 AND ns_is_favorite=1;
+---------+-----------+
| ns_name | ns_type |
+---------+-----------+
| User | canonical |
+---------+-----------+
As you can see, if you use "ns_is_favorite=1" you will always get only 1
result, no matter if there are primary and canonical or just a canonical one.
If you have questions or suggestions, please reply.
Sincerly,
DaB.
--
Userpage: [[:w:de:User:DaB.]] — PGP: 2B255885
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.wikimedia.org/pipermail/toolserver-l/attachments/20110518/d4cb1bc2/attachment.pgp
More information about the Toolserver-l
mailing list