<?php
namespace PartKeepr;

use PartKeepr\Util\Configuration;

/**
 * Specifies the username for the database
 */
Configuration::setOption("partkeepr.database.username", "partkeepr");

/**
 * Specifies the password for the database
 */
Configuration::setOption("partkeepr.database.password", "partkeepr");

/**
 * Specifies the hostname for the database
 */
Configuration::setOption("partkeepr.database.host", "localhost");

/**
 * Specifies the database name
 */
Configuration::setOption("partkeepr.database.dbname", "partkeepr");

/**
 * Specifies the database port.
 * Doesn't need to be specified. "null" specifies the default port.
 */
Configuration::setOption("partkeepr.database.port", null);

/**
 * Specifies the MySQL unix socket to use
 */
Configuration::setOption("partkeepr.database.mysql_socket", null);



/**
 * Specifies the database driver.
 * 
 * In general, we support any database platform also supported by DBAL. For details, see
 * http://www.doctrine-project.org/docs/dbal/2.0/en/reference/configuration.html#driver
 * 
 * Available drivers:
 * pdo_mysql	MySQL is preferred, as all development happens on that platform.
 * pdo_pgsql	PostgreSQL should perform well, but could give problems here and there. Be sure to report these bugs!
 * pdo_sqlite	SQLite driver; mostly untested
 * pdo_oci		PDO-based Oracle driver; mostly untested. Seems to give problems; try oci8 instead
 * pdo_sqlsrv	MSSQL driver; mostly untested
 * oci8			A driver which uses the PHP oci8 extension
 * 
 * WARNING: Some database drivers require configuration options, which we don't support yet. We currently
 * only push the parameters "username", "password", "hostname" and "dbname" into DBAL's configuration. We need to rework
 * this; until then, at least pdo_sqlite won't work.
 */
Configuration::setOption("partkeepr.database.driver", "pdo_mysql");


/***********************************************************************************************************************
 * CONFIGURATION SETTINGS FOR MIGRATING FROM PARTDB TO PARTKEEPR. LEAVE UNTOUCHED IF YOU DON'T HAVE PARTDB TO MIGRATE
 **********************************************************************************************************************/
Configuration::setOption("partkeepr.migration.partdb.hostname", "localhost");
Configuration::setOption("partkeepr.migration.partdb.username", "partdb");
Configuration::setOption("partkeepr.migration.partdb.password", "partdb");
Configuration::setOption("partkeepr.migration.partdb.dbname", 	"partdb");
 
/***********************************************************************************************************************
 * END OF THE GENERAL CONFIGURATION SECTION - BELOW ARE CONFIGURATION SETTINGS WHICH USUALLY DON'T NEED TO BE ADJUSTED
 **********************************************************************************************************************/


/**
 * Specifies if doctrine should log the SQL queries by echoing them. If you enable this, all AJAX service calls from the
 * frontend will fail because the resulting output isn't JSON anymore.
 */
Configuration::setOption("partkeepr.database.echo_sql_log", false);

/**
 * Specifies the location of the uploaded files
 */
Configuration::setOption("partkeepr.files.path", __DIR__."/data/files/");

/**
 * Specifies the location of the uploaded images
 */
Configuration::setOption("partkeepr.images.path", __DIR__."/data/images/");

/**
 * Specifies the cache dir
 */
Configuration::setOption("partkeepr.images.cache", Configuration::getOption("partkeepr.images.path")."cache/");

/**
 * Specifies if auto login is wanted or not
 */
Configuration::setOption("partkeepr.frontend.autologin.enabled", false);

/**
 * Specifies the auto login username
 */
Configuration::setOption("partkeepr.frontend.autologin.username", null);

/**
 * Specifies the auto login password
 */
Configuration::setOption("partkeepr.frontend.autologin.password", null);

/**
 * Specifies if frontend debugging should be turned on. This will create a non-minified, single JS file
 * out of all source files
 */
Configuration::setOption("partkeepr.frontend.debug", false);

/**
 * Specifies if the frontend should load each single JS file individually, in contrast to merging all JS files
 * into partkeepr-debug.js.
 */
Configuration::setOption("partkeepr.frontend.debug_all", false);

/**
 * Specifies if cronjobs should be checked. Disable this on Windows unless we have an automatic cronjob runner
 * emulation implemented.
 */
Configuration::setOption("partkeepr.cronjobs.disablecheck", false);

/**
 * Specifies if password changing is allowed.
 */
Configuration::setOption("partkeepr.frontend.allow_password_change", true);

/**
 * Specifies the separator for category paths. If you change this, you need to rebuild the category paths by
 * executing the script scripts/UpdateCategoryPathCache.php
 */
Configuration::setOption("partkeepr.category.path_separator", " ➤ ");

/**
 * Set to true if authentication via HTTP is wanted.
 *
 * Authentication is then completely handled by your web server. Non-existant users are created automatically.
 * Make sure you have admin rights transferred prior switching to HTTP auth.
 *
 * As soon as you set HTTP auth, you can no longer login and logout in PartKeepr, as this is handled by your web server.
 */
Configuration::setOption("partkeepr.auth.http", false);

/**
 * Set to true if logging is wanted.
 *
 * If you leave as-is or set to false, no log will be written at all. If you set this to true, a log will be written
 * to the file specified by partkeepr.logger.outputfile. You need to make sure that the path to the file exists and
 * that the file is writable.
 */
Configuration::setOption("partkeepr.logger.enable", false);

/**
 * Specifies the log file for the logger. If you enable logging and specify no outputfile, the default will be
 * /tmp/partkeepr.log.
 *
 * You need to make sure that the path to the file exists and that the file is writable.
 */
Configuration::setOption("partkeepr.logger.outputfile", "/tmp/partkeepr.log");

/**
 * Specifies the cache implementation. You can choose from one of these:
 * 
 * - none
 * - APC
 * - MemCache
 * - XCache
 * 
 * Please note that you need additional options for memcache.
 */
Configuration::setOption("partkeepr.cache.implementation", "APC");

/**
 * Specifies the memcache hostname. Defaults to localhost
 */
Configuration::setOption("partkeepr.cache.memcache.host", "localhost");

/**
 * Specifies the memcache port. Defaults to 11211
 */
Configuration::setOption("partkeepr.cache.memcache.port", "11211");
