Files
FreshRSS/constants.php
T
Alexandre Alapetite fd3f75b3a2 Require PHP 8.2+ (#9470)
Drop PHP 8.1 (EOL December 2025), drop Ubuntu 22.04 (EOL May 2027, and there is now 24.04 and 26.04 LTS).
PHP 8.1 is already EOL, and Debian, Alpine, Fedora, Red Hat, Synology have dropped PHP 8.1 already.
See https://github.com/FreshRSS/FreshRSS/discussions/5474#discussioncomment-16791937

With PHP 8.6 around the corner and in particular a relevant `FILTER_FLAG_GLOBAL_RANGE` in PHP 8.2+.
* https://www.php.net/releases/8.2
* https://www.php.net/filter.constants.validation#constant.filter-flag-global-range
* https://www.php.net/class.sensitiveparameter
* https://php.watch/versions/8.2/readonly-classes
* https://www.php.net/function.ini-parse-quantity

Allows updating to PHPUnit 11.x instead of 10.x
https://phpunit.de/supported-versions.html

Contributes to https://github.com/FreshRSS/FreshRSS/issues/9475

* Add regression test for FILTER_FLAG_GLOBAL_RANGE
https://github.com/FreshRSS/FreshRSS/pull/9470#discussion_r4371168720
2026-10-26 21:02:32 +01:00

90 lines
3.7 KiB
PHP

<?php
declare(strict_types=1);
//NB: Do not edit; use ./constants.local.php instead.
//<Not customisable>
/** @var string */
const FRESHRSS_MIN_PHP_VERSION = '8.2.0';
/** @var string */
const FRESHRSS_VERSION = '1.30.5-dev';
/** @var string */
const FRESHRSS_WEBSITE = 'https://freshrss.org';
/** @var string */
const FRESHRSS_WIKI = 'https://freshrss.github.io/FreshRSS/';
/** @var string */
const APP_NAME = 'FreshRSS';
/** @var string */
const FRESHRSS_PATH = __DIR__;
/** @var string */
const PUBLIC_PATH = FRESHRSS_PATH . '/p';
/** @var string */
const PUBLIC_TO_INDEX_PATH = '/i';
/** @var string */
const INDEX_PATH = PUBLIC_PATH . PUBLIC_TO_INDEX_PATH;
/** @var string */
const PUBLIC_RELATIVE = '..';
/** @var string */
const LIB_PATH = FRESHRSS_PATH . '/lib';
/** @var string */
const APP_PATH = FRESHRSS_PATH . '/app';
/** @var string */
const I18N_PATH = APP_PATH . '/i18n';
/** @var string */
const CORE_EXTENSIONS_PATH = LIB_PATH . '/core-extensions';
/** @var string */
const TESTS_PATH = FRESHRSS_PATH . '/tests';
//</Not customisable>
if (version_compare(PHP_VERSION, FRESHRSS_MIN_PHP_VERSION, '<')) {
die(sprintf("Error: FreshRSS requires PHP %s+ but was invoked with PHP %s!\n", FRESHRSS_MIN_PHP_VERSION, PHP_VERSION));
}
if (file_exists(__DIR__ . '/constants.local.php')) {
//Include custom / local settings:
include __DIR__ . '/constants.local.php';
}
defined('FRESHRSS_USERAGENT') or define('FRESHRSS_USERAGENT', 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')');
// PHP text output compression https://www.php.net/ob_gzhandler (better to do it at Web server level)
defined('PHP_COMPRESSION') or define('PHP_COMPRESSION', false);
defined('COPY_LOG_TO_SYSLOG') or define('COPY_LOG_TO_SYSLOG', filter_var(getenv('COPY_LOG_TO_SYSLOG'), FILTER_VALIDATE_BOOLEAN));
// For cases when syslog is not available
defined('COPY_SYSLOG_TO_STDERR') or define('COPY_SYSLOG_TO_STDERR', filter_var(getenv('COPY_SYSLOG_TO_STDERR'), FILTER_VALIDATE_BOOLEAN));
// Maximum log file size in Bytes, before it will be divided by two
defined('MAX_LOG_SIZE') or define('MAX_LOG_SIZE', 1048576);
// Amount of characters of text shown if feed has no title
defined('MAX_CHARS_EMPTY_FEED_TITLE') or define('MAX_CHARS_EMPTY_FEED_TITLE', 75);
//This directory must be writable
$dataPath = getenv('DATA_PATH');
if (is_string($dataPath) && $dataPath !== '') {
define('DATA_PATH', $dataPath);
} else {
defined('DATA_PATH') or define('DATA_PATH', FRESHRSS_PATH . '/data');
}
defined('UPDATE_FILENAME') or define('UPDATE_FILENAME', DATA_PATH . '/update.php');
defined('USERS_PATH') or define('USERS_PATH', DATA_PATH . '/users');
defined('LOG_FILENAME') or define('LOG_FILENAME', 'log.txt');
defined('ADMIN_LOG') or define('ADMIN_LOG', USERS_PATH . '/_/' . LOG_FILENAME);
defined('API_LOG') or define('API_LOG', USERS_PATH . '/_/log_api.txt');
defined('TOS_FILENAME') or define('TOS_FILENAME', DATA_PATH . '/tos.html');
defined('CACHE_PATH') or define('CACHE_PATH', DATA_PATH . '/cache');
defined('PSHB_LOG') or define('PSHB_LOG', USERS_PATH . '/_/log_pshb.txt');
defined('PSHB_PATH') or define('PSHB_PATH', DATA_PATH . '/PubSubHubbub');
defined('EXTENSIONS_DATA') or define('EXTENSIONS_DATA', DATA_PATH . '/extensions-data');
defined('THIRDPARTY_EXTENSIONS_PATH') or define('THIRDPARTY_EXTENSIONS_PATH', FRESHRSS_PATH . '/extensions');
//Deprecated constants
defined('EXTENSIONS_PATH') or define('EXTENSIONS_PATH', FRESHRSS_PATH . '/extensions');
//Directory used for feed mutex with *.freshrss.lock files. Must be writable.
defined('TMP_PATH') or define('TMP_PATH', sys_get_temp_dir());
//clean the cache after x hours (720 hours = 30 days)
defined('CLEANCACHE_HOURS') or define('CLEANCACHE_HOURS', 720);