usage of sendfile can be configured

This commit is contained in:
Uwe Steinmann 2018-03-29 17:13:56 +02:00
parent 28c2323744
commit 666ced5fea
2 changed files with 11 additions and 3 deletions

View File

@ -44,7 +44,13 @@ class SeedDMS_Preview_Base {
*/
protected $timeout;
function __construct($previewDir, $timeout=5) { /* {{{ */
/**
* @var boolean $usesendfile use mod_sendfile if available
* @access protected
*/
protected $usesendfile;
function __construct($previewDir, $timeout=5, $usesendfile=true) { /* {{{ */
if(!is_dir($previewDir)) {
if (!SeedDMS_Core_File::makeDir($previewDir)) {
$this->previewDir = '';
@ -56,6 +62,7 @@ class SeedDMS_Preview_Base {
}
$this->timeout = intval($timeout);
$this->converters = array();
$this->usesendfile = $usesendfile;
} /* }}} */
static function execWithTimeout($cmd, $timeout=5) { /* {{{ */
@ -148,7 +155,7 @@ class SeedDMS_Preview_Base {
* @param string $filename
*/
protected function sendFile($filename) { /* {{{ */
if(function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) {
if($this->usesendfile && function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) {
header("X-Sendfile: ".$filename);
} else {
/* Make sure output buffering is off */

View File

@ -11,7 +11,7 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2018-03-20</date>
<date>2018-03-29</date>
<time>10:59:39</time>
<version>
<release>1.2.9</release>
@ -24,6 +24,7 @@
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
make sure list of converters is always an array
usage of mod_sendfile can be configured
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">