summaryrefslogtreecommitdiff
path: root/classes/config.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/config.php')
-rw-r--r--classes/config.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/classes/config.php b/classes/config.php
index cc089b7ba..ab31bc860 100644
--- a/classes/config.php
+++ b/classes/config.php
@@ -6,7 +6,7 @@ class Config {
const T_STRING = 2;
const T_INT = 3;
- const SCHEMA_VERSION = 146;
+ const SCHEMA_VERSION = 147;
/** override default values, defined below in _DEFAULTS[], prefixing with _ENVVAR_PREFIX:
*
@@ -189,6 +189,9 @@ class Config {
/** http user agent (changing this is not recommended) */
const HTTP_USER_AGENT = "HTTP_USER_AGENT";
+ /** delay updates for this feed if received HTTP 429 (Too Many Requests) for this amount of seconds (base value, actual delay is base...base*2) */
+ const HTTP_429_THROTTLE_INTERVAL = "HTTP_429_THROTTLE_INTERVAL";
+
/** default values for all global configuration options */
private const _DEFAULTS = [
Config::DB_TYPE => [ "pgsql", Config::T_STRING ],
@@ -245,6 +248,7 @@ class Config {
Config::AUTH_MIN_INTERVAL => [ 5, Config::T_INT ],
Config::HTTP_USER_AGENT => [ 'Tiny Tiny RSS/%s (https://tt-rss.org/)',
Config::T_STRING ],
+ Config::HTTP_429_THROTTLE_INTERVAL => [ 3600, Config::T_INT ],
];
/** @var Config|null */
@@ -444,13 +448,7 @@ class Config {
/** this returns Config::SELF_URL_PATH sans trailing slash */
static function get_self_url() : string {
- $self_url_path = self::get(Config::SELF_URL_PATH);
-
- if (substr($self_url_path, -1) === "/") {
- return substr($self_url_path, 0, -1);
- } else {
- return $self_url_path;
- }
+ return preg_replace("#/*$#", "", self::get(Config::SELF_URL_PATH));
}
static function is_server_https() : bool {
@@ -461,9 +459,11 @@ class Config {
/** generates reference self_url_path (no trailing slash) */
static function make_self_url() : string {
$proto = self::is_server_https() ? 'https' : 'http';
- $self_url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
+
+ $self_url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
$self_url_path = preg_replace("/\w+\.php(\?.*$)?$/", "", $self_url_path);
+ #$self_url_path = preg_replace("/(\?.*$)?$/", "", $self_url_path);
if (substr($self_url_path, -1) === "/") {
return substr($self_url_path, 0, -1);
@@ -518,8 +518,8 @@ class Config {
array_push($errors, "Please don't run this script as root.");
}
- if (version_compare(PHP_VERSION, '7.1.0', '<')) {
- array_push($errors, "PHP version 7.1.0 or newer required. You're using " . PHP_VERSION . ".");
+ if (version_compare(PHP_VERSION, '7.4.0', '<')) {
+ array_push($errors, "PHP version 7.4.0 or newer required. You're using " . PHP_VERSION . ".");
}
if (!class_exists("UConverter")) {