Bug in OJS 3.0.0–3.0.2 upgrade on PostgreSQL?

As previously noted, I ran into the ADODB bug attempting to upgrade.

That’s fixed now, but we’re running into a new problem. The upgrade process errors out with: PHP Fatal error: Call to a member function getId() on boolean in .../ojs/classes/install/Upgrade.inc.php on line 1592. That appears to have been a last-minute change just before the 3.0.2 release. Was it tested with PostgreSQL?

Hi @crism

I have tested it with PostgreSQL, I think. I think the problem seems to be that you do not get any manager user group here: ojs/Upgrade.inc.php at ojs-3_0_2-0 · pkp/ojs · GitHub i.e. that your $managerUserGroup = false. Could that be?

Best,
Bozana

That could be, @bozana, but I don’t think so… I see 6 rows in user_groups where role_id is 16, which is ROLE_ID_MANAGER. Is that what line 1591 looks for? If so, something else is going wrong…

Oh! Actually, @bozana, I think the problem is that there are three user groups in each journal context with role_id 16. Might getDefaultByRowId() return something odd in that situation?

SELECT * FROM user_groups WHERE role_id = 16;
 user_group_id | context_id | role_id | is_default | show_title | permit_self_registration 
---------------+------------+---------+------------+------------+--------------------------
             2 |          1 |      16 |          1 |          0 |                        0
             4 |          1 |      16 |          1 |          0 |                        0
             3 |          1 |      16 |          1 |          1 |                        0
            36 |          3 |      16 |          1 |          0 |                        0
            37 |          3 |      16 |          1 |          0 |                        0
            38 |          3 |      16 |          1 |          0 |                        0
(6 rows)

Hmmm… Strange :-\ Actually the table looks fine and the getDefaultByRowId() should return the first one. But the error message “PHP Fatal error: Call to a member function getId() on boolean in …/ojs/classes/install/Upgrade.inc.php on line 1592” tells that $managerUserGroup is boolean, which is only possible if there is non found :open_mouth: Could it maybe be that the $row['context_id'] is some other? Hmmm… Would it be maybe possible for you to test it once again and print out the $row['context_id'] and $managerUserGroup? I wold happily do that, but I would need an anonymized DB dump…
Thanks a lot!

Ah-hah! I think.

[Wed Mar 22 17:12:34.654828 2017] [:error] Updating a comment for submission 7
[Wed Mar 22 17:12:34.654865 2017] [:error] Submission context is 1
[Wed Mar 22 17:12:34.664258 2017] [:error] Updating a comment for submission 4
[Wed Mar 22 17:12:34.664296 2017] [:error] Submission context is 1
[Wed Mar 22 17:12:34.688839 2017] [:error] Updating a comment for submission 5
[Wed Mar 22 17:12:34.688880 2017] [:error] Submission context is 1
[Wed Mar 22 17:12:34.695351 2017] [:error] Updating a comment for submission 11
[Wed Mar 22 17:12:34.695373 2017] [:error] Submission context is 3
[Wed Mar 22 17:12:34.707423 2017] [:error] Updating a comment for submission 9
[Wed Mar 22 17:12:34.707448 2017] [:error] Submission context is 1
[Wed Mar 22 17:12:34.713742 2017] [:error] Updating a comment for submission 10
[Wed Mar 22 17:12:34.713762 2017] [:error] Submission context is 2
[Wed Mar 22 17:12:34.715200 2017] [:error] <-- this is where I called print_r() on $managerUserGroup
[Wed Mar 22 17:12:34.715220 2017] [:error] PHP Fatal error:  Call to a member function getId() on boolean in .../ojs/classes/install/Upgrade.inc.php on line 1595

Context 2 doesn’t exist any more! The upgrade script should be more bullet-proof, but I can clean up the debris from that journal manually, I think, meanwhile.

I’ve filed a bug report on this.

Is there a temporary fix for this?

Hi @Geremia

I am not sure what would you need – if you have the same problem as @crism, that there are entries in your DB from a journal that does not exist any more, it would be best to correct those data in the DB – it must come from an earlier bug, that not all journal data are deleted, when deleting a journal :frowning:

Best,
Bozana

Hi @Geremia,

Are you trying to fix the ERROR: type "serial" does not exist message? This discussion is about a different issue.

Regards,
Alec Smecher
Public Knowledge Project Team

ERROR: type "serial" does not exist is the error I get when upgrading from 3.0.0→3.0.2.

Hi @Geremia,

That’s not related to this thread. See Upgrade failure (Postgresql) for information on the error message you reported. It links through to this thread which includes a patch that should resolve the issue.

Regards,
Alec Smecher
Public Knowledge Project Team

That diff worked. thanks

1 Like