Make SeedDMS SPOC-compatible, cont'd

This commit is contained in:
Disassembler 2020-03-23 11:32:11 +01:00
parent e0e49ec31a
commit 236c15dbac
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
5 changed files with 13 additions and 78 deletions

View File

@ -21,11 +21,6 @@ EOF
COPY image.d COPY image.d
RUN EOF RUN EOF
# Patch Previewers
cd /srv/seeddms
#TODO: patch -p0 <previewers.patch
rm previewers.patch
# Create OS user # Create OS user
addgroup -S -g 8080 seeddms addgroup -S -g 8080 seeddms
adduser -S -u 8080 -h /srv/seeddms -s /bin/false -g seeddms -G seeddms seeddms adduser -S -u 8080 -h /srv/seeddms -s /bin/false -g seeddms -G seeddms seeddms
@ -33,8 +28,7 @@ RUN EOF
# Cleanup # Cleanup
apk --no-cache del wget apk --no-cache del wget
mv /srv/seeddms/www/install/create_tables-postgres.sql /srv/seeddms/create_tables-postgres.sql rm -rf /srv/seeddms/www/install
rm -rf /srv/seeddms/seeddms/install /srv/seeddms/www/install
rm -rf /srv/seeddms/data/conf /srv/seeddms/www/ext/example rm -rf /srv/seeddms/data/conf /srv/seeddms/www/ext/example
EOF EOF

View File

@ -13,5 +13,4 @@ pm = ondemand
pm.max_children = 16 pm.max_children = 16
php_admin_value[upload_max_filesize] = 100M php_admin_value[upload_max_filesize] = 100M
php_admin_value[post_max_size] = 100M php_admin_value[post_max_size] = 100M
php_admin_value[include_path] = '/srv/seeddms/www/:/srv/seeddms/pear:/usr/share/php7:.:'
env[LANG]=en_US.UTF-8 env[LANG]=en_US.UTF-8

View File

@ -1,58 +0,0 @@
--- orig/SeedDMS/Preview/PdfPreviewer.php
+++ pear/SeedDMS/Preview/PdfPreviewer.php
@@ -27,18 +27,18 @@
function __construct($previewDir, $timeout=5) { /* {{{ */
parent::__construct($previewDir, $timeout);
$this->converters = array(
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'",
- 'application/vnd.oasis.opendocument.text' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'",
- 'text/rtf' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'",
- 'application/msword' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'",
- 'application/vnd.ms-excel' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'",
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'",
- 'text/plain' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'",
- 'application/postscript' => "ps2pdf '%f' - > '%o'",
- 'image/jpeg' => "convert '%f' pdf:- > '%o'",
- 'image/png' => "convert '%f' pdf:- > '%o'",
- 'image/gif' => "convert '%f' pdf:- > '%o'",
- 'video/mp4' => "convert '%f[1-20]' pdf:- > '%o'",
+ 'text/rtf' => "unoconv -d document -f pdf -o '%o' '%f'",
+ 'application/msword' => "unoconv -d document -f pdf -o '%o' '%f'",
+ 'application/vnd.oasis.opendocument.text' => "unoconv -d document -f pdf -o '%o' '%f'",
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -f pdf -o '%o' '%f'",
+ 'application/vnd.ms-excel' => "unoconv -d spreadsheet -f pdf -o '%o' '%f'",
+ 'application/vnd.oasis.opendocument.spreadsheet' => "unoconv -d spreadsheet -f pdf -o '%o' '%f'",
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "unoconv -d spreadsheet -f pdf -o '%o' '%f'",
+ 'application/vnd.ms-powerpoint' => "unoconv -d presentation -f pdf -o '%o' '%f'",
+ 'application/vnd.oasis.opendocument.presentation' => "unoconv -d presentation -f pdf -o '%o' '%f'",
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => "unoconv -d presentation -f pdf -o '%o' '%f'",
+ 'text/html' => "unoconv -d document -f pdf -o '%o' '%f'",
+ 'text/plain' => "unoconv -d document -f pdf -o '%o' '%f'",
);
} /* }}} */
--- orig/SeedDMS/Preview/Previewer.php
+++ pear/SeedDMS/Preview/Previewer.php
@@ -37,10 +37,19 @@
'image/jpg' => "convert -resize %wx '%f' '%o'",
'image/jpeg' => "convert -resize %wx '%f' '%o'",
'image/svg+xml' => "convert -resize %wx '%f' '%o'",
- 'text/plain' => "convert -resize %wx '%f' '%o'",
'application/pdf' => "convert -density 100 -resize %wx '%f[0]' '%o'",
- 'application/postscript' => "convert -density 100 -resize %wx '%f[0]' '%o'",
- 'application/x-compressed-tar' => "tar tzvf '%f' | convert -density 100 -resize %wx text:-[0] '%o'",
+ 'text/plain' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'text/html' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'text/rtf' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/msword' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/vnd.oasis.opendocument.text' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/vnd.ms-excel' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/vnd.oasis.opendocument.spreadsheet' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/vnd.ms-powerpoint' => "unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/vnd.oasis.opendocument.presentation' => "unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => "unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'",
);
$this->width = intval($width);
} /* }}} */

View File

@ -23,7 +23,7 @@ cp -rp ${SEEDDMS_LAYER}/srv/seeddms/data ${SEEDDMS_DATA}
export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
spoc-container start seeddms-postgres spoc-container start seeddms-postgres
envsubst <createdb.sql | spoc-container exec seeddms-postgres -- psql envsubst <createdb.sql | spoc-container exec seeddms-postgres -- psql
cat ${SEEDDMS_LAYER}/srv/seeddms/create_tables-postgres.sql | spoc-container exec seeddms-postgres -- sh -c "PGPASSWORD=${SEEDDMS_PWD} psql seeddms seeddms" cat ${SEEDDMS_LAYER}/srv/seeddms/seeddms/install/create_tables-postgres.sql | spoc-container exec seeddms-postgres -- sh -c "PGPASSWORD=${SEEDDMS_PWD} psql seeddms seeddms"
cat custom.sql | spoc-container exec seeddms-postgres -- psql seeddms cat custom.sql | spoc-container exec seeddms-postgres -- psql seeddms
# Configure SeedDMS # Configure SeedDMS