Upgrade 9 y.o. OJS to OJS3

Hi.
I have a journal running for nine years (linguamatica.com). I am not sure what OJS version is installed (I think 2.3.6 but not sure).

Given I also want to change my hardware provider, i started with a clean installation, with latest OJS version (linguamatica.perl-hackers.net). At the moment I am dumping my database in the old machine, but I am not sure what is the best way to upgrade.

Suggestions are welcome.

Hi @ambs,

You can find the upgrade instructions on the following link:

https://pkp.sfu.ca/ojs/UPGRADE

As it is written it is suggested that you do first test upgrade before upgrading production system, especially since you are upgrading from rather old version.

Second suggestion is to use CLI for running final upgrade and not WEB as it takes some time and you can experience timeouts.

Further or there is a new version 3.1.1 promised coming out in few days so you might want to wait for it, before production upgrade (for testing purposes you can still give a try with the 3.1.0-1)

Regards, Primož

It seems I will need to go through an intermediate upgrade. Damn!

I am having PHP issues (and as my PHP knowledge is quite limited, need some help here).
The upgrade tool said:

PHP Deprecated:  Non-static method PKPApplication::defineExposedConstant() should not be called statically in /root/ojs/lib/pkp/classes/core/PKPApplication.inc.php on line 545
PHP Deprecated:  Non-static method PKPApplication::getExposedConstants() should not be called statically in /root/ojs/lib/pkp/classes/core/PKPApplication.inc.php on line 513
PHP Fatal error:  Cannot use 'String' as class name as it is reserved in /root/ojs/lib/pkp/classes/core/String.inc.php on line 57

Thank you

Hi @ambs,

I am assuming you are haveing PHP 7, correct? There are some issues with using OJS3 with PHP 7. Either use lower version of PHP or search this forum for hints how to overcome the issues.

Regards, Primož

Right, in this case dealing with OJS 2.4.8 and php 7.2. How lucky I will be?

(hand compiling PHP 5.6 for the first upgrade)

I think that 2.4.8 is not going to work with PHP7. OJS3 will work.

I managed to compile 5.6
The upgrade script complains with:

ERROR: Upgrade failed: DB: Specified key was too long; max key length is 767 bytes

I saw this on some stackoverflow questions, but I confess I did not understand how to solve it.
Thanks

OK, I found that I must upgrade MariaDB. Seems that Debian Testing doesn’t have a more recent version.
Trying using How To Install MariaDB on Debian 9 - Debian | ITzGeek

Now my upgrade stops at:

[code: Installer Installer::installEmailTemplate]
<h1>DB Error: Incorrect string value: '\xD8\xB3\xD9\x84\xD8\xA7...' for column 'body' at row 1</h1>ojs2: DB Error: Incorrect string value: '\xD8\xB3\xD9\x84\xD8\xA7...' for column 'body' at row 1

Any way I can get more details on what is failing?

Given the column name, looking to emails_templates_default_data but not easy to find the culprit.
Deleted all data in the table.
Still failing.
Looks like the data being installed giving trouble.

In case it helps:

MariaDB [ojs]> SELECT default_character_set_name FROM information_schema.SCHEMATA
    -> WHERE schema_name = "ojs";
+----------------------------+
| default_character_set_name |
+----------------------------+
| utf8mb4                    |
+----------------------------+
1 row in set (0.00 sec)

Ah…

MariaDB [ojs]> SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,        information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation   AND T.table_schema = "ojs"   AND T.table_name = "email_templates_default_data";
+--------------------+
| character_set_name |
+--------------------+
| latin1             |
+--------------------+
1 row in set (0.00 sec)

Using this to convert to utf8: mysql - How to convert all tables in database to one collation? - Stack Overflow

And now:
[schema: dbscripts/xml/ojs_schema.xml]
ERROR: Upgrade failed: DB: Duplicate entry ‘rules’ for key ‘article_search_keyword_text’

OK, changed the collation to utf8_bin and the script ended.

Trying to upgrade now to 3.x, got this:

root@linguamatica:/home/linguamatica/root# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 3.1.0.1]
[code: Installer Installer::abort]
ERROR: Upgrade failed: Upgrade unsupported. See docs/UPGRADE-UNSUPPORTED for details.

