drop ENABLE_GZIP_OUTPUT; system prefs: load php info only if needed

This commit is contained in:
Andrew Dolgov 2021-02-12 21:43:38 +03:00
parent e6624cf631
commit 6af83e3881
7 changed files with 23 additions and 31 deletions

View File

@ -22,13 +22,7 @@
ini_set('session.use_cookies', 0); ini_set('session.use_cookies', 0);
ini_set("session.gc_maxlifetime", 86400); ini_set("session.gc_maxlifetime", 86400);
if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT && ob_start();
function_exists("ob_gzhandler")) {
ob_start("ob_gzhandler");
} else {
ob_start();
}
$input = file_get_contents("php://input"); $input = file_get_contents("php://input");

View File

@ -38,10 +38,6 @@
header("Content-Type: text/json; charset=utf-8"); header("Content-Type: text/json; charset=utf-8");
if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
ob_start("ob_gzhandler");
}
if (SINGLE_USER_MODE) { if (SINGLE_USER_MODE) {
UserHelper::authenticate( "admin", null); UserHelper::authenticate( "admin", null);
} }

View File

@ -25,6 +25,15 @@ class Pref_System extends Handler_Protected {
$this->pdo->query("DELETE FROM ttrss_error_log"); $this->pdo->query("DELETE FROM ttrss_error_log");
} }
function getphpinfo() {
ob_start();
phpinfo();
$info = ob_get_contents();
ob_end_clean();
print preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $info);
}
private function log_viewer(int $page, int $severity) { private function log_viewer(int $page, int $severity) {
$errno_values = []; $errno_values = [];
@ -167,14 +176,11 @@ class Pref_System extends Handler_Protected {
print "<div dojoType='dijit.layout.AccordionPane' print "<div dojoType='dijit.layout.AccordionPane'
title='<i class=\"material-icons\">info</i> ".__('PHP Information')."'>"; title='<i class=\"material-icons\">info</i> ".__('PHP Information')."'>";
ob_start(); print "<script type='dojo/method' event='onSelected' args='evt'>
phpinfo(); Helpers.System.getPHPInfo(this);
$info = ob_get_contents(); </script>";
ob_end_clean();
print "<div class='phpinfo'>"; print "<div class='phpinfo'>" . __("Loading, please wait...") . "</div>";
print preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $info);
print "</div>";
print "</div>"; # accordion pane print "</div>"; # accordion pane

View File

@ -122,13 +122,6 @@
define('CHECK_FOR_UPDATES', true); define('CHECK_FOR_UPDATES', true);
// Check for updates automatically if running Git version // Check for updates automatically if running Git version
define('ENABLE_GZIP_OUTPUT', false);
// Selectively gzip output to improve wire performance. This requires
// PHP Zlib extension on the server.
// Enabling this can break tt-rss in several httpd/php configurations,
// if you experience weird errors and tt-rss failing to start, blank pages
// after login, or content encoding errors, disable it.
define('PLUGINS', 'auth_internal, note'); define('PLUGINS', 'auth_internal, note');
// Comma-separated list of plugins to load automatically for all users. // Comma-separated list of plugins to load automatically for all users.
// System plugins have to be specified here. Please enable at least one // System plugins have to be specified here. Please enable at least one

View File

@ -1,3 +1,3 @@
<?php # This file has been generated at: Fri Feb 12 15:56:39 MSK 2021 <?php # This file has been generated at: Fri Feb 12 21:33:46 MSK 2021
define('GENERATED_CONFIG_CHECK', 26); define('GENERATED_CONFIG_CHECK', 26);
$required_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?> $required_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?>

View File

@ -51,6 +51,13 @@ const Helpers = {
return false; return false;
}, },
System: {
getPHPInfo: function(widget) {
xhrPost("backend.php", {op: 'pref-system', method: 'getphpinfo'}, (transport) => {
widget.attr('content', transport.responseText);
});
}
},
EventLog: { EventLog: {
log_page: 0, log_page: 0,
refresh: function() { refresh: function() {

View File

@ -16,10 +16,6 @@
if (!init_plugins()) return; if (!init_plugins()) return;
if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
ob_start("ob_gzhandler");
}
$method = $_REQUEST["op"]; $method = $_REQUEST["op"];
$override = PluginHost::getInstance()->lookup_handler("public", $method); $override = PluginHost::getInstance()->lookup_handler("public", $method);