diff options
author | Andrew Dolgov <[email protected]> | 2021-02-12 21:43:38 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-12 21:43:38 +0300 |
commit | 6af83e3881b3f38104027275913f7fc55251d020 (patch) | |
tree | 9fd5747220b0137243e2f5b9c0c0ec4ced797069 | |
parent | e6624cf631f772f2a1eac9412e7a96d6545e91e6 (diff) |
drop ENABLE_GZIP_OUTPUT; system prefs: load php info only if needed
-rw-r--r-- | api/index.php | 8 | ||||
-rw-r--r-- | backend.php | 4 | ||||
-rw-r--r-- | classes/pref/system.php | 20 | ||||
-rw-r--r-- | config.php-dist | 7 | ||||
-rw-r--r-- | include/sanity_config.php | 4 | ||||
-rw-r--r-- | js/PrefHelpers.js | 7 | ||||
-rw-r--r-- | public.php | 4 |
7 files changed, 23 insertions, 31 deletions
diff --git a/api/index.php b/api/index.php index 77552af46..9e998df84 100644 --- a/api/index.php +++ b/api/index.php @@ -22,13 +22,7 @@ ini_set('session.use_cookies', 0); ini_set("session.gc_maxlifetime", 86400); - if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT && - function_exists("ob_gzhandler")) { - - ob_start("ob_gzhandler"); - } else { - ob_start(); - } + ob_start(); $input = file_get_contents("php://input"); diff --git a/backend.php b/backend.php index 2ea396987..030676dcb 100644 --- a/backend.php +++ b/backend.php @@ -38,10 +38,6 @@ header("Content-Type: text/json; charset=utf-8"); - if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { - ob_start("ob_gzhandler"); - } - if (SINGLE_USER_MODE) { UserHelper::authenticate( "admin", null); } diff --git a/classes/pref/system.php b/classes/pref/system.php index d91339698..a7512915a 100644 --- a/classes/pref/system.php +++ b/classes/pref/system.php @@ -25,6 +25,15 @@ class Pref_System extends Handler_Protected { $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) { $errno_values = []; @@ -167,14 +176,11 @@ class Pref_System extends Handler_Protected { print "<div dojoType='dijit.layout.AccordionPane' title='<i class=\"material-icons\">info</i> ".__('PHP Information')."'>"; - ob_start(); - phpinfo(); - $info = ob_get_contents(); - ob_end_clean(); + print "<script type='dojo/method' event='onSelected' args='evt'> + Helpers.System.getPHPInfo(this); + </script>"; - print "<div class='phpinfo'>"; - print preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $info); - print "</div>"; + print "<div class='phpinfo'>" . __("Loading, please wait...") . "</div>"; print "</div>"; # accordion pane diff --git a/config.php-dist b/config.php-dist index cd0ee0078..2ee1c719d 100644 --- a/config.php-dist +++ b/config.php-dist @@ -122,13 +122,6 @@ define('CHECK_FOR_UPDATES', true); // 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'); // Comma-separated list of plugins to load automatically for all users. // System plugins have to be specified here. Please enable at least one diff --git a/include/sanity_config.php b/include/sanity_config.php index 7aa4f6b0f..5059ee83b 100644 --- a/include/sanity_config.php +++ b/include/sanity_config.php @@ -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); -$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'); ?> diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index 5bb76d179..3b9e985a6 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -51,6 +51,13 @@ const Helpers = { return false; }, + System: { + getPHPInfo: function(widget) { + xhrPost("backend.php", {op: 'pref-system', method: 'getphpinfo'}, (transport) => { + widget.attr('content', transport.responseText); + }); + } + }, EventLog: { log_page: 0, refresh: function() { diff --git a/public.php b/public.php index 36308e25e..3e4a9e023 100644 --- a/public.php +++ b/public.php @@ -16,10 +16,6 @@ if (!init_plugins()) return; - if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { - ob_start("ob_gzhandler"); - } - $method = $_REQUEST["op"]; $override = PluginHost::getInstance()->lookup_handler("public", $method); |