Upgrade error in file VersionDAO.inc.php

Helo
I try upgrade OJS 2.4.5 to 2.4.7.1
My procedure:
wget http://pkp.sfu.ca/ojs/download/patch/ojs-2.4.5_to_2.4.7-1.patch.gz
unzip archive and patch -f -s -p1 < ojs-2.4.5_to_2.4.7-1.patch
after without error check patch:

php tools/upgrade.php check
Code version: 2.4.7.1
Database version: 2.4.5.0
Latest version: 2.4.7.1
Database version is older than code version
Run “tools/upgrade.php upgrade” to update

Then i run: php tools/upgrade.php upgrade
it is results:
[pre-install]
[load: upgrade.xml]
[version: 2.4.7.1]
[schema: lib/pkp/xml/schema/signoff.xml]
[schema: lib/pkp/xml/schema/common.xml]
[schema: lib/pkp/xml/schema/groups.xml]
[schema: lib/pkp/xml/schema/log.xml]
[schema: lib/pkp/xml/schema/announcements.xml]
[schema: lib/pkp/xml/schema/scheduledTasks.xml]
[schema: lib/pkp/xml/schema/temporaryFiles.xml]
[schema: lib/pkp/xml/schema/metadata.xml]
[schema: lib/pkp/xml/schema/reviews.xml]
[schema: lib/pkp/xml/schema/reviewForms.xml]
[schema: lib/pkp/xml/schema/controlledVocab.xml]
[schema: lib/pkp/xml/schema/submissions.xml]
[schema: lib/pkp/xml/schema/comments.xml]
[schema: lib/pkp/xml/schema/notes.xml]
[schema: lib/pkp/xml/schema/gifts.xml]
[schema: lib/pkp/xml/schema/mutex.xml]
[schema: lib/pkp/xml/schema/tombstone.xml]
[schema: lib/pkp/xml/schema/metrics.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]

[code: Installer Installer::localizeCustomBlockSettings]

[code: Installer Installer::removeCustomIdentifierSuffixOption]
[note: docs/release-notes/README-2.4.6]

[code: Installer Installer::deleteOrphanedCompletedPayments]
[note: docs/release-notes/README-2.4.7]
[note: docs/release-notes/README-BEACON]

[code: Installer Installer::addPluginVersions]
PHP Fatal error: Call to a member function getCurrent() on a non-object in /home/www/organizacja/ojs/public_html/lib/pkp/classes/site/VersionDAO.inc.php on line 145

If i dont patch 2.4.5 and only try upgrade results is error:
ojs2: You are trying to downgrade the product “pln” from version [1.0.2.0] to version [1.0.0.0]. Downgrades are not supported.,

Please suggest a solution
Lucien

Hi @lucien,

What do you see in plugins/generic/pln/version.xml?

Regards,
Alec Smecher
Public Knowledge Project Team

 <version>
         <application>pln</application>
         <type>plugins.generic</type>
         <release>1.0.0.0</release>
         <date>2014-06-01</date>
         <lazy-load>1</lazy-load>
         <sitewide>0</sitewide>
         <class>PLNPlugin</class>
 </version>

Hi @lucien,

OJS 2.4.7-1 contains version 1.0.2 of the PLN plugin. I’d suggest checking whether the code upgrade was applied fully; if it was, it should have updated the code for the PLN plugin too.

Regards,
Alec Smecher
Public Knowledge Project Team

if i run patch -p1 < ojs-2.4.5_to_2.4.7-1.patch plugin pln change to 1.0.0.0
but then if i run php tools/upgrade.php upgrade then:
PHP Fatal error: Call to a member function getCurrent() on a non-object in /home/www/organizacja/ojs/public_html/lib/pkp/classes/site/VersionDAO.inc.php on line 145

Its the problem

I’ve confirmed that the patch does change the PLN version from 1.0.0.0 to 1.0.2.0:

diff -urN ojs-2.4.5/plugins/generic/pln/version.xml ojs-2.4.7-1/plugins/generic/pln/version.xml
--- ojs-2.4.5/plugins/generic/pln/version.xml	2014-09-17 22:47:36.000000000 -0700
+++ ojs-2.4.7-1/plugins/generic/pln/version.xml	2015-10-22 17:30:30.315099690 -0700
@@ -4,8 +4,8 @@
 <!--
   * plugins/generic/pln/version.xml
   *
-  * Copyright (c) 2013-2014 Simon Fraser University Library
-  * Copyright (c) 2003-2014 John Willinsky
+  * Copyright (c) 2013-2015 Simon Fraser University Library
+  * Copyright (c) 2003-2015 John Willinsky
   * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
   *
   * Plugin version information.
@@ -13,8 +13,8 @@
 <version>
 	<application>pln</application>
 	<type>plugins.generic</type>
-	<release>1.0.0.0</release>
-	<date>2014-06-01</date>
+	<release>1.0.2.0</release>
+	<date>2015-07-13</date>
 	<lazy-load>1</lazy-load>
 	<sitewide>0</sitewide>
 	<class>PLNPlugin</class>

One of the problems with the patch method of upgrading is that if you have already upgraded the plugin manually (which is likely the case as notifications went out by email to the participants requesting just that), then when the patch is run it will get confusing fast.

Specifically, the patch will see the already changed code, and helpfully ask, “Reversed (or previously applied) patch detected! Assume -R?”. Answering “yes” here will actually undo the desired change.

If you haven’t made may local changes to your install, I strongly recommend using the “Full Package” upgrade instead of the patch based upgrade. It greatly clarifies the process.

1 Like