[OJS 3.1.2.4] No file uploaded while using Plugin Gallery

Greetings,

I want to install two plugins: OAI JATS and JATS Template by @asmecher using Plugin Gallery. Both plugins (and most others) have a note next to them that they can be upgraded. I don’t think I have these two plugins installed at all, to start with, but hey. I click on Some of them show that they can be upgraded. I click on the plugin, then Upgrade, then OK and nothing happens.

I am using XAMPP on Windows, which does not come with tar by default, so I first read countless posts where people got “The tar command is not available”. Looked at php_error_log and found this:

PHP Fatal error: Uncaught Error: Call to a member function getProductType() on string in C:\xampp\htdocs\journal\lib\pkp\classes\plugins\PluginHelper.inc.php:204
Stack trace:
#0 C:\xampp\htdocs\journal\lib\pkp\controllers\grid\plugins\PluginGalleryGridHandler.inc.php(287): PluginHelper->upgradePlugin(‘oaiMetadataForm…’, ‘oaiJats’, NULL, ‘The tar command…’)
#1 C:\xampp\htdocs\journal\lib\pkp\controllers\grid\plugins\PluginGalleryGridHandler.inc.php(236): PluginGalleryGridHandler->installPlugin(Array, Object(Request), true)
#2 C:\xampp\htdocs\journal\lib\pkp\classes\core\PKPRouter.inc.php(390): PluginGalleryGridHandler->upgradePlugin(Array, Object(Request))
#3 C:\xampp\htdocs\journal\lib\pkp\classes\core\PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array)
#4 C:\xampp\htdocs\journal\lib\pkp\classes\core\Dispatcher.inc.php(134): PKPComponentRouter->route(Object(Request))
#5 C:\xampp\htdocs\journal\lib\pkp\classes\core\PKPApplication.inc.php(252): Dispatcher->dispatch(O in C:\xampp\htdocs\journal\lib\pkp\classes\plugins\PluginHelper.inc.php on line 204

I then installed GnuWin32 with tar in it, added it to Windows’ PATH, ran it in command prompt to untar -xvf oaiJats-v1_0_1-0.tar.gz into a folder. Tar seems to be working fine. Then I went to config.inc.php and set:

tar = “C:/GnuWin32/bin/tar.exe”

Now, when I try to upgrade/install a plugin in Plugin Gallery, nothing happens still, but the error message has changed. While stack trace lines #1-5 stay the same, the line #0 now reads:

#0 C:\xampp\htdocs\journal\lib\pkp\controllers\grid\plugins\PluginGalleryGridHandler.inc.php(287): PluginHelper->upgradePlugin(‘oaiMetadataForm…’, ‘oaiJats’, NULL, ‘No file uploade…’)

That error comes from common.xml, where it reads:

No file uploaded or invalid file type!

So, I am stuck here. Any help will be most welcome!

Hi @Lolekbolek,

Your configuration looks good, so I suspect you’re now encountering a different problem. Does PHP (when executing under the web server) have sufficient permissions to add directories/files to the plugins directory (and its subdirectories)?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher. I’m on Windows Server 2016, so I right clicked on the C:\xampp\htdocs\journal\lib\pkp\plugin directory and unchecked “Read-only”, so now when I go inside individual plugin folders and right click on any file, I can see that they are not set to read only.

I am not sure whether in Windows a process like PHP could have its own permissions. My account is set to “Local Account” and “Administrator”, but I don’t think it matters what privileges my account has when I try to upgrade a plugin using OJS’ web interface.

On a side note, does it matter that Plugin Gallery suggests me to upgrade a plugin that is not installed? If next to OAI JATS and JATS Template Plugin Gallery says “Can be upgraded” and the button in the pop-up dialogue says “Upgrade”, other plugins, like the Funding one, don’t have any wording in Plugin Gallery and the pop-up dialogue button is “Install”. Yet, neither of these plugins is installed. Maybe I should clear cache or purge something in the database?

Hi @Lolekbolek,

Unfortunately I’m not familiar with the Windows permission model, but I suspect Setting File Permissions in Windows with PHP - Stack Overflow (and linked discussions) might help. I would guess that it’s not just the read-only flag but also the user under which the PHP process runs.

For plugins that aren’t installed but appear to be upgradeable, I suspect these were previously installed at some point and have entries in the versions table. This is harmless (and arguably intentional) and shouldn’t be related to what you’re struggling with.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

While I am trying to solve the problem with PHP permissions in Windows that is preventing me from using Plugin Gallery, is there a way for me to try and manually unzip/untar OAI JATS and JATS Template plugins in the generic directory so they appear on the first Plugins tab and could be selected? I remember that it worked in 2.5 way back, but it doesn’t seem to work now.

Hi @Lolekbolek,

Yes, you can install the plugin manually by getting the appropriate file from the repository’s “Releases” area, and unpacking it into plugins/[category] (where [category] is the plugin’s category). Then, install the plugin into the database by running:

cd [ojsPath]
php lib/pkp/tools/installPluginVersion.php plugins/[category]/[pluginName]/version.xml

…where [ojsPath] is your OJS installation path and [pluginPath] is the name of the plugin you’re installing.

Please be careful to get a version that’s compatible with your release of OJS!

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you, @asmecher.

I downloaded OAI JATS Plugin v1.0.1-0 (because we are on 3.1.2-4, and ran this line:

“c:\xampp\htdocs\journal>php c:\xampp\htdocs\journal\lib\pkp\tools\installPluginVersion.php plugins\generic\oaiJats”

Then I restarted Apache for the good measure. However, I don’t see new plugin OAI JATS appear in either Installed Plugins nor Plugin Gallery. What could I be missing? Should I use htdocs\journal as my OJS installation path?

Hi @Lolekbolek,

Looks like we each made one mistake :slight_smile:

The oaiJats plugin is not a generic plugin, it’s an oaiMetadataFormats category plugin, so you need to install it in plugins/oaiMetadataFormats rather than plugins/generic. I’ve updated my above post to correct that.

(The jatsTemplate plugin is a generic category plugin.)

Then, when you use the installPluginVersion.php tool, make sure to specify the location of version.xml, not just the path you put the plugin’s code into.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you kindly, @asmecher!

Following your instructions, I was able to install both plugins. Then now show in my Plugin Gallery as “installed and up-to-date”!

1 Like