Vitaliy-1 / docxConverter

Plugin for OJS 3 that parses DOCX and converts it to JATS XML format
GNU General Public License v2.0
21 stars 11 forks source link

Plugin doesn't check for requirements (e.g. PHP zip extension) #12

Open ronste opened 3 years ago

ronste commented 3 years ago

When trying to convert a docx on a fresh OJS 3.3 installation with Plugin Release Version 1.1.1 the button "Convert to XML" after clicking remains greyed and nothing more happens.

PHP error log: PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in /var/www/html/ojs/plugins/generic/docxConverter/docxToJats/src/docx2jats/DOCXArchive.php:14\nStack trace:\n#0 /var/www/html/ojs/lib/pkp/lib/vendor/composer/ClassLoader.php(478): include()\n#1 /var/www/html/ojs/lib/pkp/lib/vendor/composer/ClassLoader.php(346): Composer\Autoload\includeFile('/var/www/html/o...')\n#2 [internal function]: Composer\Autoload\ClassLoader->loadClass('docx2jats\\DOCXA...')\n#3 /var/www/html/ojs/plugins/generic/docxConverter/DOCXConverterHandler.inc.php(55): spl_autoload_call('docx2jats\\DOCXA...')\n#4 /var/www/html/ojs/lib/pkp/classes/core/PKPRouter.inc.php(395): ConverterHandler->parse(Array, Object(Request))\n#5 /var/www/html/ojs/lib/pkp/classes/core/PKPPageRouter.inc.php(246): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#6 /var/www/html/ojs/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPPageRouter->route(Object(Request))\n#7 /var/www/html/ojs/lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatche in /var/www/html/ojs/plugins/generic/docxConverter/docxToJats/src/docx2jats/DOCXArchive.php on line 14, referer: http://localhost:7481/ojs/index.php/tja33/authorDashboard/submission/1

Expected behaviour:

Vitaliy-1 commented 3 years ago

Hi @ronste,

ZipArchive is a part of a standard PHP distribution. E.g., just checked all stables releases: https://www.php.net/downloads.php and all of them contain this extension. I suspect the PHP version on your system wasn't installed from a release and compiled from a source code without enabling zip support, right?

ronste commented 3 years ago

Hi @Vitaliy-1 ,

this particular installation runs in a docker debian-slim container. PHP zip extension was not installed there (probably because of "slim"?). Its straightforward to handle once you looked up the error log. But looking at OJS waiting whether or not something will happen its not so nice for the user.

I'm currently testing whether we can use the plugin for a particular XML project we gonna start and/or our customers in general. From the customer point of view more feedback on the conversion process would be helpful. E.g. the next issue I ran into was that the docx file structure of my Word 2016 file didn't fit (docProps/content.xml path not found). Again, I had to look up the error log to figure this out. Our customers wouldn't be able to do that and rather write a support request to me ;-). Once the project started I may be able to contribute on those topics.

Best wishes, Ronald

Vitaliy-1 commented 3 years ago

But looking at OJS waiting whether or not something will happen its not so nice for the user.

Agree, it could at least a general message.

E.g. the next issue I ran into was that the docx file structure of my Word 2016 file didn't fit (docProps/content.xml path not found)

It's a cosmetic warning and I use custom properties mostly to extract Mendeley plugin data on references. It should be easy to add a check but there is a more general problem regarding applications that provide an export of documents in OOXML format don't always follow ECMA guidelines. This leads to problems like not all features of the document generated in one application can be imported to another through DOCX. There is definitely a place for improvement.

Once the project started I may be able to contribute on those topics

It would be great. I can provide guidance if needed :)