From 046ec657602ea46e7b32d3f3e387104d89ac6d8a Mon Sep 17 00:00:00 2001 From: Barak Korren Date: Mon, 1 Apr 2013 18:32:05 +0300 Subject: Move tuning settings to different file so config.php isn't overcrowded by default --- include/functions.php | 21 +++++++++++++++++++++ include/sanity_config.php | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/functions.php b/include/functions.php index fa63c9baa..7d1cf6b9a 100644 --- a/include/functions.php +++ b/include/functions.php @@ -30,6 +30,27 @@ require_once 'config.php'; + /** + * Define a constant if not already defined + * + * @param string $name The constant name. + * @param mixed $value The constant value. + * @access public + * @return boolean True if defined successfully or not. + */ + function define_default($name, $value) { + // Note: performence freaks should define everything in + // tunables.php in config.php becasue if will make defined() + // run much faster, see 'tris+php at tfconsulting dot com dot + // au' comment here: + // http://www.php.net/manual/en/function.defined.php#89886 + defined($name) or define($name, $value); + } + + // Require tunables.php to define tunable constants (That may have + // already been denied in config.php) + require_once 'tunables.php'; + if (DB_TYPE == "pgsql") { define('SUBSTRING_FOR_DATE', 'SUBSTRING_FOR_DATE'); } else { diff --git a/include/sanity_config.php b/include/sanity_config.php index d6be42f26..cb1c1e8ca 100644 --- a/include/sanity_config.php +++ b/include/sanity_config.php @@ -1,3 +1,3 @@ - +$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'PUBSUBHUBBUB_HUB', 'PUBSUBHUBBUB_ENABLED', 'SPHINX_ENABLED', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SESSION_CHECK_ADDRESS', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'SMTP_HOST', 'SMTP_PORT', 'SMTP_LOGIN', 'SMTP_PASSWORD', 'CHECK_FOR_NEW_VERSION', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'CONFIG_VERSION'); ?> -- cgit v1.2.3