summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-23 09:21:48 +0300
committerAndrew Dolgov <[email protected]>2021-02-23 09:21:48 +0300
commit66b569b1151c7b5764c1c85459bbc8efd3cef563 (patch)
treed6dbc92b7438f9190b985dc7935381766f0f5768
parent7cc0f67abe4a8f8d29745ac9350ddb886bdc9851 (diff)
use config:: instead of a global define
-rw-r--r--init.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/init.php b/init.php
index 8cfcab5..e80bd05 100644
--- a/init.php
+++ b/init.php
@@ -13,13 +13,14 @@ class Nginx_Xaccel extends Plugin {
function init($host) {
$this->host = $host;
+ Config::add("NGINX_XACCEL_PREFIX", "/tt-rss");
+
$host->add_hook($host::HOOK_SEND_LOCAL_FILE, $this);
}
function hook_send_local_file($filename) {
- if (defined('NGINX_XACCEL_PREFIX') && NGINX_XACCEL_PREFIX &&
- mb_strpos($filename, "cache/") === 0) {
+ if (Config::get("NGINX_XACCEL_PREFIX") && mb_strpos($filename, "cache/") === 0) {
$mimetype = mime_content_type($filename);
@@ -34,7 +35,7 @@ class Nginx_Xaccel extends Plugin {
$stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT";
header("Last-Modified: $stamp", true);
- header("X-Accel-Redirect: " . NGINX_XACCEL_PREFIX . "/" . $filename);
+ header("X-Accel-Redirect: " . Config::get("NGINX_XACCEL_PREFIX") . "/" . $filename);
return true;
}