Extension:NamespaceManager
NamespaceManager Release status: experimental |
|
---|---|
Implementation | MyWiki |
Description | Allows declaration of namespaces using a JSON file. |
Author(s) | Jeffrey Wang for MyWikis LLC |
Latest version | 0.4.2 |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | 1.35+ |
PHP | 7.0+ |
Database changes | No |
Composer | mediawiki/namespace-manager |
License | GNU General Public License 2.0 |
Download | GitHub:
<translate> Note:</translate> README |
Example | MyWikis Testing |
|
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
The NamespaceManager extension allows the creation and modification of namespaces directly from the wiki, using a special page called Special:ManageNamespaces.
The namespace definition is in JSON format and stored on the filesystem of your MediaWiki installation.
This allows for namespaces to be defined without needing to define them on LocalSettings.php using $wgExtraNamespaces
.
Eventually, the special page will allow for simpler management of namespaces using a form rather than editing the raw JSON file.
There was an "extension" with this same name (actually, it was a helper library) many years ago, but it has not been maintained for many years and has been archived. Therefore, this extension now uses this name.
Installation
- <translate> <tvar name=1>Download from GitHub</tvar> and place the file(s) in a directory called <tvar name=name>
NamespaceManager
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'NamespaceManager' );
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Be sure that the place where your JSON files are stored is writeable by the web server. If you are using default settings, the directory will be /path/to/mediawiki/extensions/NamespaceManager/data/namespaces.json
. On Apache 2 on a Debian distro, writeability can be achieved by running the following command from your MediaWiki installation's base directory: chown -R www-data:www-data extensions/NamespaceManager/data && chmod -R u+rwx extensions/NamespaceManager/data
.
Configuration parameters
- $wgNamespaceManagerDataPath
- The location where your NamespaceManager JSON definition files are stored. (It was called $wgNamespaceManagerDir before 0.3.0, but was renamed in 0.3.0 for sake of correct nomenclature.) By default, it is defined as
data/namespaces.json
. You can change this to be either an absolute path anywhere on your filesystem or a relative path rooted in the NamespaceManager base directory and use$1
in the path, where$1
is the value of$wgDBname
of your wiki.
Defining namespaces
Namespaces should be defined in JSON format. It can be defined either using Special:ManageNamespaces or manually by editing the namespaces.json
JSON file.
See data/namespaces.sample.json
for an example of how to define a namespaces.json
file.
For instance, you can create a file in the following format:
[ { "id": 3000, "name": "Property", "content": true, "visualeditor": false, "searchdefault": true, "talksearchdefault": false, "subpages": false, "talksubpages": true, "includable": true, "talkincludable": false, "aliases": ["Properties"], "talkaliases": ["Properties talk"], "editpermissions": [], "talkeditpermissions": ["propertymanagers"] }, { "id": 3002, "name": "Human Resources", "talkname": "Human Resources discussion", "content": false, "visualeditor": true, "searchdefault": true, "talksearchdefault": false, "subpages": true, "talksubpages": true, "includable": true, "talkincludable": false, "aliases": ["HR"], "talkaliases": ["Human Resources talk", "HR discussion"], "editpermissions": ["hrstaff"], "talkeditpermissions": ["hrmanagers"] } ]
This would create four namespaces: Property, Property talk, Human Resources, and Human Resources talk, with IDs 3000, 3001, 3002, and 3003 respectively.
The required attributes for each namespace are:
- id
- name
All custom namespaces defined in the JSON file must indeed be custom namespaces, and the ID must be within the range 3000-4998 and be an even number; otherwise, the extension will fail.
As always with managing custom namespaces, it's a bad idea to remove namespaces if you already have pages under that namespace. If you insist on removing that namespace, all pages should first be cleared from under that namespace.
Change log
- 0.4.1: Added support for enabling VisualEditor on domains
- 0.4.0: Added a special page for editing the namespaces.json file directly from the wiki
- 0.3.0: To allow for more versatility and removing the requirement for custom namespaces to be assigned contiguously and in the order in which namespaces are listed on the JSON file, explicit ID definition was introduced. (However, the developer strongly advises against messing with the order unless there is a very good reason to do so.)
To-do list
- Add a form to the special page to easily manage namespaces
- Add support for
$smwgNamespacesWithSemanticLinks
- Add support for other extensions to integrate to use NamespaceManager
- Add support for storing JSON configuration in the wiki using Extension:JsonConfig
Questions about the direction of the extension
- Should talk namespaces be represented by an entirely different object? No
- Should we let people arbitrarily pick the namespace ID if they don't want to start at 3000 and increment up methodically? Yes - as of 0.3.0
- Should this extension also provide an option to manage the default namespaces' options?
- What should the special page look like?
See also
File:OOjs UI icon information-progressive.svg | <translate> This extension is included in the following wiki farms/hosts and/or packages:</translate>
<translate> This is not an authoritative list.</translate> <translate> Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here.</translate> <translate> Always check with your wiki farms/hosts or bundle to confirm.</translate> |
- Pages with script errors
- Pages with broken file links
- Experimental extensions
- Extensions without an image
- Personalization extensions
- Extensions with master compatibility policy
- Extensions with manual MediaWiki version
- Extensions supporting Composer
- GPL licensed extensions
- Extensions in GitHub version control
- CanonicalNamespaces extensions
- MediaWikiServices extensions
- All extensions
- Extensions by MyWikis