pkp / customLocale

Fine-tune the language of OPS, OJS, or OMP without modifying files or changing it for everyone.
GNU General Public License v3.0
0 stars 18 forks source link

OJS crashes after activating the plugin #11

Open oBlissing opened 3 years ago

oBlissing commented 3 years ago

Setup:

Installed by extracting tar into <ojs>/plugins/generic/

[Tue May 18 16:17:05.276134 2021] [php7:error] [pid 6576:tid 1088] [client ::1:63979] PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in D:\\ApacheHosted\\ojs\\plugins\\generic\\customLocale\\CustomLocalePlugin.inc.php:32\nStack trace:\n#0 D:\\ApacheHosted\\ojs\\lib\\pkp\\classes\\plugins\\PluginRegistry.inc.php(69): CustomLocalePlugin->register('generic', 'plugins/generic...', NULL)\n#1 D:\\ApacheHosted\\ojs\\lib\\pkp\\classes\\plugins\\PluginRegistry.inc.php(142): PluginRegistry::register('generic', Object(CustomLocalePlugin), 'plugins/generic...', NULL)\n#2 D:\\ApacheHosted\\ojs\\lib\\pkp\\classes\\core\\Dispatcher.inc.php(133): PluginRegistry::loadCategory('generic', true)\n#3 D:\\ApacheHosted\\ojs\\lib\\pkp\\classes\\core\\PKPApplication.inc.php(362): Dispatcher->dispatch(Object(Request))\n#4 D:\\ApacheHosted\\ojs\\index.php(68): PKPApplication->execute()\n#5 {main}\n  thrown in D:\\ApacheHosted\\ojs\\plugins\\generic\\customLocale\\CustomLocalePlugin.inc.php on line 32

https://github.com/pkp/customLocale/blob/0ea1b88e1216bd2006558aecb79c6e75f7549817/CustomLocalePlugin.inc.php#L32

asmecher commented 3 years ago

@oBlissing, I think you are in the same situation as https://github.com/pkp/pkp-lib/issues/6137, where the plugin was somehow enabled site-wide when it's intended to be enabled/disabled for each plugin separately. Do you have any insight on how this happened? Were there any unusual steps in installing/enabling the plugin?

oBlissing commented 3 years ago

@asmecher That explains it. I am intending to use it site-wide, so the site-wide installation was intentional :) Looks like I'll have to look elsewhere to solve this. Thanks for the quick response!

asmecher commented 3 years ago

@oBlissing, where did you get the code you installed from? Is it one of the github repositories directly (e.g. the main branch), or one of the release .tar.gz packages? If the latter, what version?

oBlissing commented 3 years ago

@asmecher I downloaded the latest tar from the release-section on this repository page.

From this link: https://github.com/pkp/customLocale/releases/download/v1_1_0-1/customLocale-v1_1_0-1.tar.gz

asmecher commented 3 years ago

@oBlissing, at a glance, support for this plugin at the site level could be added very easily by simply using:

$context ? $context->getId() : CONTEXT_SITE

...in place of...

$context->getId()

If you're handy with PHP, you might give this a quick try. Your confirmation (and, if it works, a pull request) will help get this included in the next release!