]> git.wh0rd.org - tt-rss.git/commitdiff
Move tuning settings to different file so config.php isn't overcrowded
authorBarak Korren <barak.korren@gmail.com>
Mon, 1 Apr 2013 15:32:05 +0000 (18:32 +0300)
committerBarak Korren <barak.korren@gmail.com>
Mon, 1 Apr 2013 15:32:05 +0000 (18:32 +0300)
by default

config.php-dist
include/functions.php
include/sanity_config.php
tunables.php [new file with mode: 0644]

index 72320bc5f7d19d6cd6993b8488facbf505d83fc2..6561ecbd4ffcf6029a6c0ecd00169a5b6eb4d5c9 100644 (file)
        // These two options enable SMTP authentication when sending
        // outgoing mail. Only used with SMTP_HOST
 
-       // **************************************
-       // *** Update proces tuning settings  ***
-       // **************************************
-
-       define('FEED_FETCH_TIMEOUT', 45);
-       // How may seconds to wait for response when requesting feed from a site
-       // You may need to decease this if you see errors like "MySQL server
-       // has gone away" pop up in your feed update logs after fetching feeds
-       // from slow websites
-
-       define('FEED_FETCH_NO_CACHE_TIMEOUT', 15);
-       // How may seconds to wait for response when requesting feed from a
-       // site when that feed wasn't cached before
-
-       define('FILE_FETCH_TIMEOUT', 45);
-       // Default timeout when fetching files from remote sites
-
-       define('FILE_FETCH_CONNECT_TIMEOUT', 15);
-       // How many seconds to wait for initial response from website when
-       // fetching files from remote sites
-
        // ***************************************
        // *** Other settings (less important) ***
        // ***************************************
index fa63c9baac842df1b7c5f4ee0ebca10c48fc7037..7d1cf6b9a5800f1fcd52576f7be2faf4c53058dc 100644 (file)
 
        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 {
index d6be42f26928f998c9ccbed672dcdb0ac2ad05fc..cb1c1e8cad1f5d9a6fbfd3fc15b7df1e57db4160 100644 (file)
@@ -1,3 +1,3 @@
-<?php # This file has been generated at:  Mon Apr 1 15:06:12 IDT 2013
+<?php # This file has been generated at:  Mon Apr 1 18:30:54 IDT 2013
 define('GENERATED_CONFIG_CHECK', 26);
-$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', 'FEED_FETCH_TIMEOUT', 'FEED_FETCH_NO_CACHE_TIMEOUT', 'FILE_FETCH_TIMEOUT', 'FILE_FETCH_CONNECT_TIMEOUT', 'CHECK_FOR_NEW_VERSION', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'CONFIG_VERSION'); ?>
+$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'); ?>
diff --git a/tunables.php b/tunables.php
new file mode 100644 (file)
index 0000000..6de0e27
--- /dev/null
@@ -0,0 +1,28 @@
+<?php 
+       // this file contains default values for various setting that can be 
+       // overridden in config.php
+       // It shoule always be "require()"-d after config.php to allow 
+       // overriding, so please do not "require()" this file directly, it is 
+       // alrady properly included from functions.php
+
+       // **************************************
+       // *** Update proces tuning settings  ***
+       // **************************************
+
+       define_default('FEED_FETCH_TIMEOUT', 45);
+       // How may seconds to wait for response when requesting feed from a site
+       // You may need to decease this if you see errors like "MySQL server
+       // has gone away" pop up in your feed update logs after fetching feeds
+       // from slow websites
+
+       define_default('FEED_FETCH_NO_CACHE_TIMEOUT', 15);
+       // How may seconds to wait for response when requesting feed from a
+       // site when that feed wasn't cached before
+
+       define_default('FILE_FETCH_TIMEOUT', 45);
+       // Default timeout when fetching files from remote sites
+
+       define_default('FILE_FETCH_CONNECT_TIMEOUT', 15);
+       // How many seconds to wait for initial response from website when
+       // fetching files from remote sites
+?>