<?php

//
// Open Web Analytics - An Open Source Web Analytics Framework
//
// Copyright 2006 Peter Adams. All rights reserved.
//
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id$
//

/**
 * OWA Configuration
 * 
 * @author      Peter Adams <peter@openwebanalytics.com>
 * @copyright   Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>
 * @license     http://www.gnu.org/copyleft/gpl.html GPL v2.0
 * @category    owa
 * @package     owa
 * @version        $Revision$
 * @since        owa 1.0.0
 */
 
/**
 * DATABASE CONFIGURATION
 *
 * Connection info for databases that will be used by OWA.
 *
 */

define('OWA_DB_TYPE', 'mysql'); // options: mysql
define('OWA_DB_NAME', '[[softdb]]'); // name of the database
define('OWA_DB_HOST', '[[softdbhost]]'); // host name of the server housing the database
define('OWA_DB_USER', '[[softdbuser]]'); // database user
define('OWA_DB_PORT', '3306'); // port of database
define('OWA_DB_PASSWORD', '[[softdbpass]]'); // database user's password

/**
 * OPTIONAL DATABASE SETTINGS
 *
 * OWA_DB_SQL_MODE -- the session sql_mode.
 *
 * Defaults to STRICT_ALL_TABLES, under which the database REFUSES a value that
 * does not fit rather than silently trimming it. A silent trim is data you
 * never learn you lost, which is why refusing is the default.
 *
 * Set it empty to restore the older permissive behaviour:
 *
 *      define('OWA_DB_SQL_MODE', '');
 *
 * Character encoding is NOT set here. The connection negotiates the widest
 * encoding automatically, and each table's encoding belongs to the entity that
 * defines it -- see Entity::setCharacterEncoding().
 */
/**
 * AUTHENTICATION KEYS AND SALTS
 *
 * Change these to different unique phrases.
 */
define('OWA_NONCE_KEY', '[[OWA_NONCE_KEY]]');
define('OWA_NONCE_SALT', '[[OWA_NONCE_SALT]]');
define('OWA_AUTH_KEY', '[[OWA_AUTH_KEY]]');
define('OWA_AUTH_SALT', '[[OWA_AUTH_SALT]]');

/**
 * PUBLIC URL
 *
 * Define the URL of OWA's base directory e.g. http://www.domain.com/path/to/owa/
 * Don't forget the slash at the end.
 */
 
define('OWA_PUBLIC_URL', '[[softurl]]/');

/**
 * OWA ERROR HANDLER
 *
 * Overide OWA error handler. This should be done through the admin GUI, but
 * can be handy during install or development.
 * 
 * Choices are:
 *
 * 'production' - will log only critical errors to a log file.
 * 'development' - logs al sorts of useful debug to log file.
 */

//define('OWA_ERROR_HANDLER', 'development');

/**
 * LOG PHP ERRORS
 *
 * Log all php errors to OWA's error log file. Only do this to debug.
 */

//define('OWA_LOG_PHP_ERRORS', true);
 
/**
 * OBJECT CACHING
 *
 * Override setting to cache objects. Caching will increase performance.
 */

//define('OWA_CACHE_OBJECTS', true);

/**
 * CONFIGURATION ID
 *
 * Override to load an alternative user configuration
 */

//define('OWA_CONFIGURATION_ID', '1');

/**
 * STATIC CONFIG ONLY
 *
 * When true, OWA does NOT read your saved settings from the owa_configuration
 * database table at boot. It runs on the built-in defaults plus whatever this
 * config file defines. This suppresses the two DB queries every OWA process
 * would otherwise issue on boot (the connection handshake and the config read),
 * so a dedicated logging node that only queues incoming tracking events to a
 * file can accept beacons with zero database access.
 *
 * ONLY enable this on a node whose job is to queue events (see the "Event
 * Queueing" wiki page). Because saved settings are not loaded, any non-default
 * setting such node relies on (tracked sites, the queue type, async_log_dir,
 * etc.) must be pinned here in owa-config.php. Do NOT enable it on the instance
 * that serves reports or the admin UI -- those need the database-backed config.
 */

//define('OWA_USE_STATIC_CONFIG_ONLY', true);


