Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
TetraWiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Wiki.tetrain.com Runbook
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Phase 9 β File upload formats: PDF, then Office/image/document formats (exact β run in this session) == === 9.1 PDF uploads === <pre> <nowiki> cp /var/www/wiki/LocalSettings.php /var/www/wiki/LocalSettings.php.bak.$(date +%Y%m%d%H%M%S) </nowiki> </pre> Add to <code><nowiki>LocalSettings.php</nowiki></code>, right after <code><nowiki>$wgEnableUploads = true;</nowiki></code>: <pre> <nowiki> $wgFileExtensions = array_merge( $wgFileExtensions ?? [ 'png', 'gif', 'jpg', 'jpeg' ], [ 'pdf' ] ); </nowiki> </pre> Add after the other <code><nowiki>wfLoadExtension()</nowiki></code> calls: <pre> <nowiki> wfLoadExtension( 'PdfHandler' ); </nowiki> </pre> <code><nowiki>PdfHandler</nowiki></code> ships bundled inside the 1.43.9 tarball already on disk (Phase 5) β it just isn't loaded by default, no separate download needed. <code><nowiki>PdfHandler</nowiki></code> needs four system binaries it depends on for rendering/thumbnailing/text-indexing, none of which were present on the box: <pre> <nowiki> dnf install -y ghostscript poppler-utils ImageMagick # provides: gs ($wgPdfProcessor), convert ($wgPdfPostProcessor), # pdfinfo ($wgPdfInfo), pdftotext ($wgPdftoText) β all four are MediaWiki defaults, # no explicit $wgPdf* overrides were needed once the binaries existed on PATH </nowiki> </pre> (This <code><nowiki>dnf install</nowiki></code> hit the 60s SSH command timeout mid-transaction β verified separately via <code><nowiki>rpm -qa | grep -iE 'ghostscript|poppler-utils|ImageMagick'</nowiki></code> and <code><nowiki>which gs convert pdfinfo pdftotext</nowiki></code> that it had actually completed; not re-run.) '''Verify''': <pre> <nowiki> curl -s 'https://wiki.tetrain.com/api.php?action=query&meta=siteinfo&siprop=fileextensions&format=json' # confirm "pdf" present in the list </nowiki> </pre> Also checked <code><nowiki>Special:Version</nowiki></code> on the live wiki β confirms "PDF Handler" registered as a loaded extension. === 9.2 Extend further: ppt, pptx, tiff, bmp, docx, xlsx, ps, odt, ods, odp, odg === Before touching config, checked whether MediaWiki core already knows how to map each extension to a MIME type (the actual mapping source in this version is <code><nowiki>includes/libs/mime/MimeMap.php</nowiki></code> β '''not''' a flat <code><nowiki>mime.types</nowiki></code>/<code><nowiki>mime.info</nowiki></code> file): <pre> <nowiki> grep -iE "'docx'|'xlsx'|'pptx'|'ppt'|'odt'|'ods'|'odp'|'odg'|'tiff'|'tif'|'bmp'|'ps'" \ /var/www/wiki/includes/libs/mime/MimeMap.php </nowiki> </pre> Confirmed: every one of these was already correctly mapped (e.g. <code><nowiki>'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => [ 'docx' ]</nowiki></code>, <code><nowiki>'image/tiff' => [ 'tiff', 'tif' ]</nowiki></code>, <code><nowiki>'application/postscript' => [ 'ai', 'eps', 'ps' ]</nowiki></code>, etc.) β no core patching needed, only the extensions allowlist. <pre> <nowiki> cp /var/www/wiki/LocalSettings.php /var/www/wiki/LocalSettings.php.bak.$(date +%Y%m%d%H%M%S) </nowiki> </pre> Edit the line from 9.1 to: <pre> <nowiki> $wgFileExtensions = array_merge( $wgFileExtensions ?? [ 'png', 'gif', 'jpg', 'jpeg' ], [ 'pdf', 'ppt', 'pptx', 'docx', 'xlsx', 'tiff', 'tif', 'bmp', 'ps', 'odt', 'ods', 'odp', 'odg' ] ); </nowiki> </pre> (Legacy <code><nowiki>doc</nowiki></code>/<code><nowiki>xls</nowiki></code> deliberately '''not''' added β not part of what was requested.) '''Verify''': same <code><nowiki>siprop=fileextensions</nowiki></code> API check as 9.1; confirmed all 11 new extensions present, no httpd error-log entries after reload. '''Known limitation, disclosed rather than silently shipped''': TIFF and PS files upload fine but render '''no thumbnail preview''' β the site's bitmap pipeline is GD, not ImageMagick (<code><nowiki>$wgUseImageMagick = false</nowiki></code>, unchanged from Phase 5), GD has no TIFF decoder, and no PostScript handler extension is installed (<code><nowiki>ls extensions/ | grep -iE 'tiff|postscript'</nowiki></code> β empty). Both formats behave like Office documents already do (download-only, generic file icon). Not fixed in this pass β flagged to the client as an open choice (add a TIFF/PS handler vs. accept upload-only) rather than guessed at. ----
Summary:
Please note that all contributions to TetraWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TetraWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)