I suppose some version wasn’t updated somewhere?
Thanks

Hi @ambs,

You upgraded to 2.4.x first, right? Do you have the full output of the upgrade process?

Thanks,
Alec Smecher
Public Knowledge Project Team

Well, I didn’t have the history, so I dropped the database, imported the old one, ran the upgrade again.
Full output here:

root@linguamatica:~/ojs# /opt/php-5.6/bin/php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
ojs2 has produced an error
  Message: WARNING: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
  In file: /root/ojs/lib/pkp/classes/core/Core.inc.php
  At line: 95
  Stacktrace:
  Server info:
   OS: Linux
   PHP Version: 5.6.35
   Apache Version: N/A
   DB Driver: mysql
[version: 2.4.8.3]
[schema: lib/pkp/xml/schema/signoff.xml]
[data: dbscripts/xml/upgrade/2.4.3_preupdate_usageStatistics.xml]
[data: dbscripts/xml/upgrade/2.4.3_preupdate_usageStatistics2.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_article_files.xml]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_emaillog.xml]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_reviewrounds.xml]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_issues.xml]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_articles.xml]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_published_articles.xml]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_issue_galleys.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_article_galleys.xml]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_supp_files.xml]
[data: dbscripts/xml/upgrade/2.4.0_notifications.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::migrateReviewingInterests2]
[data: dbscripts/xml/upgrade/2.3.7_update.xml]
[code: Installer Installer::removeAuthorRevisedFilesFromSignoffs]
[note: docs/release-notes/README-2.3.7]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_article_galleys2.xml]
[data: lib/pkp/xml/mutexData.xml]
[data: dbscripts/xml/upgrade/2.4.0_update.xml]
[note: docs/release-notes/README-2.4.0]
[code: Installer Installer::migrateNotifications]

Hi @ambs,

It looks like it stopped dead partway through; do you see anything relevant in your PHP error log?

Thanks,
Alec Smecher
Public Knowledge Project Team

Well, created a bare minimum php.ini for my php5 installation:

error_reporting = E_ALL
display_errors = On
log_errors = On
log_errors_max_len = 2048
error_log = /tmp/php5.log
date.timezone = "Europe/Lisbon"

Dropped database, recreated and re-imported it. Code stops at same place. Log is empty.
What can I add to have further debug information?

Tried to add the -e flag to PHP, but didn’t help. It just stops there, without complaining on anything.
It is really weird that PHP or the tool itself do not print any error message, and just stop middle way.

It there a place where I can add some echos, to understand where things are going east?

Hi @ambs,

Hmm, I haven’t worked with that code for a while, but I have a couple thoughts OTOH:

  • Is there bad data in the notifications table? The easiest way to check and possibly resolve this is to run the following before running the upgrade script:

    DELETE FROM notifications;
    DELETE FROM notification_settings;
    

    This drops all notifications from the database – but the OJS 2.3.x codebase didn’t use it heavily so I think you might not even notice this. If the upgrade passes with this change in place, you’ll know there was some bad data there.

  • Is there a memory or execution time limit getting tripped? Check your php -i output to see whether this might be stopping the upgrade.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Weeee.

Successfully upgraded to version 2.4.8.3

(it was the delete!)
Will try a little later the migration to 3.x :slight_smile:

2 Likes

Took some time before I could test this upgrade, as it needed the files folder content, and I didn’t have it in the new server. So, rsync took some time.

After that, tried the upgrade. Got a lot of warnings (see here the full log). It ended with this error:

[post-install]
PHP Parse error:  syntax error, unexpected 'return' (T_RETURN), expecting function (T_FUNCTION) or const (T_CONST) in /home/linguamatica/root/lib/pkp/classes/filter/FilterHelper.inc.php on line 180

Thank you.

Hi @ambs,

Check that lib/pkp/classes/filter/FilterHelper.inc.php matches the version from the package; I suspect some change got inadvertently introduced there.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Oh, wait, I applied manually a patch regarding php 7.2. Don’t tell me I did :poop:

Exactly. Forgot an opening curly brace. And I no longer remembered that I needed to touch that file, if it wasn’t you!