Topic on Extension talk:PdfHandler

MW Exception when uploading PDF

3
TieMichael (talkcontribs)

With PdfHandler enabled, I get a MW-Exception when uploading pdf-files to my wiki (using MW1.28). If PdfHandler is disables in LocalSettings.php everything is fine, also Thumbnails for existing Pdfs seem created normally.

Here is a log of the Exception:

[Mime] MimeAnalyzer::doGuessMimeType: analyzing head and tail of /tmp/phpddXZ86 for magic numbers.
[Mime] MimeAnalyzer::doGuessMimeType: magic header in /tmp/phpddXZ86 recognized as application/pdf
[Mime] MimeAnalyzer::guessMimeType: guessed mime type of /tmp/phpddXZ86: application/pdf
[Mime] MimeAnalyzer::improveTypeFromExtension: improved mime type for .pdf: application/pdf
wfShellExec: /bin/bash '/var/www/html/mediawiki/includes/limit.sh' ''\''pdfinfo'\'' -enc UTF-8  -l 9999999  -meta '\''/tmp/phpddXZ86'\''' 'MW_INCLUDE_STDERR=;MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=307200; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180; MW_USE_LOG_PIPE=yes'
[XMP] XMPReader::startElementModeInitial Ignoring unrecognized element <http://ns.adobe.com/pdf/1.3/:Producer>.
[XMP] XMPReader::startElementModeInitial Ignoring unrecognized element <http://purl.org/dc/elements/1.1/:format>.
[XMP] XMPReader::startElementModeInitial Ignoring unrecognized element <http://ns.adobe.com/xap/1.0/mm/:DocumentID>.
[XMP] XMPReader::startElementModeInitial Ignoring unrecognized element <http://ns.adobe.com/xap/1.0/mm/:InstanceID>.
PdfImage::retrieveMetaData: 'pdftotext' '/tmp/phpddXZ86' -
wfShellExec: /bin/bash '/var/www/html/mediawiki/includes/limit.sh' ''\''pdftotext'\'' '\''/tmp/phpddXZ86'\'' - ' 'MW_INCLUDE_STDERR=;MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=307200; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180; MW_USE_LOG_PIPE=yes'
wfShellExec: /bin/bash '/var/www/html/mediawiki/includes/limit.sh' ''\''pdfinfo'\'' -enc UTF-8  -l 9999999  -meta '\''/tmp/phpddXZ86'\''' 'MW_INCLUDE_STDERR=;MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=307200; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180; MW_USE_LOG_PIPE=yes'
[XMP] XMPReader::startElementModeInitial Ignoring unrecognized element <http://ns.adobe.com/pdf/1.3/:Producer>.
[XMP] XMPReader::startElementModeInitial Ignoring unrecognized element <http://purl.org/dc/elements/1.1/:format>.
[XMP] XMPReader::startElementModeInitial Ignoring unrecognized element <http://ns.adobe.com/xap/1.0/mm/:DocumentID>.
[XMP] XMPReader::startElementModeInitial Ignoring unrecognized element <http://ns.adobe.com/xap/1.0/mm/:InstanceID>.
PdfImage::retrieveMetaData: 'pdftotext' '/tmp/phpddXZ86' -
wfShellExec: /bin/bash '/var/www/html/mediawiki/includes/limit.sh' ''\''pdftotext'\'' '\''/tmp/phpddXZ86'\'' - ' 'MW_INCLUDE_STDERR=;MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=307200; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180; MW_USE_LOG_PIPE=yes'
UploadBase::verifyExtension: mime type application/pdf matches extension pdf, passing file
[exception] [cfc57b2ef5a59ebc2d422eea] /api.php   MWException from line 425 of /var/www/html/mediawiki/includes/filerepo/file/LocalFile.php: Could not find data for image 'SKMBT_C20317011809250_MT.pdf'.
#0 /var/www/html/mediawiki/includes/filerepo/file/LocalFile.php(553): LocalFile->loadExtraFromDB()
#1 /var/www/html/mediawiki/includes/filerepo/file/LocalFile.php(795): LocalFile->load(integer)
#2 /var/www/html/mediawiki/extensions/PdfHandler/CreatePdfThumbnailsJob.class.php(110): LocalFile->getMetadata()
#3 /var/www/html/mediawiki/includes/Hooks.php(195): CreatePdfThumbnailsJob::insertJobs(UploadFromFile, string, boolean)
#4 /var/www/html/mediawiki/includes/upload/UploadBase.php(481): Hooks::run(string, array)
#5 /var/www/html/mediawiki/includes/upload/UploadBase.php(347): UploadBase->verifyFile()
#6 /var/www/html/mediawiki/includes/upload/UploadFromFile.php(95): UploadBase->verifyUpload()
#7 /var/www/html/mediawiki/includes/api/ApiUpload.php(569): UploadFromFile->verifyUpload()
#8 /var/www/html/mediawiki/includes/api/ApiUpload.php(96): ApiUpload->verifyUpload()
#9 /var/www/html/mediawiki/includes/api/ApiMain.php(1434): ApiUpload->execute()
#10 /var/www/html/mediawiki/includes/api/ApiMain.php(509): ApiMain->executeAction()
#11 /var/www/html/mediawiki/includes/api/ApiMain.php(480): ApiMain->executeActionWithErrorHandling()
#12 /var/www/html/mediawiki/api.php(83): ApiMain->execute()
#13 {main}

Here config for PfHandler in LocalSettings.php

wfLoadExtension( 'PdfHandler' );
$wgUseImageMagick = true;
$wgPdfProcessor = 'gs';
$wgPdfInfo = 'pdfinfo';
$wgPdftoText = 'pdftotext';
$wgPdfPostProcessor = 'convert';
$wgPdfOutputExtension = "jpg";
$wgPdfHandlerDpi = "400";
$wgPdfHandlerJpegQuality = "95" ;
$wgPdfCreateThumbnailsInJobQueue = "false";

Any idea, what I am doing wrong? Thanks!

93.57.2.190 (talkcontribs)

I've the same issue...

أحمد (talkcontribs)

I got the same and found phabricator:T50700

As a workaround, to avoid the exception for now set:

$wgPdfCreateThumbnailsInJobQueue = false;

Reply to "MW Exception when uploading PDF"