pkp/pln

Make plugin compatible with the latest OJS release (3.4.0)

Closed this issue · 7 comments

The plugin is currently using several classes that already don't exist anymore in the main OJS branch.

@jonasraoni Any progress on compatibility for OJS 3.4.x? We had to upgrade our OJS and are now missing the PLN plugin.

Thanks, Tobias

Hi @TobiasWantzen,

This issue is missing a review to be merged. There's one user testing the plugin in production, and it has been working fine so far (if something goes wrong, I'll be happy to provide fixes).

So, if you're comfortable with that, you can download the code from here:
https://github.com/jonasraoni/pln/tree/feature/main/57-support-latest-release
And install the plugin manually (see: https://github.com/pkp/pln?tab=readme-ov-file#installation-instructions).

And of course, I'll be glad to receive some feedback in case everything worked properly 😁

I installed the plugin manually without problems. However, after clicking on resubmit in the plugin status, I found the following errors in log file:
[12-Mar-2024 23:24:34 UTC] PHP Fatal error: Uncaught TypeError: APP\plugins\generic\pln\classes\depositObject\DepositObject::getContent(): Return value must be of type APP\issue\Issue|APP\submission\Submission, null returned in /home2/xxxxxxx/public_html/plugins/generic/pln/classes/depositObject/DepositObject.php:35
Stack trace:
#0 /home2/xxxxxxx/public_html/plugins/generic/pln/controllers/grid/StatusGridCellProvider.php(41): APP\plugins\generic\pln\classes\depositObject\DepositObject->getContent()
#1 /home2/xxxxxxx/public_html/lib/pkp/classes/controllers/grid/GridCellProvider.php(59): APP\plugins\generic\pln\controllers\grid\StatusGridCellProvider->getTemplateVarsFromRowColumn(Object(APP\plugins\generic\pln\controllers\grid\StatusGridRow), Object(PKP\controllers\grid\GridColumn))
#2 /home2/xxxxxxx/public_html/lib/pkp/classes/controllers/grid/GridHandler.php(1262): PKP\controllers\grid\GridCellProvider->render(Object(APP\core\Request), Object(APP\plugins\generic\pln\controllers\grid\StatusGridRow), Object(PKP\controllers\grid\GridColumn))
#3 /home2/xxxxxxx/public_html/lib/pkp/classes/controllers/grid/GridHandler.php(1163): PKP\controllers\grid\GridHandler->_renderCellInternally(Object(APP\core\Request), Object(APP\plugins\generic\pln\controllers\grid\StatusGridRow), Object(PKP\controllers\grid\GridColumn))
#4 /home2/xxxxxxx/public_html/lib/pkp/classes/controllers/grid/GridHandler.php(1138): PKP\controllers\grid\GridHandler->renderRowInternally(Object(APP\core\Request), Object(APP\plugins\generic\pln\controllers\grid\StatusGridRow))
#5 /home2/xxxxxxx/public_html/lib/pkp/classes/controllers/grid/GridHandler.php(1188): PKP\controllers\grid\GridHandler->renderRowsInternally(Object(APP\core\Request), Array)
#6 /home2/xxxxxxx/public_html/lib/pkp/classes/controllers/grid/GridHandler.php(1063): PKP\controllers\grid\GridHandler->renderGridBodyPartsInternally(Object(APP\core\Request))
#7 /home2/xxxxxxx/public_html/lib/pkp/classes/controllers/grid/GridHandler.php(735): PKP\controllers\grid\GridHandler->doSpecificFetchGridActions(Array, Object(APP\core\Request), Object(APP\template\TemplateManager))
#8 [internal function]: PKP\controllers\grid\GridHandler->fetchGrid(Array, Object(APP\core\Request))
#9 /home2/xxxxxxx/public_html/lib/pkp/classes/core/PKPRouter.php(334): call_user_func(Array, Array, Object(APP\core\Request))
#10 /home2/xxxxxxx/public_html/lib/pkp/classes/core/PKPComponentRouter.php(291): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array)
#11 /home2/xxxxxxx/public_html/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\PKPComponentRouter->route(Object(APP\core\Request))
#12 /home2/xxxxxxx/public_html/lib/pkp/classes/core/PKPApplication.php(388): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#13 /home2/xxxxxxx/public_html/index.php(21): PKP\core\PKPApplication->execute()
#14 {main}
thrown in /home2/xxxxxxx/public_html/plugins/generic/pln/classes/depositObject/DepositObject.php on line 35

Hi @rasool-wsl,

Thanks for the report, I think your database has some orphan data/pollution, I'll add a temporary fix for it on the code.

For now you can run the query below, it will generate the statements to delete the orphan records:

SELECT CONCAT(
	'DELETE FROM pln_deposits WHERE deposit_id = ', d.deposit_id, ';\n', 
    COALESCE(CONCAT('DELETE FROM pln_deposit_objects WHERE deposit_object_id = ', o.deposit_object_id, ';'), '')
) AS output
FROM pln_deposits d
LEFT JOIN pln_deposit_objects o
	ON o.deposit_id = d.deposit_id
LEFT JOIN issues i
	ON i.issue_id = o.object_id
WHERE
	o.deposit_object_id IS NULL OR i.issue_id IS NULL

The commit jonasraoni@1b4ae0e should address the problem.

Thanks a lot @jonasraoni for the quick response!
Your patch fixed the problem and the status displays "In progress" with no error in the error log file. So, everything is normal so far.