Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2018-01-18 10:53:58 +01:00
commit b803c1d448
13 changed files with 146 additions and 30 deletions

View File

@ -60,8 +60,10 @@
Changes in version 5.1.6
--------------------------------------------------------------------------------
- fix wrong check in restapi (part of #373)
- mayApprove() and mayReview() require the status to be S_DRAFT_APP resp. S_DRAFT_REV
- mayApprove() and mayReview() require the status of the document to be
S_DRAFT_APP resp. S_DRAFT_REV
- add preview for webm videos (Closes #374)
- add support for apache mod_xsendfile, minor optimization of file download
--------------------------------------------------------------------------------
Changes in version 5.1.5

View File

@ -12,7 +12,7 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2018-01-09</date>
<date>2018-01-18</date>
<time>09:19:24</time>
<version>
<release>6.0.3</release>
@ -1562,6 +1562,21 @@ returns just users which are not disabled
SeedDMS_Core_Document::removeCategories()
</notes>
</release>
<release>
<date>2018-01-18</date>
<time>09:19:24</time>
<version>
<release>5.1.6</release>
<api>5.1.6</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
</notes>
</release>
<release>
<date>2017-02-28</date>
<time>06:34:50</time>

View File

@ -129,5 +129,24 @@ class SeedDMS_Preview_Base {
return array_key_exists($mimetype, $this->converters) && $this->converters[$mimetype];
} /* }}} */
/**
* Send a file from disk to the browser
*
* This function uses either readfile() or the xѕendfile apache module if
* it is installed.
*
* @param string $filename
*/
protected function sendFile($filename) { /* {{{ */
if(function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) {
header("X-Sendfile: ".$filename);
} else {
/* Make sure output buffering is off */
if (ob_get_level()) {
ob_end_clean();
}
readfile($filename);
}
} /* }}} */
}

View File

@ -196,7 +196,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
$target = $this->previewDir.$dir.md5($infile);
if($target && file_exists($target.'.pdf')) {
readfile($target.'.pdf');
$this->sendFile($target.'.pdf');
}
} /* }}} */
@ -215,7 +215,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
$target = $this->getFileName($object);
if($target && file_exists($target.'.pdf')) {
readfile($target.'.pdf');
$this->sendFile($target.'.pdf');
}
} /* }}} */

View File

@ -247,7 +247,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
$target = $this->previewDir.$dir.md5($infile).'-'.$width;
if($target && file_exists($target.'.png')) {
readfile($target.'.png');
$this->sendFile($target.'.png');
}
} /* }}} */
@ -271,7 +271,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
$target = $this->getFileName($object, $width);
if($target && file_exists($target.'.png')) {
readfile($target.'.png');
$this->sendFile($target.'.png');
}
} /* }}} */

View File

@ -11,10 +11,10 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2017-12-04</date>
<date>2018-01-18</date>
<time>10:59:39</time>
<version>
<release>1.2.6</release>
<release>1.2.7</release>
<api>1.2.0</api>
</version>
<stability>
@ -23,8 +23,8 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
SeedDMS_Preview_Base::setConverters() overrides existing converters.
New method SeedDMS_Preview_Base::addConverters() merges new converters with old ones.
add SeedDMS_Preview_Base::sendFile() as a replacement for readfile() which uses
mod_xsendfile if available
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -336,5 +336,22 @@ fix typo in converter for tar.gz files
SeedDMS_Preview_Base::hasConverter() returns only try if command is set
</notes>
</release>
<release>
<date>2017-12-04</date>
<time>10:59:39</time>
<version>
<release>1.2.6</release>
<api>1.2.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
SeedDMS_Preview_Base::setConverters() overrides existing converters.
New method SeedDMS_Preview_Base::addConverters() merges new converters with old ones.
</notes>
</release>
</changelog>
</package>

View File

@ -40,12 +40,9 @@ class SeedDMS_Controller_ViewOnline extends SeedDMS_Controller_Common {
header("Content-Disposition: filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename);
}
header("Content-Length: " . filesize($dms->contentDir . $content->getPath()));
header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Cache-Control: must-revalidate");
ob_clean();
readfile($dms->contentDir . $content->getPath());
sendFile($dms->contentDir.$content->getPath());
}
break;
}

View File

@ -42,8 +42,9 @@ all language and country codes.
REQUIREMENTS
============
SeedDMS is a web-based application written in PHP. It uses the MySQL RDBMS
or sqlite3 to manage the documents that were uploaded into the application.
SeedDMS is a web-based application written in PHP. It uses MySQL,
sqlite3 or postgresql to manage the documents that were uploaded into
the application. Be aware that postgresql is not very well tested.
Make sure you have PHP 5.3 and MySQL 5 or higher installed. SeedDMS
will work with PHP running in CGI-mode as well as running as module under
@ -67,8 +68,33 @@ Here is a detailed list of requirements:
9. SLIM RestApi
10. FeedWriter from https://github.com/mibe/FeedWriter
It is highly recommended to use the quickstart archive (seeddms-quickstart-x.y.z.tar.gz)
because it includes all software packages for running SeedDMS, though you still need
a working web server with PHP.
BEFORE YOU START
QUICKSTART
===========
The fastes way to get SeedDMS running is by unpacking the archive
`seeddms-quickstart-x.y.z.tar.gz` into your webservers document root.
It will create a new directory `seeddms51x` containing everything you
need to run SeedDMS with sqlite3. Make sure that the subdіrectory
`seeddms51x/data`
and the configuration file `seeddms51/www/conf/settings.xml` is writeable
by your web server. All other directories must just be readable by your
web server. In the next step you need to adjust
the configuration file in `seeddms51/www/conf/settings.xml`. If you
are not afraid of xml files, then open it in your favorite text editor
and search for `/home/wwww-data`. Replace that part in any path found
with your document root. Alternatively, you can open the installer
with a browser at http://your-domain/seeddms51x/install/
It will first ask to unlock the installer by creating a file
`ENABLE_INSTALL_TOOL` in the diretory `seeddms51/www/conf/`. Change all
paths by replacing `/home/wwww-data` with your document root. Once done,
save it, remove the file `ENABLE_INSTALL_TOOL` and point your browser to
http://your-domain/seeddms51x/.
THE LONG STORY
================
SeedDMS has changed its installation process with version 3.0.0. This gives

