Implement wfGlobalCacheKey() for database-agnostic keys
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 23 Jun 2015 04:52:30 +0000 (05:52 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 23 Jun 2015 06:52:18 +0000 (07:52 +0100)
commit0f64b61271edce060f8519dd0bb3f58f56054aaa
tree027f813b860577c29b20cd103d8408aba605dc2c
parentc099155a17d26f03799a9ba085d7b5b912b186e2
Implement wfGlobalCacheKey() for database-agnostic keys

Some code paths abuse wfForeignMemcKey() for this purpose. This is semantically
incorrect and seems fragile. Also the empty second argument (for db-prefix) is
either misused or akwardly set to the empty string.

It also creates a namespace conflict between arbitrary application keys (from
the software) and any database names (from users). This commit reduces the
conflict surface down to a single key (namely, "global").

Also added unit tests to assert the implicit restrictions and
assumptions between these cache key functions are valid.

Change-Id: Ia0953b51005fe3de3b881dd1bd64c9d3c85e8c66
includes/GlobalFunctions.php
tests/phpunit/includes/GlobalFunctions/GlobalTest.php