/**
 * SCHEDULED JOBS
 *
 * OWA runs its periodic maintenance from a SINGLE cron entry:
 *
 *   * * * * * cd /path/to/owa && php cli.php cmd=schedule-run
 *
 * Every minute, because that line is not the schedule -- it is the finest
 * resolution the schedules below can use. Each job decides for itself how often
 * it actually runs. A boot costs about 66ms, so a day of ticks is roughly 95
 * seconds of CPU.
 *
 * Out of the box exactly one job is registered: partition-rotate, monthly, with
 * NO arguments -- it extends the fact tables' partition lead and merges old
 * periods to stay within the open-file budget, and never deletes anything.
 *
 * Use OWA_SCHEDULED_JOBS to retune what ships, to add jobs the release does not
 * register, or to turn one off. It is keyed by JOB NAME; 'command' is the CLI
 * command that actually runs. They are separate so one command can be scheduled
 * more than once with different arguments.
 *
 * Overrides are per key: giving only 'params' keeps the shipped schedule, and
 * giving only 'schedule' keeps the shipped arguments.
 *
 * Schedules are standard five-field cron expressions, or the usual @hourly,
 * @daily, @weekly, @monthly and @yearly shorthands, or 'off'. They are read in
 * this installation's configured timezone. An entry that cannot be read disables
 * THAT job and nothing else -- it is never given a default, because running
 * something on a cadence nobody chose is worse than not running it.
 *
 * Check what is registered, and why anything is not running, with:
 *
 *   php cli.php cmd=schedule-status
 */

//define('OWA_SCHEDULED_JOBS', array(
//
//    // Keep two years of history. NOTHING is deleted unless you ask for it
//    // here: the shipped job runs with no keep= at all.
//    'rotate-partitions' => array( 'params' => array( 'keep' => 24 ) ),
//
//    // Drain the event queue every two minutes. Not registered by default,
//    // because whether to drain at all depends on whether you queue events.
//    'drain-queue' => array(
//        'command'  => 'processEventQueue',
//        'schedule' => '*/2 * * * *',
//    ),
//
//    // The same command a second time, under its own name, with its own
//    // arguments and cadence.
//    'rotate-request-table' => array(
//        'command'  => 'partition-rotate',
//        'params'   => array( 'table' => 'owa_request' ),
//        'schedule' => '@weekly',
//    ),
//
//    // Turn a shipped job off.
//    // 'rotate-partitions' => array( 'schedule' => 'off' ),
//));

/**
 * DISABLE THE SCHEDULER
 *
 * Stops every job without touching crontab -- for a migration or an incident.
 */

//define('OWA_SCHEDULER_ENABLED', false);


/**
 * REPORTING TIMEZONE
 *
 * The timezone statistics are bucketed into calendar days with. Defaults to
 * America/Los_Angeles if you set nothing, which is unlikely to be what you want.
 *
 *      define('OWA_TIMEZONE', 'Europe/London');
 *
 * SET THIS BEFORE YOU COLLECT DATA. The choice is not retroactive: each request
 * is filed under a calendar day at the moment it is recorded, using the timezone
 * in force then, and that day is written into the row. Changing it later applies
 * only to new traffic -- existing data keeps the boundaries it was recorded
 * with, and reports spanning the change will mix the two. Depending on how far
 * apart the zones are, a day boundary can move by up to 21 hours.
 *
 * IF YOU SET THIS, IT WINS. The admin UI can also set the timezone (Options ->
 * General), but a constant defined here overrides whatever is stored in the
 * database, for as long as it stays defined. Comment it out again and the stored
 * value takes over.
 *
 * That is true of every constant in this file: define it and it is authoritative;
 * leave it undefined and OWA uses the database value, then the built-in default.
 * The options form will tell you when a setting you are changing is being
 * overridden from here.
 *
 * Use any identifier from https://www.php.net/manual/en/timezones.php. An
 * unrecognised value is ignored rather than applied, because a timezone that
 * silently failed to take effect would file every subsequent request under the
 * wrong day. Note the UI's picker is organised by country and so does not offer
 * UTC -- this constant does.
 */
//define('OWA_TIMEZONE', 'Europe/London');


/**
 * MAXMIND GEOIP LICENCE KEY
 *
 * Only relevant if the Maxmind GeoIP module is activated.
 *
 * The GeoLite2 City database OWA looks IP addresses up in is free, but MaxMind
 * closed anonymous downloads at the end of 2019, so fetching it is
 * authenticated. Create a key at maxmind.com -- the account and the key cost
 * nothing -- and set it here:
 *
 *      $this->set('maxmind_geoip', 'db_license_key', 'your-key-here');
 *
 * That works because this file is included from inside a settings object, so
 * $this is that object. It is not a define() like the settings above.
 *
 * Then refresh the database with:
 *
 *      php cli.php cmd=update-geoip-db
 *
 * The database is worth refreshing periodically. IP ranges move between
 * countries and cities continuously, and a stale file does not fail -- it
 * answers, wrongly, and the reports look normal. MaxMind publish updates twice
 * a week.
 */

?>