Undefined method getFilePath in OJS 3.3

Describe the issue or problem
Using the EmbedGalley in OJS 3.3.0.13 raises a fatal error.

PHP Fatal error: Uncaught Error: Call to undefined method SubmissionFile::getFile() in /srv/www/htdocs/test/plugins/generic/embedGalley/EmbedGalleyPlugin.inc.php:167\nStack trace:\n#0 /srv/www/htdocs/test/plugins/generic/embedGalley/EmbedGalleyPlugin.inc.php(147): EmbedGalleyPlugin->_parseXml()\n#1 /srv/www/htdocs/test/lib/pkp/classes/plugins/HookRegistry.inc.php(107): EmbedGalleyPlugin->embedHtml()\n#2 /srv/www/htdocs/test/lib/pkp/classes/template/PKPTemplateManager.inc.php(1518): HookRegistry::call()\n#3 /srv/www/htdocs/test/cache/t_compile/7eace633da4006bf045fb0bd05e6ec4dfe5da1df^1c372c95cd85572e0fbc9a53d0323a0b229cfc78_0.app.frontendpagesarticle.tpl.php(43): PKPTemplateManager->smartyCallHook()\n#4 /srv/www/htdocs/test/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6376205bf35f04_17534846()\n#5 /srv/www/htdocs/test/lib/pkp/lib/vendor/smarty/smarty/libs/sys in /srv/www/htdocs/test/plugins/generic/embedGalley/EmbedGalleyPlugin.inc.php on line 167

This points to this position: https://github.com/ajnyga/embedGalley/blob/e578343ceff4b9e0f6d6a84ca99dbd398faa4708/EmbedGalleyPlugin.inc.php#L146
(yeah! I know, the line number is not the same, but I use a slightly modified plugin version).

@asmecher : Could you tell me which method to call to the plugin running again?

What application are you using?
OJS 3.3.0.13

Hi @GrazingScientist

The plugin isn’t maintained any more, I am afraid, and the version that is available is not compatible with OJS 3.3.

What you probably want to do is update the _parseHtmlContents method with how this now works in 3.3 using the Services API. For instance, the regular HTML Galley plugin:

Best
Jason

Thanks, @jnugent for your reply. I will dig into it.

Can you tell me where I can find a documentation on which parameters the plugins receive when called? E.g. ojs/HtmlArticleGalleyPlugin.inc.php at b1a585118234916662dceae15b94013f25993a49 · pkp/ojs · GitHub Does every plugin, disregarding the hook get these parameters?

Hi @GrazingScientist

Unfortunately the parameters passed to a hook are dependant on the hook and the context in which it is used. It’s probably best if you search through the code looking for the name of the hook you want to learn more about, e.g. “ArticleHandler::download” in that case.

Best
Jason

Hi @jnugent ,

okay! I will do so. I only hoped that there is an easier way. But probably the backend is changing quite fast currently and documentation would be old quite fast.

Still, could the PKP-team think about writing documentation for Plugin development? This would be super helpful, I would think!

Best Regards,

Adrian

Hi Adrian,

This documentation already exists in at least some form, here: https://docs.pkp.sfu.ca/dev/plugin-guide/en/

Best
Jason

Thank you for mentioning this documentation. I knew this. It is really basic.

I was talking more towards the possibility to really develop a plugin. How can I setup my development environment to use the PKP lib and OJS classes. How do I mock articles in the database? How can I mock a Smarty object? This would be the stuff I want from the documentation.

And, yes, I know, I am greedy. :wink:

All the best!

Adrian

Hi @GrazingScientist,

The “Release Notebook” for each release covers the main things that have changed between releases from a development perspective; one of the goals of those documents is to help plugin maintainers understand what areas of the code need to be changed in order to add support for the new release.

For 3.3.0, the Release Notebook is available here:

There’s a section called “Submission files” that covers the issue you’re encountering in your first post.

It looks like you’re also interested in automated testing; we’re starting to rely more and more on that ourselves, though there is still room for improvement. Currently we rely on integration testing much more than unit testing. Internally we use Cypress (for browser automation) and Travis (for the VM environment); here are some examples:

I’m also aware of at least one third-party plugin that uses Github Actions in place of Travis; you can see its configuration etc. here:

You can set up your tests to use a pre-existing database with a test dataset. Those are available here and are regularly generated automatically:

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

this is great! :star_struck: Thanks soooooooo much for these valuable resources.

Best,

Adrian

1 Like