Skip to content

OJS-3.5.0.1-compatibility#116

Open
thathman wants to merge 2 commits intopkp:mainfrom
thathman:OJS-3.5.0.1-compatibility
Open

OJS-3.5.0.1-compatibility#116
thathman wants to merge 2 commits intopkp:mainfrom
thathman:OJS-3.5.0.1-compatibility

Conversation

@thathman
Copy link

@thathman thathman commented Nov 9, 2025

Summary

  • Fix PLN plugin recognition in OJS by returning the canonical plugin name plnplugin.
  • Use correct PKP notification constants and namespaces.
  • Ensure success notifications are created without fatals when saving settings or enabling the plugin.

Changes

  • plugins/generic/pln/PlnPlugin.php
    • import: use PKP\notification\Notification;
    • manage(): Notification::NOTIFICATION_TYPE_SUCCESS for saved settings notice
    • setEnabled(): Notification::NOTIFICATION_TYPE_SUCCESS for enable notice
    • getName(): return 'plnplugin' (matches PluginRegistry lookups)

Why

  • OJS checks for the PLN plugin via PluginRegistry::getPlugin('generic', 'plnplugin').
  • The old implementation returned a class-derived name which didn't match the registry's key, so the UI displayed “install from Plugin Gallery”.
  • Notifications referenced an undefined class (PKPNotification) which caused fatals.

Risks / Compat

  • Low risk; changes are limited to the PLN plugin's class name and notification constants.
  • Uses PKP\notification\Notification which is standard in recent OJS/PKP versions.

Rollback

  • Revert plugins/generic/pln/PlnPlugin.php.
  • Clear caches.

Checklist

  • Verified no PHP notices/fatals in logs/php_error.log
  • Verified PLN is recognized in Settings → Distribution
  • Verified notifications are displayed when saving/enabling
  • Cleared caches after deploy

Prevents fatal error when scheduled_tasks table doesn't exist yet.
The plugin now gracefully handles missing tables by:
- Checking table existence using DB::getSchemaBuilder()->hasTable() before querying
- Wrapping queries in try-catch blocks
- Returning null/false instead of throwing exceptions

This fixes the issue where plugin settings form crashes with:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'scheduled_tasks' doesn't exist

The methods hasScheduledTasks() and getLastExecutionDate() are added with
proper error handling to ensure the plugin works even when the scheduled_tasks
table hasn't been created yet (common in fresh OJS installations or when
scheduled tasks haven't been initialized).
Summary
- Fix PLN plugin recognition in OJS by returning the canonical plugin name `plnplugin`.
- Use correct PKP notification constants and namespaces.
- Ensure success notifications are created without fatals when saving settings or enabling the plugin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant