From af8960b8b3be3c78573d0319a8a537083fae2d4d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 12 May 2017 23:33:58 +0200 Subject: Move default configuration files https://github.com/FreshRSS/FreshRSS/issues/1531 --- README.fr.md | 2 +- README.md | 2 +- app/FreshRSS.php | 2 +- app/install.php | 4 +- cli/_cli.php | 2 +- config-user.default.php | 75 ++++++++++++++++++++ config.default.php | 152 ++++++++++++++++++++++++++++++++++++++++ data/config.default.php | 152 ---------------------------------------- data/users/_/config.default.php | 75 -------------------- lib/Minz/FrontController.php | 2 +- lib/lib_install.php | 4 +- lib/lib_rss.php | 2 +- p/api/greader.php | 2 +- p/api/index.php | 2 +- p/api/pshb.php | 6 +- 15 files changed, 242 insertions(+), 242 deletions(-) create mode 100644 config-user.default.php create mode 100644 config.default.php delete mode 100644 data/config.default.php delete mode 100644 data/users/_/config.default.php diff --git a/README.fr.md b/README.fr.md index 5e78ad803..b7a28fd91 100644 --- a/README.fr.md +++ b/README.fr.md @@ -52,7 +52,7 @@ Nous sommes une communauté amicale. 4. Accédez à FreshRSS à travers votre navigateur Web et suivez les instructions d’installation * ou utilisez [l’interface en ligne de commande](./cli/README.md) 5. Tout devrait fonctionner :) En cas de problème, n’hésitez pas à [nous contacter](https://github.com/FreshRSS/FreshRSS/issues). -6. Des paramètres de configuration avancée peuvent être accédés depuis [config.php](./data/config.default.php). +6. Des paramètres de configuration avancée peuvent être vues dans [config.default.php](./config.default.php) et modifiées dans `data/config.php`. ## Installation automatisée * [![DP deploy](https://raw.githubusercontent.com/DFabric/DPlatform-ShellCore/gh-pages/img/deploy.png)](https://dfabric.github.io/DPlatform-ShellCore) diff --git a/README.md b/README.md index 4c50acdd7..8e0d8bac9 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ We are a friendly community. 4. Access FreshRSS with your browser and follow the installation process * or use the [Command-Line Interface](./cli/README.md) 5. Everything should be working :) If you encounter any problem, feel free [contact us](https://github.com/FreshRSS/FreshRSS/issues). -6. Advanced configuration settings can be seen in [config.php](./data/config.default.php). +6. Advanced configuration settings can be seen in [config.default.php](./config.default.php) and modified in `data/config.php`. ## Automated install * [![Install on Cloudron](https://cloudron.io/img/button.svg)](https://cloudron.io/button.html?app=org.freshrss.cloudronapp) diff --git a/app/FreshRSS.php b/app/FreshRSS.php index e4caf23d1..563393c90 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -41,7 +41,7 @@ class FreshRSS extends Minz_FrontController { $current_user = Minz_Session::param('currentUser', '_'); Minz_Configuration::register('user', join_path(USERS_PATH, $current_user, 'config.php'), - join_path(USERS_PATH, '_', 'config.default.php'), + join_path(FRESHRSS_PATH, 'config-user.default.php'), $configuration_setter); // Finish to initialize the other FreshRSS / Minz components. diff --git a/app/install.php b/app/install.php index ebfffa47d..9e474ca73 100644 --- a/app/install.php +++ b/app/install.php @@ -88,13 +88,13 @@ function saveStep1() { // First, we try to get previous configurations Minz_Configuration::register('system', join_path(DATA_PATH, 'config.php'), - join_path(DATA_PATH, 'config.default.php')); + join_path(FRESHRSS_PATH, 'config.default.php')); $system_conf = Minz_Configuration::get('system'); $current_user = $system_conf->default_user; Minz_Configuration::register('user', join_path(USERS_PATH, $current_user, 'config.php'), - join_path(USERS_PATH, '_', 'config.default.php')); + join_path(FRESHRSS_PATH, 'config-user.default.php')); $user_conf = Minz_Configuration::get('user'); // Then, we set $_SESSION vars diff --git a/cli/_cli.php b/cli/_cli.php index f5e36eabc..1b26ea738 100644 --- a/cli/_cli.php +++ b/cli/_cli.php @@ -8,7 +8,7 @@ require(LIB_PATH . '/lib_rss.php'); Minz_Configuration::register('system', DATA_PATH . '/config.php', - DATA_PATH . '/config.default.php'); + FRESHRSS_PATH . '/config.default.php'); FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); Minz_Translate::init('en'); diff --git a/config-user.default.php b/config-user.default.php new file mode 100644 index 000000000..f28ef9724 --- /dev/null +++ b/config-user.default.php @@ -0,0 +1,75 @@ + 'en', + 'old_entries' => 3, + 'keep_history_default' => 50, + 'ttl_default' => 3600, + 'mail_login' => '', + 'token' => '', + 'passwordHash' => '', + 'apiPasswordHash' => '', + 'posts_per_page' => 20, + 'since_hours_posts_per_rss' => 168, + 'min_posts_per_rss' => 2, + 'max_posts_per_rss' => 400, + 'view_mode' => 'normal', + 'default_view' => 'adaptive', + 'default_state' => FreshRSS_Entry::STATE_NOT_READ, + 'auto_load_more' => true, + 'display_posts' => false, + 'display_categories' => false, + 'hide_read_feeds' => true, + 'onread_jump_next' => true, + 'lazyload' => true, + 'sticky_post' => true, + 'reading_confirm' => false, + 'auto_remove_article' => false, + + # In the case an article has changed (e.g. updated content): + # Set to `true` to mark it unread, or `false` to leave it as-is. + 'mark_updated_article_unread' => false, //TODO: -1 => ignore, 0 => update, 1 => update and mark as unread + + 'sort_order' => 'DESC', + 'anon_access' => false, + 'mark_when' => array ( + 'article' => true, + 'site' => true, + 'scroll' => true, + 'reception' => false, + ), + 'theme' => 'Origine', + 'content_width' => 'thin', + 'shortcuts' => array ( + 'mark_read' => 'r', + 'mark_favorite' => 'f', + 'go_website' => 'space', + 'next_entry' => 'j', + 'prev_entry' => 'k', + 'first_entry' => 'home', + 'last_entry' => 'end', + 'collapse_entry' => 'c', + 'load_more' => 'm', + 'auto_share' => 's', + 'focus_search' => 'a', + 'user_filter' => 'u', + 'help' => 'f1', + 'close_dropdown' => 'escape', + ), + 'topline_read' => true, + 'topline_favorite' => true, + 'topline_date' => true, + 'topline_link' => true, + 'bottomline_read' => true, + 'bottomline_favorite' => true, + 'bottomline_sharing' => true, + 'bottomline_tags' => true, + 'bottomline_date' => true, + 'bottomline_link' => true, + 'sharing' => array ( + ), + 'queries' => array ( + ), + 'html5_notif_timeout' => 0, + 'extensions_enabled' => array(), +); diff --git a/config.default.php b/config.default.php new file mode 100644 index 000000000..748df1884 --- /dev/null +++ b/config.default.php @@ -0,0 +1,152 @@ + 'production', + + # Used to make crypto more unique. Generated during install. + 'salt' => '', + + # Specify address of the FreshRSS instance, + # used when building absolute URLs, e.g. for PubSubHubbub. + # Examples: + # https://example.net/FreshRSS/p/ + # https://freshrss.example.net/ + 'base_url' => '', + + # Specify address of the FreshRSS auto-update server. + 'auto_update_url' => 'https://update.freshrss.org', + + # Natural language of the user interface, e.g. `en`, `fr`. + 'language' => 'en', + + # Title of this FreshRSS instance in the Web user interface. + 'title' => 'FreshRSS', + + # Meta description used when `allow_robots` is true. + 'meta_description' => '', + + # Name of the user that has administration rights. + 'default_user' => '_', + + # Allow or not visitors without login to see the articles + # of the default user. + 'allow_anonymous' => false, + + # Allow or not anonymous users to start the refresh process. + 'allow_anonymous_refresh' => false, + + # Login method: + # `none` is without password and shows only the default user; + # `form` is a conventional Web login form; + # `http_auth` is an access controled by the HTTP Web server (e.g. `/FreshRSS/p/i/.htaccess` for Apache) + # if you use `http_auth`, remember to protect only `/FreshRSS/p/i/`, + # and in particular not protect `/FreshRSS/p/api/` if you would like to use the API (different login system). + 'auth_type' => 'form', + + # Allow or not the use of the API, used for mobile apps. + # End-point is http://example.net/FreshRSS/p/api/greader.php + # You need to set the user's API password. + 'api_enabled' => false, + + # Allow or not the use of an unsafe login, + # by providing username and password in the login URL: + # http://example.net/FreshRSS/p/i/?c=auth&a=login&u=alice&p=1234 + 'unsafe_autologin_enabled' => false, + + # Enable or not the use of syslog to log the activity of + # SimplePie, which is retrieving RSS feeds via HTTP requests. + 'simplepie_syslog_enabled' => true, + + # Enable or not support of PubSubHubbub. + # /!\ It should NOT be enabled if base_url is not reachable by an external server. + 'pubsubhubbub_enabled' => false, + + # Allow or not Web robots (e.g. search engines) in HTML headers. + 'allow_robots' => false, + + # If true does nothing, if false restricts HTTP Referer via: meta referrer origin + 'allow_referrer' => false, + + 'limits' => array( + + # Duration in seconds of the login cookie. + 'cookie_duration' => 2592000, + + # Duration in seconds of the SimplePie cache, + # during which a query to the RSS feed will return the local cached version. + # Especially important for multi-user setups. + 'cache_duration' => 800, + + # SimplePie HTTP request timeout in seconds. + 'timeout' => 15, + + # If a user has not used FreshRSS for more than x seconds, + # then its feeds are not refreshed anymore. + 'max_inactivity' => PHP_INT_MAX, + + # Max number of feeds for a user. + 'max_feeds' => 16384, + + # Max number of categories for a user. + 'max_categories' => 16384, + + # Max number of accounts that anonymous users can create + # 0 for an unlimited number of accounts + # 1 is to not allow user registrations (1 is corresponding to the admin account) + 'max_registrations' => 1, + ), + + # Options used by cURL when making HTTP requests, e.g. when the SimplePie library retrieves feeds. + # http://php.net/manual/function.curl-setopt + 'curl_options' => array( + # Options to disable SSL/TLS certificate check (e.g. for self-signed HTTPS) + //CURLOPT_SSL_VERIFYHOST => 0, + //CURLOPT_SSL_VERIFYPEER => false, + + # Options to use a proxy for retrieving feeds. + //CURLOPT_PROXYTYPE => CURLPROXY_HTTP, + //CURLOPT_PROXY => '127.0.0.1', + //CURLOPT_PROXYPORT => 8080, + //CURLOPT_PROXYAUTH => CURLAUTH_BASIC, + //CURLOPT_PROXYUSERPWD => 'user:password', + ), + + 'db' => array( + + # Type of database: `sqlite` or `mysql`. + 'type' => 'sqlite', + + # MySQL host. + 'host' => 'localhost', + + # MySQL user. + 'user' => '', + + # MySQL password. + 'password' => '', + + # MySQL database. + 'base' => '', + + # MySQL table prefix. + 'prefix' => 'freshrss_', + + 'pdo_options' => array( + //PDO::MYSQL_ATTR_SSL_KEY => '/path/to/client-key.pem', + //PDO::MYSQL_ATTR_SSL_CERT => '/path/to/client-cert.pem', + //PDO::MYSQL_ATTR_SSL_CA => '/path/to/ca-cert.pem', + ), + + ), + + # List of enabled FreshRSS extensions. + 'extensions_enabled' => array(), + + # Disable self-update, + 'disable_update' => false, +); diff --git a/data/config.default.php b/data/config.default.php deleted file mode 100644 index 748df1884..000000000 --- a/data/config.default.php +++ /dev/null @@ -1,152 +0,0 @@ - 'production', - - # Used to make crypto more unique. Generated during install. - 'salt' => '', - - # Specify address of the FreshRSS instance, - # used when building absolute URLs, e.g. for PubSubHubbub. - # Examples: - # https://example.net/FreshRSS/p/ - # https://freshrss.example.net/ - 'base_url' => '', - - # Specify address of the FreshRSS auto-update server. - 'auto_update_url' => 'https://update.freshrss.org', - - # Natural language of the user interface, e.g. `en`, `fr`. - 'language' => 'en', - - # Title of this FreshRSS instance in the Web user interface. - 'title' => 'FreshRSS', - - # Meta description used when `allow_robots` is true. - 'meta_description' => '', - - # Name of the user that has administration rights. - 'default_user' => '_', - - # Allow or not visitors without login to see the articles - # of the default user. - 'allow_anonymous' => false, - - # Allow or not anonymous users to start the refresh process. - 'allow_anonymous_refresh' => false, - - # Login method: - # `none` is without password and shows only the default user; - # `form` is a conventional Web login form; - # `http_auth` is an access controled by the HTTP Web server (e.g. `/FreshRSS/p/i/.htaccess` for Apache) - # if you use `http_auth`, remember to protect only `/FreshRSS/p/i/`, - # and in particular not protect `/FreshRSS/p/api/` if you would like to use the API (different login system). - 'auth_type' => 'form', - - # Allow or not the use of the API, used for mobile apps. - # End-point is http://example.net/FreshRSS/p/api/greader.php - # You need to set the user's API password. - 'api_enabled' => false, - - # Allow or not the use of an unsafe login, - # by providing username and password in the login URL: - # http://example.net/FreshRSS/p/i/?c=auth&a=login&u=alice&p=1234 - 'unsafe_autologin_enabled' => false, - - # Enable or not the use of syslog to log the activity of - # SimplePie, which is retrieving RSS feeds via HTTP requests. - 'simplepie_syslog_enabled' => true, - - # Enable or not support of PubSubHubbub. - # /!\ It should NOT be enabled if base_url is not reachable by an external server. - 'pubsubhubbub_enabled' => false, - - # Allow or not Web robots (e.g. search engines) in HTML headers. - 'allow_robots' => false, - - # If true does nothing, if false restricts HTTP Referer via: meta referrer origin - 'allow_referrer' => false, - - 'limits' => array( - - # Duration in seconds of the login cookie. - 'cookie_duration' => 2592000, - - # Duration in seconds of the SimplePie cache, - # during which a query to the RSS feed will return the local cached version. - # Especially important for multi-user setups. - 'cache_duration' => 800, - - # SimplePie HTTP request timeout in seconds. - 'timeout' => 15, - - # If a user has not used FreshRSS for more than x seconds, - # then its feeds are not refreshed anymore. - 'max_inactivity' => PHP_INT_MAX, - - # Max number of feeds for a user. - 'max_feeds' => 16384, - - # Max number of categories for a user. - 'max_categories' => 16384, - - # Max number of accounts that anonymous users can create - # 0 for an unlimited number of accounts - # 1 is to not allow user registrations (1 is corresponding to the admin account) - 'max_registrations' => 1, - ), - - # Options used by cURL when making HTTP requests, e.g. when the SimplePie library retrieves feeds. - # http://php.net/manual/function.curl-setopt - 'curl_options' => array( - # Options to disable SSL/TLS certificate check (e.g. for self-signed HTTPS) - //CURLOPT_SSL_VERIFYHOST => 0, - //CURLOPT_SSL_VERIFYPEER => false, - - # Options to use a proxy for retrieving feeds. - //CURLOPT_PROXYTYPE => CURLPROXY_HTTP, - //CURLOPT_PROXY => '127.0.0.1', - //CURLOPT_PROXYPORT => 8080, - //CURLOPT_PROXYAUTH => CURLAUTH_BASIC, - //CURLOPT_PROXYUSERPWD => 'user:password', - ), - - 'db' => array( - - # Type of database: `sqlite` or `mysql`. - 'type' => 'sqlite', - - # MySQL host. - 'host' => 'localhost', - - # MySQL user. - 'user' => '', - - # MySQL password. - 'password' => '', - - # MySQL database. - 'base' => '', - - # MySQL table prefix. - 'prefix' => 'freshrss_', - - 'pdo_options' => array( - //PDO::MYSQL_ATTR_SSL_KEY => '/path/to/client-key.pem', - //PDO::MYSQL_ATTR_SSL_CERT => '/path/to/client-cert.pem', - //PDO::MYSQL_ATTR_SSL_CA => '/path/to/ca-cert.pem', - ), - - ), - - # List of enabled FreshRSS extensions. - 'extensions_enabled' => array(), - - # Disable self-update, - 'disable_update' => false, -); diff --git a/data/users/_/config.default.php b/data/users/_/config.default.php deleted file mode 100644 index f28ef9724..000000000 --- a/data/users/_/config.default.php +++ /dev/null @@ -1,75 +0,0 @@ - 'en', - 'old_entries' => 3, - 'keep_history_default' => 50, - 'ttl_default' => 3600, - 'mail_login' => '', - 'token' => '', - 'passwordHash' => '', - 'apiPasswordHash' => '', - 'posts_per_page' => 20, - 'since_hours_posts_per_rss' => 168, - 'min_posts_per_rss' => 2, - 'max_posts_per_rss' => 400, - 'view_mode' => 'normal', - 'default_view' => 'adaptive', - 'default_state' => FreshRSS_Entry::STATE_NOT_READ, - 'auto_load_more' => true, - 'display_posts' => false, - 'display_categories' => false, - 'hide_read_feeds' => true, - 'onread_jump_next' => true, - 'lazyload' => true, - 'sticky_post' => true, - 'reading_confirm' => false, - 'auto_remove_article' => false, - - # In the case an article has changed (e.g. updated content): - # Set to `true` to mark it unread, or `false` to leave it as-is. - 'mark_updated_article_unread' => false, //TODO: -1 => ignore, 0 => update, 1 => update and mark as unread - - 'sort_order' => 'DESC', - 'anon_access' => false, - 'mark_when' => array ( - 'article' => true, - 'site' => true, - 'scroll' => true, - 'reception' => false, - ), - 'theme' => 'Origine', - 'content_width' => 'thin', - 'shortcuts' => array ( - 'mark_read' => 'r', - 'mark_favorite' => 'f', - 'go_website' => 'space', - 'next_entry' => 'j', - 'prev_entry' => 'k', - 'first_entry' => 'home', - 'last_entry' => 'end', - 'collapse_entry' => 'c', - 'load_more' => 'm', - 'auto_share' => 's', - 'focus_search' => 'a', - 'user_filter' => 'u', - 'help' => 'f1', - 'close_dropdown' => 'escape', - ), - 'topline_read' => true, - 'topline_favorite' => true, - 'topline_date' => true, - 'topline_link' => true, - 'bottomline_read' => true, - 'bottomline_favorite' => true, - 'bottomline_sharing' => true, - 'bottomline_tags' => true, - 'bottomline_date' => true, - 'bottomline_link' => true, - 'sharing' => array ( - ), - 'queries' => array ( - ), - 'html5_notif_timeout' => 0, - 'extensions_enabled' => array(), -); diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php index f9eff3db6..952d983c9 100644 --- a/lib/Minz/FrontController.php +++ b/lib/Minz/FrontController.php @@ -33,7 +33,7 @@ class Minz_FrontController { try { Minz_Configuration::register('system', DATA_PATH . '/config.php', - DATA_PATH . '/config.default.php'); + FRESHRSS_PATH . '/config.default.php'); $this->setReporting(); Minz_Request::init(); diff --git a/lib/lib_install.php b/lib/lib_install.php index c625a670a..bf81c15b4 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -2,8 +2,8 @@ define('BCRYPT_COST', 9); -Minz_Configuration::register('default_system', join_path(DATA_PATH, 'config.default.php')); -Minz_Configuration::register('default_user', join_path(USERS_PATH, '_', 'config.default.php')); +Minz_Configuration::register('default_system', join_path(FRESHRSS_PATH, 'config.default.php')); +Minz_Configuration::register('default_user', join_path(FRESHRSS_PATH, 'config-user.default.php')); function checkRequirements($dbType = '') { $php = version_compare(PHP_VERSION, '5.3.3') >= 0; diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 247cc707b..1bf387712 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -341,7 +341,7 @@ function get_user_configuration($username) { try { Minz_Configuration::register($namespace, join_path(USERS_PATH, $username, 'config.php'), - join_path(USERS_PATH, '_', 'config.default.php')); + join_path(FRESHRSS_PATH, 'config-user.default.php')); } catch (Minz_ConfigurationNamespaceException $e) { // namespace already exists, do nothing. } catch (Minz_FileNotExistException $e) { diff --git a/p/api/greader.php b/p/api/greader.php index 01eca6d4f..e1f4202a7 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -695,7 +695,7 @@ $pathInfos = explode('/', $pathInfo); Minz_Configuration::register('system', DATA_PATH . '/config.php', - DATA_PATH . '/config.default.php'); + FRESHRSS_PATH . '/config.default.php'); FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); if (!FreshRSS_Context::$system_conf->api_enabled) { serviceUnavailable(); diff --git a/p/api/index.php b/p/api/index.php index 3ab4e02b3..580c90255 100644 --- a/p/api/index.php +++ b/p/api/index.php @@ -16,7 +16,7 @@
diff --git a/p/api/pshb.php b/p/api/pshb.php index a0b64ede1..4b546908a 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -60,7 +60,7 @@ if (empty($users)) { unlink('../../keys/' . $key . '.txt'); Minz_Configuration::register('system', DATA_PATH . '/config.php', - DATA_PATH . '/config.default.php'); + FRESHRSS_PATH . '/config.default.php'); FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); $feed = new FreshRSS_Feed($url); $feed->pubSubHubbubSubscribe(false); @@ -101,7 +101,7 @@ if ($ORIGINAL_INPUT == '') { die('Missing XML payload!'); } -Minz_Configuration::register('system', DATA_PATH . '/config.php', DATA_PATH . '/config.default.php'); +Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php'); $system_conf = Minz_Configuration::get('system'); $system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) @@ -133,7 +133,7 @@ foreach ($users as $userFilename) { Minz_Session::_param('currentUser', $username); Minz_Configuration::register('user', join_path(USERS_PATH, $username, 'config.php'), - join_path(USERS_PATH, '_', 'config.default.php')); + join_path(FRESHRSS_PATH, 'config-user.default.php')); new Minz_ModelPdo($username); //TODO: FIXME: Quick-fix while waiting for a better FreshRSS() constructor/init FreshRSS_Context::init(); list($updated_feeds, $feed, $nb_new_articles) = FreshRSS_feed_Controller::actualizeFeed(0, $self, false, $simplePie); -- cgit v1.2.3