Open main menu

Meza/Public config

public.ymlEdit

public.yml is the primary configuration file for Meza. It holds settings that are okay to display publicly, in contrast to secret.yml that holds sensitive information. public.yml can be used to override anything in defaults.yml. See defaults.yml on Meza's GitHub repository.

Modifying LocalSettings.phpEdit

Meza generates LocalSettings.php each time meza deploy is run, and therefore it is not possible to directly edit LocalSettings.php. Instead, configuration set in public.yml defines how LocalSettings.php will look. However, because MediaWiki has an essentially infinite number of settings that Meza can't possibly account for, Meza has the ability to add to the beginning and end of LocalSettings.php via two directories.

For example, if you make a small change to the LocalSettings that does not include adding a new extension or modifying the database, you would want to deploy the change by running the following:

sudo meza deploy monolith --tags mediawiki --skip-tags latest,update.php,verify-wiki,smw-data,search-index,parsoid,mediawiki-core

See Meza/Commands for more info.

preLocalSettings.dEdit

Any .php file within /opt/conf-meza/public/preLocalSettings.d/ will be included at the top of LocalSettings.php .

postLocalSettings.dEdit

The directory /opt/conf-meza/public/postLocalSettings.d works similarly to preLocalSettings.d in that any *.php file in that directory will be appended to LocalSettings.php. However, this directory's files will be loaded at the end of LocalSettings.php, and as such it is useful to override Meza's defaults, or defaults set by extensions.

Adding extensionsEdit

Settings for individual wikisEdit

Within the public configuration directory (/opt/conf-meza/public) there is a subdirectory wikis/. This holds the individual configurations for each wiki. These directories hold the image file logo.png which is the logo in the top left of each wiki. Similarly you can modify favicon.ico here. Additionally, each wiki can have pre-LocalSettings.php and post-LocalSettings.php files that are loaded just for that wiki, in the same way as described above for all wikis. See section #Modifying_LocalSettings.php.

preLocalSettings.dEdit

Any .php file within /opt/conf-meza/public/wikis/<wikiID>/preLocalSettings.d/ will be included at the top of LocalSettings.php only for that wiki.The file /opt/conf-meza/public/wikis/<wikiID>/preLocalSettings.d/base.php exists by default in Meza, and by default holds the following information:

  • $wgSitename = 'Your wiki name';
  • $mezaDebug is used to turn debug settings on for all wikis
  • $mezaEnableWikiEmail is used to define whether email should be turned on

One common addition to this file is $mezaAuthType. This is a quick way to apply common permissions schemes. For example, $mezaAuthType can be set in to the following:

  • anon-edit: Allow anonymous users to edit your wiki without logging in
  • anon-read: Allow anonymous users to view, but not edit, your wiki without logging in
  • user-edit: Only logged in users can view and edit
  • user-read: Only logged in users can view, but not just anyone can edit. Users must be in group Contributor to be able to edit.
  • viewer-read: Even if a user has a valid username, they cannot view the wiki. They must first be added to the group Viewer. Additionally, in order to edit, users must be in the group Contributor.

The above permissions schemes are in ascending order of restrictiveness.

postLocalSettings.dEdit

The directory /opt/conf-meza/public/wikis/<wikiID>/postLocalSettings.d works similarly to preLocalSettings.d in that any *.php file in that directory will be appended to LocalSettings.php only for that wiki.

Generating a properly sized logo.png and favicon.ico from a fileEdit

To generate properly-sized logo.png and favicon.ico from an existing larger image file, see issue #410 on GitHub.

Example: Adding a custom namespace to a wikiEdit

If the wiki's ID was opot, add the following to that wiki's preLocalSettings, /opt/conf-meza/public/wikis/opot/preLocalSettings.d/base.php:

// first define namespace constants. If you have a lot of wikis, and there's 
// possibility that you may want to have the same namespaces across wikis at
// some point, or even merge wikis together, you may want to put these in
// preLocalSettings for all wikis, e.g. 
// /opt/conf-meza/public/preLocalSettings.d/namespaceconstants.php
define("NS_MYNAMESPACE", 3000);
define("NS_MYNAMESPACE_TALK", 3001);

$wgExtraNamespaces[NS_MYNAMESPACE] = "My_namespace";
$wgExtraNamespaces[NS_MYNAMESPACE_TALK] = "My_namespace_talk";
$wgContentNamespaces[] = NS_MYNAMESPACE;

And create a postLocalSettings file like /opt/conf-meza/public/wikis/opot/postLocalSettings.d/customnamespace.php if you want the content searched by default:

$wgNamespacesToBeSearchedDefault[NS_MYNAMESPACE] = true;