--- /dev/null
+<?php\r
+\r
+// CONFIG.PHP\r
+\r
+/* This file declares the default values for the base config of Friendica.\r
+ *\r
+ * These configuration values aren't accessible from the admin settings page and custom values must be set in config/local.config.php\r
+ *\r
+ * Please don't edit this file directly as its content may change in the upcoming versions.\r
+ */\r
+\r
+return [\r
+ 'database' => [\r
+ // host (String)\r
+ // Hostname or IP address of the database server.\r
+ // Can contain the port number with the syntax "hostname:port".\r
+ 'hostname' => '',\r
+\r
+ // user (String)\r
+ // Database user name. Please don't use "root".\r
+ 'username' => '',\r
+\r
+ // pass (String)\r
+ // Database user password. Please don't use empty passwords.\r
+ 'password' => '',\r
+\r
+ // base (String)\r
+ // Database name.\r
+ 'database' => '',\r
+\r
+ // charset (String)\r
+ // Database connexion charset. Changing this value will likely corrupt special characters.\r
+ 'charset' => 'utf8mb4',\r
+ ],\r
+ 'config' => [\r
+ // admin_email (Comma-separated list)\r
+ // In order to perform system administration via the admin panel,\r
+ // this must precisely match the email address of the person logged in.\r
+ 'admin_email' => '',\r
+\r
+ // admin_nickname (String)\r
+ // Nickname of the main admin user, used if there are more than one admin user defined in config => admin_email.\r
+ 'admin_nickname' => '',\r
+\r
+ // max_import_size (Integer)\r
+ // Maximum body size of DFRN and Mail messages in characters. 0 is unlimited.\r
+ 'max_import_size' => 200000,\r
+\r
+ // php_path (String)\r
+ // Location of PHP command line processor.\r
+ 'php_path' => 'php',\r
+ ],\r
+ 'system' => [\r
+ // allowed_link_protocols (Array)\r
+ // Allowed protocols in links URLs, add at your own risk. http is always allowed.\r
+ 'allowed_link_protocols' => ['ftp', 'ftps', 'mailto', 'cid', 'gopher'],\r
+\r
+ // always_show_preview (Boolean)\r
+ // Only show small preview pictures.\r
+ 'always_show_preview' => false,\r
+\r
+ // archival_days (Integer)\r
+ // Number of days that we try to deliver content before we archive a contact.\r
+ 'archival_days' => 32,\r
+\r
+ // auth_cookie_lifetime (Integer)\r
+ // Number of days that should pass without any activity before a user who\r
+ // chose "Remember me" when logging in is considered logged out.\r
+ 'auth_cookie_lifetime' => 7,\r
+\r
+ // block_local_dir (Boolean)\r
+ // Deny public access to the local user directory.\r
+ 'block_local_dir' => false,\r
+\r
+ // cache_driver (database|memcache|memcached|redis)\r
+ // Whether to use Memcache or Memcached or Redis to store temporary cache.\r
+ 'cache_driver' => 'database',\r
+\r
+ // config_adapter (jit|preload)\r
+ // Allow to switch the configuration adapter to improve performances at the cost of memory consumption.\r
+ 'config_adapter' => 'jit',\r
+\r
+ // curl_range_bytes (Integer)\r
+ // Maximum number of bytes that should be fetched. Default is 0, which mean "no limit".\r
+ 'curl_range_bytes' => 0,\r
+\r
+ // crawl_permit_period (Integer)\r
+ // Period in seconds between allowed searches when the number of free searches is reached and "permit_crawling" is activated.\r
+ 'crawl_permit_period' => 60,\r
+\r
+ // db_log (Path)\r
+ // Name of a logfile to log slow database queries.\r
+ 'db_log' => '',\r
+\r
+ // db_log_index (Path)\r
+ // Name of a logfile to log queries with bad indexes.\r
+ 'db_log_index' => '',\r
+\r
+ // db_log_index_watch (Comma-separated list)\r
+ // Watchlist of indexes to watch.\r
+ 'db_log_index_watch' => '',\r
+\r
+ // db_log_index_blacklist (Comma-separated list)\r
+ // Blacklist of indexes that shouldn't be watched.\r
+ 'db_log_index_blacklist' => '',\r
+\r
+ // db_loglimit (Integer)\r
+ // If a database call lasts longer than this value in seconds it is logged.\r
+ // Inactive if system => db_log is empty.\r
+ 'db_loglimit' => 10,\r
+\r
+ // db_loglimit_index (Integer)\r
+ // Number of index rows needed to be logged for indexes on the watchlist. 0 to disable.\r
+ 'db_loglimit_index' => 0,\r
+\r
+ // db_loglimit_index_high (Integer)\r
+ // Number of index rows to be logged anyway (for any index). 0 to disable.\r
+ 'db_loglimit_index_high' => 0,\r
+\r
+ // dbclean_expire_conversation (Integer)\r
+ // When DBClean is enabled, any entry in the conversation table will be deleted after this many days.\r
+ // This data is used for ActivityPub, so it shouldn't be lower than the average duration of a discussion.\r
+ 'dbclean_expire_conversation' => 90,\r
+\r
+ // dbclean-expire-limit (Integer)\r
+ // This defines the number of items that are to be deleted in a single call.\r
+ // Reduce this value when you are getting memory issues.\r
+ 'dbclean-expire-limit' => 1000,\r
+\r
+ // diaspora_test (Boolean)\r
+ // For development only. Disables the message transfer.\r
+ 'diaspora_test' => false,\r
+\r
+ // disable_email_validation (Boolean)\r
+ // Disables the check if a mail address is in a valid format and can be resolved via DNS.\r
+ 'disable_email_validation' => false,\r
+\r
+ // disable_url_validation (Boolean)\r
+ // Disables the DNS lookup of an URL.\r
+ 'disable_url_validation' => false,\r
+\r
+ // disable_password_exposed (Boolean)\r
+ // Disable the exposition check against the remote haveibeenpwned API on password change.\r
+ 'disable_password_exposed' => false,\r
+\r
+ // disable_polling (Boolean)\r
+ // Disable the polling of DFRN and OStatus contacts through onepoll.php.\r
+ 'disable_polling' => false,\r
+\r
+ // dlogfile (Path)\r
+ // location of the developer log file.\r
+ 'dlogfile' => '',\r
+\r
+ // dlogip (String)\r
+ // restricts develop log writes to requests originating from this IP address.\r
+ 'dlogip' => '',\r
+\r
+ // free_crawls (Integer)\r
+ // Number of "free" searches when system => permit_crawling is enabled.\r
+ 'free_crawls' => 10,\r
+\r
+ // frontend_worker_timeout (Integer)\r
+ // Value in minutes after we think that a frontend task was killed by the webserver.\r
+ 'frontend_worker_timeout' => 10,\r
+\r
+ // groupedit_image_limit (Integer)\r
+ // Number of contacts at which the group editor should switch from display the profile pictures of the contacts to only display the names.\r
+ // This can alternatively be set on a per account basis in the pconfig table.\r
+ 'groupedit_image_limit' => 400,\r
+\r
+ // hsts (Boolean)\r
+ // Enables the sending of HTTP Strict Transport Security headers.\r
+ 'hsts' => false,\r
+\r
+ // ignore_cache (Boolean)\r
+ // For development only. Disables the item cache.\r
+ 'ignore_cache' => false,\r
+\r
+ // instances_social_key (String)\r
+ // Key to the API of https://instances.social which retrieves data about mastodon servers.\r
+ // See https://instances.social/api/token to get an API key.\r
+ 'instances_social_key' => '',\r
+\r
+ // ipv4_resolve (Boolean)\r
+ // Resolve IPV4 addresses only. Don't resolve to IPV6.\r
+ 'ipv4_resolve' => false,\r
+\r
+ // invitation_only (Boolean)\r
+ // If set true registration is only possible after a current member of the node has send an invitation.\r
+ 'invitation_only' => false,\r
+\r
+ // like_no_comment (Boolean)\r
+ // Don't update the "commented" value of an item when it is liked.\r
+ 'like_no_comment' => false,\r
+\r
+ // local_block (Boolean)\r
+ // Used in conjunction with "block_public".\r
+ 'local_block' => false,\r
+\r
+ // local_search (Boolean)\r
+ // Blocks search for users who are not logged in to prevent crawlers from blocking your system.\r
+ 'local_search' => false,\r
+\r
+ // local_tags (Boolean)\r
+ // If activated, all hashtags will point to the local server.\r
+ 'local_tags' => false,\r
+\r
+ // max_batch_queue (Integer)\r
+ // Maximum number of batched queue items for a single contact before subsequent messages are discarded.\r
+ 'max_batch_queue' => 1000,\r
+\r
+ // max_connections (Integer)\r
+ // The maximum number of database connections which can be in use before the worker process is deferred to its next interval.\r
+ // When the system can't detect the maximum numbers of connection then this value can be used. Use 0 for auto-detection.\r
+ 'max_connections' => 0,\r
+\r
+ // max_connections_level (Integer 0-100)\r
+ // The maximum percentage of connections that are allowed to let the worker start.\r
+ 'max_connections_level' => 75,\r
+\r
+ // max_contact_queue (Integer)\r
+ // Maximum number of queue items for a single contact before subsequent messages are discarded.\r
+ 'max_contact_queue' => 500,\r
+\r
+ // max_image_length (Integer)\r
+ // An alternate way of limiting picture upload sizes.\r
+ // Specify the maximum pixel length that pictures are allowed to be (for non-square pictures, it will apply to the longest side).\r
+ // Pictures longer than this length will be resized to be this length (on the longest side, the other side will be scaled appropriately).\r
+ // If you don't want to set a maximum length, set to -1.\r
+ 'max_image_length' => -1,\r
+\r
+ // max_processes_backend (Integer)\r
+ // Maximum number of concurrent database processes for background tasks.\r
+ 'max_processes_backend' => 5,\r
+\r
+ // max_processes_frontend (Integer)\r
+ // Maximum number of concurrent database processes for foreground tasks.\r
+ 'max_processes_frontend' => 20,\r
+\r
+ // maximagesize (Integer)\r
+ // Maximum size in bytes of an uploaded photo.\r
+ 'maximagesize' => 800000,\r
+\r
+ // memcache_host (String)\r
+ // Host name of the memcache daemon.\r
+ 'memcache_host' => '127.0.0.1',\r
+\r
+ // memcache_port (Integer)\r
+ // Port number of the memcache daemon.\r
+ 'memcache_port' => 11211,\r
+\r
+ // memcached_hosts (Array)\r
+ // Array of Memcached servers info [host, port(, weight)], see Memcached::addServers.\r
+ 'memcached_hosts' => [\r
+ ['127.0.0.1', '11211'],\r
+ ],\r
+\r
+ // min_poll_interval (Integer)\r
+ // minimal distance in minutes between two polls for a contact. Reasonable values are between 1 and 59.\r
+ 'min_poll_interval' => 1,\r
+\r
+ // no_count (Boolean)\r
+ // Don't do count calculations (currently only when showing photo albums).\r
+ 'no_count' => false,\r
+\r
+ // no_oembed (Boolean)\r
+ // Don't use OEmbed to fetch more information about a link.\r
+ 'no_oembed' => false,\r
+\r
+ // no_smilies (Boolean)\r
+ // Don't show smilies.\r
+ 'no_smilies' => false,\r
+\r
+ // no_view_full_size (Boolean)\r
+ // Don't add the link "View full size" under a resized image.\r
+ 'no_view_full_size' => false,\r
+\r
+ // optimize_items (Boolean)\r
+ // Triggers an SQL command to optimize the item table before expiring items.\r
+ 'optimize_items' => false,\r
+\r
+ // paranoia (Boolean)\r
+ // Log out users if their IP address changed.\r
+ 'paranoia' => false,\r
+\r
+ // permit_crawling (Boolean)\r
+ // Restricts the search for not logged in users to one search per minute.\r
+ 'permit_crawling' => false,\r
+\r
+ // pidfile (Path)\r
+ // Daemon pid file path. For example: pidfile = /path/to/daemon.pid\r
+ 'pidfile' => '',\r
+\r
+ // png_quality (Integer)\r
+ // Sets the ImageMagick compression level for PNG images. Values ranges from 0 (uncompressed) to 9 (most compressed).\r
+ 'png_quality' => 8,\r
+\r
+ // profiler (Boolean)\r
+ // Enable internal timings to help optimize code. Needed for "rendertime" addon.\r
+ 'profiler' => false,\r
+\r
+ // proxy_cache_time (Integer)\r
+ // Period in seconds after which the cache is cleared.\r
+ 'proxy_cache_time' => 86400,\r
+\r
+ // pushpoll_frequency (Integer)\r
+ // Frequency of contact poll for subhub contact using the DFRM or OStatus network.\r
+ // Available values:\r
+ // - 5 = every month\r
+ // - 4 = every week\r
+ // - 3 = every day\r
+ // - 2 = twice a day\r
+ // - 1 = every hour\r
+ // - 0 = every minute\r
+ 'pushpoll_frequency' => 3,\r
+\r
+ // queue_no_dead_check (Boolean)\r
+ // Ignore if the target contact or server seems to be dead during queue delivery.\r
+ 'queue_no_dead_check' => false,\r
+\r
+ // redis_host (String)\r
+ // Host name of the redis daemon.\r
+ 'redis_host' => '127.0.0.1',\r
+\r
+ // redis_port (String)\r
+ // Port number of the redis daemon.\r
+ 'redis_port' => 6379,\r
+\r
+ // session_handler (database|cache|native)\r
+ // Whether to use Cache to store session data or to use PHP native session storage.\r
+ 'session_handler' => 'database',\r
+\r
+ // remove_multiplicated_lines (Boolean)\r
+ // If enabled, multiple linefeeds in items are stripped to a single one.\r
+ 'remove_multiplicated_lines' => false,\r
+\r
+ // sendmail_params (Boolean)\r
+ // Normal sendmail command parameters will be added when the PHP mail() function is called for sending e-mails.\r
+ // This ensures the Sender Email address setting is applied to the message envelope rather than the host's default address.\r
+ // Set to false if your non-sendmail agent is incompatible, or to restore old behavior of using the host address.\r
+ 'sendmail_params' => true,\r
+\r
+ // show_global_community_hint (Boolean)\r
+ // When the global community page is enabled, use this option to display a hint above the stream, that this is a collection of all public top-level postings that arrive on your node.\r
+ 'show_global_community_hint' => false,\r
+\r
+ // show_unsupported_addons (Boolean)\r
+ // Show all addons including the unsupported ones.\r
+ 'show_unsupported_addons' => false,\r
+\r
+ // show_unsupported_themes (Boolean)\r
+ // Show all themes including the unsupported ones.\r
+ 'show_unsupported_themes' => false,\r
+\r
+ // throttle_limit_day (Integer)\r
+ // Maximum number of posts that a user can send per day with the API. 0 to disable daily throttling.\r
+ 'throttle_limit_day' => 0,\r
+\r
+ // throttle_limit_week (Integer)\r
+ // Maximum number of posts that a user can send per week with the API. 0 to disable weekly throttling.\r
+ 'throttle_limit_week' => 0,\r
+\r
+ // throttle_limit_month (Integer)\r
+ // Maximum number of posts that a user can send per month with the API. 0 to disable monthly throttling.\r
+ 'throttle_limit_month' => 0,\r
+\r
+ // urlpath (String)\r
+ // If you are using a subdirectory of your domain you will need to put the relative path (from the root of your domain) here.\r
+ // For instance if your URL is 'http://example.com/directory/subdirectory', set urlpath to 'directory/subdirectory'.\r
+ 'urlpath' => '',\r
+\r
+ // username_min_length (Integer)\r
+ // The minimum character length a username can be.\r
+ // This length is check once the username has been trimmed and multiple spaces have been collapsed into one.\r
+ // Minimum for this config value is 1. Maximum is 64 as the resulting profile URL mustn't be longer than 255 chars.\r
+ 'username_min_length' => 3,\r
+\r
+ // username_max_length (Integer)\r
+ // The maximum character length a username can be.\r
+ // This length is check once the username has been trimmed and multiple spaces have been collapsed into one.\r
+ // Minimum for this config value is 1. Maximum is 64 as the resulting profile URL mustn't be longer than 255 chars.\r
+ 'username_max_length' => 48,\r
+\r
+ // worker_cooldown (Integer)\r
+ // Cooldown period in seconds after each worker function call.\r
+ 'worker_cooldown' => 0,\r
+\r
+ // worker_debug (Boolean)\r
+ // If enabled, it prints out the number of running processes split by priority.\r
+ 'worker_debug' => false,\r
+\r
+ // worker_fetch_limit (Integer)\r
+ // Number of worker tasks that are fetched in a single query.\r
+ 'worker_fetch_limit' => 1,\r
+\r
+ // worker_load_exponent (Integer)\r
+ // Default 3, which allows only 25% of the maximum worker queues when server load reaches around 37% of maximum load.\r
+ // For a linear response where 25% of worker queues are allowed at 75% of maximum load, set this to 1.\r
+ // Setting 0 would allow maximum worker queues at all times, which is not recommended.\r
+ 'worker_load_exponent' => 3,\r
+\r
+ // xrd_timeout (Integer)\r
+ // Timeout in seconds for fetching the XRD links.\r
+ 'xrd_timeout' => 20,\r
+ ],\r
+ 'experimental' => [\r
+ // exp_themes (Boolean)\r
+ // Show experimental themes in user settings.\r
+ 'exp_themes' => false,\r
+ ],\r
+ 'theme' => [\r
+ // hide_eventlist (Boolean)\r
+ // Don't show the birthdays and events on the profile and network page.\r
+ 'hide_eventlist' => false,\r
+ ],\r
+ 'jabber' => [\r
+ // debug (Boolean)\r
+ // Enable debug level for the jabber account synchronisation.\r
+ 'debug' => false,\r
+ // lockpath (Path)\r
+ // Must be writable by the ejabberd process. if set then it will prevent the running of multiple processes.\r
+ 'lockpath' => '',\r
+ ],\r
+];\r
--- /dev/null
+<?php\r
+\r
+// SETTINGS.PHP\r
+\r
+/* This file declares the default values for the admin settings of Friendica.\r
+ *\r
+ * These values will be overridden by the admin settings page.\r
+ *\r
+ * Please don't edit this file directly as its content may change in the upcoming versions.\r
+ */\r
+\r
+return [\r
+ 'config' => [\r
+ // info (String)\r
+ // Plaintext description of this node, used in the /friendica module.\r
+ 'info' => '',\r
+\r
+ // register_policy (Constant)\r
+ // Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.\r
+ // Be certain to create your own personal account before setting REGISTER_CLOSED.\r
+ // REGISTER_APPROVE requires you set system.admin_email to the email address of an already registered person who can authorize and/or approve/deny the request.\r
+ 'register_policy' => 'REGISTER_CLOSED',\r
+\r
+ // register_text (String)\r
+ // Will be displayed prominently on the registration page.\r
+ 'register_text' => '',\r
+\r
+ // sitename (String)\r
+ // Displayed server name.\r
+ 'sitename' => 'Friendica Social Network',\r
+ ],\r
+ 'system' => [\r
+ // account_abandon_days (Integer)\r
+ // Will not waste system resources polling external sites for abandonded accounts.\r
+ // Enter 0 for no time limit.\r
+ 'account_abandon_days' => 0,\r
+\r
+ // addon (Comma-separated list)\r
+ // Manual list of addons which are enabled on this system.\r
+ 'addon' => '',\r
+\r
+ // allowed_themes (Comma-separated list)\r
+ // Themes users can change to in their settings.\r
+ 'allowed_themes' => 'quattro,vier,duepuntozero,smoothly',\r
+\r
+ // default_timezone (String)\r
+ // Choose a default timezone. See https://secure.php.net/manual/en/timezones.php\r
+ // It only applies to timestamps for anonymous viewers.\r
+ 'default_timezone' => 'UTC',\r
+\r
+ // directory (String)\r
+ // URL of the global directory.\r
+ 'directory' => 'https://dir.friendica.social',\r
+\r
+ // forbidden_nicknames (Comma-separated list)\r
+ // Prevents users from registering the specified nicknames on this node.\r
+ // Default value comprises classic role names from RFC 2142.\r
+ 'forbidden_nicknames' => 'info, marketing, sales, support, abuse, noc, security, postmaster, hostmaster, usenet, news, webmaster, www, uucp, ftp, root, sysop',\r
+\r
+ // jpeg_quality (Integer)\r
+ // Sets the ImageMagick quality level for JPEG images. Values ranges from 50 (awful) to 100 (near perfect).\r
+ 'jpeg_quality' => 100,\r
+\r
+ // language (String)\r
+ // System default languague, inluding admin-created user default language.\r
+ // Two-letters ISO 639-1 code.\r
+ 'language' => 'en',\r
+\r
+ // max_image_length (Integer)\r
+ // An alternate way of limiting picture upload sizes.\r
+ // Specify the maximum pixel length that pictures are allowed to be (for non-square pictures, it will apply to the longest side).\r
+ // Pictures longer than this length will be resized to be this length (on the longest side, the other side will be scaled appropriately).\r
+ // If you don't want to set a maximum length, set to -1.\r
+ 'max_image_length' => -1,\r
+\r
+ // maximagesize (Integer)\r
+ // Maximum size in bytes of an uploaded photo.\r
+ 'maximagesize' => 800000,\r
+\r
+ // no_regfullname (Boolean)\r
+ // Allow pseudonyms (true) or enforce a space between first name and last name in Full name, as an anti spam measure (false).\r
+ 'no_regfullname' => true,\r
+\r
+ // optimize_max_tablesize (Integer)\r
+ // Maximum table size (in MB) for the automatic optimization.\r
+ // -1 to disable automatic optimization.\r
+ // 0 to use internal default (100MB)\r
+ 'optimize_max_tablesize' => -1,\r
+\r
+ // rino_encrypt (Integer)\r
+ // Server-to-server private message encryption (RINO).\r
+ // Encryption will only be provided if this setting is set to a non zero value on both servers.\r
+ // Set to 0 to disable, 2 to enable, 1 is deprecated but won't need mcrypt.\r
+ 'rino_encrypt' => 2,\r
+\r
+ // temppath (String)\r
+ // Custom temporary file directory\r
+ 'temppath' => '',\r
+\r
+ // theme (String)\r
+ // System theme name.\r
+ 'theme' => 'vier',\r
+\r
+ // url (String)\r
+ // The fully-qualified URL of this Friendica node.\r
+ // Used by the worker in a non-HTTP execution environment.\r
+ 'url' => '',\r
+ ],\r
+\r
+ // Used in the admin settings to lock certain features\r
+ 'featurelock' => [\r
+ ],\r
+];\r
set_include_path(
get_include_path() . PATH_SEPARATOR
. $this->getBasePath() . DIRECTORY_SEPARATOR . 'include' . PATH_SEPARATOR
- . $this->getBasePath(). DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
+ . $this->getBasePath() . DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
. $this->getBasePath());
if (!empty($_SERVER['QUERY_STRING']) && strpos($_SERVER['QUERY_STRING'], 'pagename=') === 0) {
* Load the configuration files
*
* First loads the default value for all the configuration keys, then the legacy configuration files, then the
- * expected local.ini.php
+ * expected local.config.php
*/
private function loadConfigFiles()
{
- $this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.ini.php');
- $this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.ini.php');
+ $this->loadConfigFile($this->getBasePath() . '/config/defaults.config.php');
+ $this->loadConfigFile($this->getBasePath() . '/config/settings.config.php');
// Legacy .htconfig.php support
- if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
+ if (file_exists($this->getBasePath() . '/.htpreconfig.php')) {
$a = $this;
- include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php';
+ include $this->getBasePath() . '/.htpreconfig.php';
}
// Legacy .htconfig.php support
- if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htconfig.php')) {
+ if (file_exists($this->getBasePath() . '/.htconfig.php')) {
$a = $this;
- include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htconfig.php';
+ include $this->getBasePath() . '/.htconfig.php';
$this->setConfigValue('database', 'hostname', $db_host);
$this->setConfigValue('database', 'username', $db_user);
}
}
- if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
- $this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', true);
+ if (file_exists($this->getBasePath() . '/config/local.config.php')) {
+ $this->loadConfigFile($this->getBasePath() . '/config/local.config.php', true);
+ } elseif (file_exists($this->getBasePath() . '/config/local.ini.php')) {
+ $this->loadINIConfigFile($this->getBasePath() . '/config/local.ini.php', true);
}
}
/**
- * Tries to load the specified configuration file into the App->config array.
+ * Tries to load the specified legacy configuration file into the App->config array.
* Doesn't overwrite previously set values by default to prevent default config files to supersede DB Config.
*
- * The config format is INI and the template for configuration files is the following:
- *
- * <?php return <<<INI
- *
- * [section]
- * key = value
- *
- * INI;
- * // Keep this line
- *
+ * @deprecated since version 2018.12
* @param string $filepath
* @param bool $overwrite Force value overwrite if the config key already exists
* @throws Exception
*/
- public function loadConfigFile($filepath, $overwrite = false)
+ public function loadINIConfigFile($filepath, $overwrite = false)
{
if (!file_exists($filepath)) {
- throw new Exception('Error parsing non-existent config file ' . $filepath);
+ throw new Exception('Error parsing non-existent INI config file ' . $filepath);
}
$contents = include($filepath);
$config = parse_ini_string($contents, true, INI_SCANNER_TYPED);
if ($config === false) {
- throw new Exception('Error parsing config file ' . $filepath);
+ throw new Exception('Error parsing INI config file ' . $filepath);
}
- foreach ($config as $category => $values) {
- foreach ($values as $key => $value) {
- if ($overwrite) {
- $this->setConfigValue($category, $key, $value);
- } else {
- $this->setDefaultConfigValue($category, $key, $value);
- }
- }
+ $this->loadConfigArray($config, $overwrite);
+ }
+
+ /**
+ * Tries to load the specified configuration file into the App->config array.
+ * Doesn't overwrite previously set values by default to prevent default config files to supersede DB Config.
+ *
+ * The config format is PHP array and the template for configuration files is the following:
+ *
+ * <?php return [
+ * 'section' => [
+ * 'key' => 'value',
+ * ],
+ * ];
+ *
+ * @param string $filepath
+ * @param bool $overwrite Force value overwrite if the config key already exists
+ * @throws Exception
+ */
+ public function loadConfigFile($filepath, $overwrite = false)
+ {
+ if (!file_exists($filepath)) {
+ throw new Exception('Error loading non-existent config file ' . $filepath);
+ }
+
+ $config = include($filepath);
+
+ if (!is_array($config)) {
+ throw new Exception('Error loading config file ' . $filepath);
}
+
+ $this->loadConfigArray($config, $overwrite);
}
/**
* Loads addons configuration files
*
- * First loads all activated addons default configuration throught the load_config hook, then load the local.ini.php
+ * First loads all activated addons default configuration through the load_config hook, then load the local.config.php
* again to overwrite potential local addon configuration.
*/
private function loadAddonConfig()
{
// Loads addons default config
- Core\Addon::callHooks('load_config');
+ Core\Hook::callAll('load_config');
// Load the local addon config file to overwritten default addon config values
- if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php')) {
- $this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php', true);
+ if (file_exists($this->getBasePath() . '/config/addon.config.php')) {
+ $this->loadConfigFile($this->getBasePath() . '/config/addon.config.php', true);
+ } elseif (file_exists($this->getBasePath() . '/config/addon.ini.php')) {
+ $this->loadINIConfigFile($this->getBasePath() . '/config/addon.ini.php', true);
+ }
+ }
+
+ /**
+ * Tries to load the specified configuration array into the App->config array.
+ * Doesn't overwrite previously set values by default to prevent default config files to supersede DB Config.
+ *
+ * @param array $config
+ * @param bool $overwrite Force value overwrite if the config key already exists
+ */
+ private function loadConfigArray(array $config, $overwrite = false)
+ {
+ foreach ($config as $category => $values) {
+ foreach ($values as $key => $value) {
+ if ($overwrite) {
+ $this->setConfigValue($category, $key, $value);
+ } else {
+ $this->setDefaultConfigValue($category, $key, $value);
+ }
+ }
}
}
$this->urlPath = trim($parsed['path'], '\\/');
}
- if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
- include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php';
+ if (file_exists($this->getBasePath() . '/.htpreconfig.php')) {
+ include $this->getBasePath() . '/.htpreconfig.php';
}
if (Core\Config::get('config', 'hostname') != '') {