26
doc/README.xsendfile Normal file
View File

@ -0,0 +1,26 @@
Howto configure mod_xsendfile
==============================
Downloading large files from SeedDMS can be slow, because they are delivered
by the PHP download script. This is a common problem not specific to SeedDMS
but to PHP scripts of this kind in general. Granting direct access on the
download file is not a option as it circumvents the access restrictions of
SeedDMS.
The Apache module xsendfile is just for this kind of controlled downloads. If
is installed and configured, SeedDMS will hand over the download to the web
server which does a much better job than the PHP script. In order to make it
work, mod_xsendfile must be installed, turned on and the path to the download
files must be set to the directory containing the document files. If your document
root is /var/www and you extracted the quickstart archive into that directory,
then the document content directory will be at
/var/www/seeddms51x/data/ . Add the following to your apache configuration,
either globally or within a virtual host configuration. Setting the path in
an .htaccess file will not work.
XSendFile on
XSendFilePath /var/www/seeddms51x/data/
If the XSendFilePath is not set propperly, you will notice an error message
in your apache log file, probably telling you that the download file could not
be found.

View File

@ -598,4 +598,24 @@ function formatComment($an) { /* {{{ */
$t[] = $a['n']." × ".$a['c'];
return $t;
} /* }}} */
/**
* Send a file from disk to the browser
*
* This function uses either readfile() or the xѕendfile apache module if
* it is installed.
*
* @param string $filename
*/
function sendFile($filename) { /* {{{ */
if(function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) {
header("X-Sendfile: ".$filename);
} else {
/* Make sure output buffering is off */
if (ob_get_level()) {
ob_end_clean();
}
readfile($filename);
}
} /* }}} */
?>

View File

@ -171,20 +171,14 @@ elseif (isset($_GET["vfile"])) { /* {{{ */
// update infos
createVersionigFile($document);
header("Content-Type: text/plain; name=\"" . $settings->_versioningFileName . "\"");
//header("Content-Type: application/force-download; name=\"" . $settings->_versioningFileName . "\"");
header("Content-Type: text/plain");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($dms->contentDir.$document->getDir().$settings->_versioningFileName )."\"");
$efilename = rawurlencode($settings->_versioningFileName);
header("Content-Disposition: attachment; filename=\"". $efilename . "\"");
//header("Expires: 0");
//header("Content-Type: " . $content->getMimeType());
//header("Cache-Control: no-cache, must-revalidate");
header("Cache-Control: must-revalidate");
//header("Pragma: no-cache");
ob_clean();
readfile($dms->contentDir . $document->getDir() .$settings->_versioningFileName);
sendFile($dms->contentDir . $document->getDir() .$settings->_versioningFileName);
} /* }}} */
elseif (isset($_GET["dumpname"])) { /* {{{ */

View File

@ -878,7 +878,7 @@ function getDocumentContent($id) { /* {{{ */
$app->response()->header("Cache-Control", "no-cache, must-revalidate");
$app->response()->header("Pragma", "no-cache");
readfile($dms->contentDir . $lc->getPath());
sendFile($dms->contentDir . $lc->getPath());
} else {
$app->response()->status(403);
$app->response()->header('Content-Type', 'application/json');
@ -953,7 +953,7 @@ function getDocumentVersion($id, $version) { /* {{{ */
$app->response()->header("Cache-Control", "no-cache, must-revalidate");
$app->response()->header("Pragma", "no-cache");
readfile($dms->contentDir . $lc->getPath());
sendFile($dms->contentDir . $lc->getPath());
} else {
$app->response()->status(403);
$app->response()->header('Content-Type', 'application/json');
@ -1022,7 +1022,7 @@ function getDocumentFile($id, $fileid) { /* {{{ */
$app->response()->header("Cache-Control", "no-cache, must-revalidate");
$app->response()->header("Pragma", "no-cache");
readfile($dms->contentDir . $file->getPath());
sendFile($dms->contentDir . $file->getPath());
} else {
$app->response()->status(403);
$app->response()->header('Content-Type', 'application/json');

View File

@ -1386,7 +1386,7 @@ $(document).ready(function() {
} else {
echo "\"";
}
echo "".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').">";
echo "".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '')." class=\"chzn-select\">";
if(!$attrdef->getMultipleValues()) {
echo "<option value=\"\"></option>";
}