Configuration

padams edited this page Jan 28, 2015 · 1 revision

OWA can be configured in a variety of ways to meet the needs of your application(s).

Configuration File

owa-config.php is OWA's main configuration file. This file can be created manually prior to an installation by simply copying owa-config-dist.php to owa-config.php in the same directory.

This configuration file is where OWA gets information about the database that it should connect to as well as a few other global configuration settings.

Configuration Constants

The following convenience constants are included in your config file and should be used to setup certain aspects of your OWA instance.

_OWA_PUBLIC_URL This is the web URL of OWA's base directory. This value must always end with a "/" (e.g. http://yourdomain/path/to/owa/).

OWA_ERROR_HANDLER This setting controls which of OWA's error handlers should be used. This value defaults to "production". Set this to "development" if you are trying to Debugging OWA.

OWA_LOG_PHP_ERRORS This will log all of PHP's errors/notices to OWA's errors.txt log file. This is handy for Debugging.

OWA_CACHE_OBJECTS This settings turns on and off OWA's object caching system.

Changing other Settings

Instance wide configuration values can be set via the configuration file. To set a value use the $this->set() method and pass it the following arguments:

  • name of the module that houses the setting your wish to change
  • the key (or name) of the setting
  • the value you wish to change it to.

For example:

$this->set('base, 'mailer-from', 'owa@myinstance.com');

Base Module Configuration Settings

The default values for the base modules configuration settings are located in the following file: ...modules/base/classes/settings.php

Settings Management Screen

Many of OWA's settings can be controlled via the Settings Management user interface. This screen is accessed from within the OWA user interface and allows Administrators to customize many of OWA's default settings and behavior.

Changing Settings from within PHP Code

All of OWA's settings can be accessed and changed using the API methods owa_coreAPI::getSetting() and owa_coreAPI::setSetting() methods.

owa_coreAPI::setSetting('modulename', 'somesetting', 'somevalue');

If you need to persist a setting to the database use the owa_coreAPI::persistSetting() method like so:

owa_coreAPI::setSetting('modulename', 'somesetting', 'somevaluetobestored');

In addition to the these convenience methods, you can also access settings via OWA's global configuration object like so:

// fetch the global config object
$config = owa_coreAPI::configSingleton();
// get a setting
$setting = $config->get('somemodule', 'somesetting');
// change a setting (just for the current PHP process)
$config->set('somemodule', 'somesetting', 'newvalue');
// change a setting and store it to the database
$config->persistSetting('somemodule', 'somesetting', 'newvalue');
$config->save();