10.9. Config.php variables

Some site options cannot be set in the administration area but need to be updated directly on the server in the config.php file. In this section, you see the settings that are possible and why you might want to include them in your config.php file for your site.

The config.php file sits in the /htdocs directory of your site. If you want to view all possible variables and their default values, you can find them in /htdocs/lib/config-defaults.php. You can overwrite any default values by placing the variable in your config.php file.

10.9.1. Anatomy of a config variable

A configuration variable needs to be written in the correct syntax in order to function. In Mahara, this is done the following way: $cfg->variable = value;.

A typical configuration variable

A typical configuration variable

  1. $cfg->: Stands for „configuration“ and indicates that what follows is a configuration variable.
  2. variable =: Here you see the variable that is to be set. Generally, it consists of one word, or words are joined together with underscores. The variable cannot contain any spaces.
  3. value;: The value that the variable takes is displayed. The values can be different things, for example:
    • „true“ or „false“
    • text
    • numbers
    • file path

Bemerkung

If you want to change the default behaviour of a variable in your instance of Mahara, copy it from the config-defaults.php file into your config.php file so it won’t get overwritten when you update the codebase. The config.php file is never changed by an update or upgrade of Mahara.

10.9.2. openbadgedisplayer_source: Open Badges displayer sources

$cfg->openbadgedisplayer_source = '{"shortname":"url","shortname":"url"}';

In order to display Open Badges in the „Open Badges“ block, the sites that host the badges need to be configured. Per default, the Mozilla Backpack and the Open Badge Passport can be connected to. If you have other sources, you would need to add them to the allowed sources.

10.9.3. passwordsaltmain: Set a site-wide password salt

$cfg->passwordsaltmain = 'your secret phrase here';

A password salt helps „hash“ passwords more securely in the database to make hacking them more difficult. Using a phrase is a good start. Passwords are already not displayed in plain text in the database, they are hashed. The salt helps randomise that even more.

If you don’t have a password salt set, you see a warning on the „Admin home“ page.

10.9.4. pathtoclam: Path to virus scanner ClamAV

$cfg->pathtoclam = '/path/to/your/clamscan';

If you are running the antivirus engine ClamAV on your server and don’t scan for viruses on the system level, you can let Mahara know where to find it so files that are uploaded are scanned. For security reasons, the path to ClamAV on your server needs to be provided in the config.php file.

You can see the path that has been set in the „Security settings“.

10.9.5. probationenabled: Give users probation status

$cfg->probationenabled = true; or $cfg->probationenabled = false;

If $cfg->probationenabled = true;, you should set $cfg->probationstartingpoints = 2; as well.

You can set a spam probation level for your users to prevent self-registered users from posting spam especially on a public site. Use the following two variables to do that:

  • $cfg->probationenabled = true;: This setting decides whether users can be put on probation.
  • $cfg->probationstartingpoints = 2;: This setting determines how many probation points a newly self-registered user has per default. In this example, users would get two probation points that they need to get rid off before all functionality is available to them.

You can change the probation points individually on the user’s account settings page in the Administration.

10.9.6. remoteavatarbaseurl: Remote avatar server URL

$cfg->remoteavatarbaseurl = 'http://example.com/avatar/';

Profile pictures of your users can be pulled from an avatar service such as Gravatar. If you run your own service. e.g. Libravatar, you can point Mahara directly to it with this configuration variable.

You decide in the „User settings“ whether remote avatars can be displayed or not.

10.9.7. renamecopies: Rename copied pages and collections

$cfg->renamecopies = true; or $cfg->renamecopies = false;

The site administrator can decide to add „Copy of…“ for copied pages and collections. If $cfg->renamecopies = true;, copies of new pages and collections will have „Copy of“ prepended to their titles. The default setting is $cfg->renamecopies = false;.

10.9.8. showloginsideblock: Show or hide the login sideblock

$cfg->showloginsideblock = true; or $cfg->showloginsideblock = false;

You can hide the login form by adding the value $cfg->showloginsideblock = false; to your config.php file. Once you have done that, only a link to the login form is displayed for an administrator or other users with internal Mahara accounts to log into the site.

Link to the login form

Link to the login form

This is useful if you have single sign-on set up and automatically log in to Mahara via another site.

Per default, the value is set to „true“ so that the login sideblock is displayed.

10.9.9. sitethemeprefs: Choose your browse theme from any theme

$cfg->sitethemeprefs = true; or $cfg->sitethemeprefs = false;

If the site administrator allowed it, you can choose any theme that is available to you as your browse theme on your „Account settings“ page. In that case, you are not restricted to only use your institution theme or if you are a member of multiple institutions choose between them.

10.9.10. skins: Skins

$cfg->skins = true; or $cfg->skins = false;

You can allow your users to personalise their portfolio pages beyond choosing a theme. This is done via skins in Mahara. Skins can be created on the site level or by individuals. Institutions can allow or deny the use of skins for their users.

10.9.11. new in Mahara 16.04 urlsecret: Run the cron or upgrade only when you are authorised

$cfg->urlsecret = 'somesecret';

Without this configuration variable, anybody can run the cron job (scheduled tasks) on your site or an upgrade potentially causing problems.

Place this variable into your config.php file to overwrite the default value. Choose your own secret phrase (enclose it with single quotation marks) that only select few people know who are allowed to run the cron or an upgrade.

Whenever you want to run the cron or perform an upgrade, you need to add your secret word at the end of the URL. The URLs for the cron and the upgrade look like this then (replace „somesecret“ with your own secret word):

  • cron: /lib/cron.php?urlsecret=somesecret
  • upgrade: /admin/upgrade.php?urlsecret=somesecret

Bemerkung

When you have a developer instance or a test server that is behind a firewall, you may not want to add the urlsecret every time, especially when you are the only once who has access to those sites. You could put $cfg->urlsecret = null; into the config.php files for these sites and circumvent the requirement of entering a secret phrase. However, you should not use that on a production site or any other site that is accessible to many people.

10.9.12. usersuniquebyusername: The internal Mahara username prevails when connecting external authentication methods

$cfg->usersuniquebyusername = true; or $cfg->usersuniquebyusername = false;

This is an experimental feature. When turned on, this setting means that it does not matter which other application the user SSOs from, they will be given the same account in Mahara as the internal username is matched and the remote username ignored.