Mahara 22.04 upgrade fails due to missing use of dbprefix syntax

Bug #1978300 reported by Bruno Malaval
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
21.04
Fix Released
High
Unassigned
21.10
Fix Released
High
Unassigned
22.04
Fix Released
High
Unassigned
22.10
Fix Released
High
Dianne Tennent

Bug Description

Mahara 22.04.1

Upgrade failed when using "$cfg->dbprefix" in config.php due to missing brackets in
lib/dp/upgrade.php :

Line 842
execute_sql("UPDATE artefact SET title = ? WHERE id = ?", array($record->email, $record->id));

need to be
execute_sql("UPDATE {artefact} SET title = ? WHERE id = ?", array($record->email, $record->id));

Thanks

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Bruno and Dianne,

Thank you for the report, Bruno. Dianne, can you please check it and if confirmed, create a patch for review, setting Bruno as author? I asked for his email.

Please also check if this change would need to be made in any other supported versions of Mahara.

Thank you
Kristina

Changed in mahara:
assignee: nobody → Dianne Tennent (dianne-t)
Revision history for this message
Bruno Malaval (brunomalaval) wrote :

Hi

On my side, I encounter the same problem when I upgrade from 21.10 to the last version of this branch, before upgrade to 22.04

File lib/db/upgrade.php (Latest commit 018c3f1 on 28 Apr)
line 2448 :
execute_sql("UPDATE artefact SET title = ? WHERE id = ?", array($record->email, $record->id));

need to be
execute_sql("UPDATE {artefact} SET title = ? WHERE id = ?", array($record->email, $record->id));

Thanks
Bruno Malaval

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Thank you for this update, Bruno.

Dianne, I forwarded you his email address.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review
Revision history for this message
Dianne Tennent (dianne-t) wrote :

Hi Bruno, thanks for reporting this - I have created a patch with you as the author.

This upgrade issue will happen in very specific case, i.e:
- when there is a difference between the email entries in artefact and artefact_internal_profile_email tables, which...
- would only have happened before we had code that ensured both entries were updated when a person changed their email address

This error was introduced in a patch created 2 months ago which checked for 'email info drift' to handle the above scenario - which was added to 20.10, 21.04, and 22.04

I was able to replicate the issue by manipulating data and upgrading from 21.10 to 22.04. Applying this patch fixed the problem.

So we will add this patch to the 20.10, 21.04, and 22.04 branches.

Thanks again Bruno!

no longer affects: mahara/20.10
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/12888
Committed: https://git.mahara.org/mahara/mahara/commit/38122cfcdb064f53d7cddf77aa60499c9b6634c5
Submitter: "Robert Lyon <email address hidden>"
Branch: main

commit 38122cfcdb064f53d7cddf77aa60499c9b6634c5
Author: Bruno Malaval <email address hidden>
Date: Thu Jun 16 16:16:17 2022 +1200

Bug 1978300: Fix SQL syntax in db upgrade step

22.04 upgrade was failing due to
missing use of dbprefix syntax (curly braces)

Needs cherry-picking onto 20.10, 21.04, 21.10 and 22.04

Change-Id: I5f7c0adba793fc0f610e01f9fcd23f7e70564b3b

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "22.04_DEV" branch: https://reviews.mahara.org/c/mahara/+/12904

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "21.10_DEV" branch: https://reviews.mahara.org/c/mahara/+/12905

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "21.04_DEV" branch: https://reviews.mahara.org/c/mahara/+/12906

Revision history for this message
Dianne Tennent (dianne-t) wrote :

Test steps:
1. Checkout 21.10
2. Ensure you have some users
3. Make the value of artefact.title where artefacttype = 'email' DIFFERENT to the value of artefact_internal_profile_email.email (for the same user)
4. Make a backup of the database in this state
5. Checkout main - it will fail
6. Replace database with the backup
7. Checkout the patch fix above
8. Then run the upgrade again - it should upgrade successfully (you may need to force the upgrade by using the -f flag running the cli script.)

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/12906
Committed: https://git.mahara.org/mahara/mahara/commit/9b3291564add10f3632f8a908c7c0c193fa2a761
Submitter: "Robert Lyon <email address hidden>"
Branch: 21.04_DEV

commit 9b3291564add10f3632f8a908c7c0c193fa2a761
Author: Bruno Malaval <email address hidden>
Date: Thu Jun 16 16:16:17 2022 +1200

Bug 1978300: Fix SQL syntax in db upgrade step

22.04 upgrade was failing due to
missing use of dbprefix syntax (curly braces)

Needs cherry-picking onto 20.10, 21.04, 21.10 and 22.04

Change-Id: I5f7c0adba793fc0f610e01f9fcd23f7e70564b3b
(cherry picked from commit 38122cfcdb064f53d7cddf77aa60499c9b6634c5)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/c/mahara/+/12905
Committed: https://git.mahara.org/mahara/mahara/commit/fdff77a8020b2f67888e9f3863b9b9e1610bdefa
Submitter: "Robert Lyon <email address hidden>"
Branch: 21.10_DEV

commit fdff77a8020b2f67888e9f3863b9b9e1610bdefa
Author: Bruno Malaval <email address hidden>
Date: Thu Jun 16 16:16:17 2022 +1200

Bug 1978300: Fix SQL syntax in db upgrade step

22.04 upgrade was failing due to
missing use of dbprefix syntax (curly braces)

Needs cherry-picking onto 20.10, 21.04, 21.10 and 22.04

Change-Id: I5f7c0adba793fc0f610e01f9fcd23f7e70564b3b
(cherry picked from commit 38122cfcdb064f53d7cddf77aa60499c9b6634c5)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/c/mahara/+/12904
Committed: https://git.mahara.org/mahara/mahara/commit/daf9bb258193cd36f326cf57935b1d1c136d2e30
Submitter: "Robert Lyon <email address hidden>"
Branch: 22.04_DEV

commit daf9bb258193cd36f326cf57935b1d1c136d2e30
Author: Bruno Malaval <email address hidden>
Date: Thu Jun 16 16:16:17 2022 +1200

Bug 1978300: Fix SQL syntax in db upgrade step

22.04 upgrade was failing due to
missing use of dbprefix syntax (curly braces)

Needs cherry-picking onto 20.10, 21.04, 21.10 and 22.04

Change-Id: I5f7c0adba793fc0f610e01f9fcd23f7e70564b3b
(cherry picked from commit 38122cfcdb064f53d7cddf77aa60499c9b6634c5)

no longer affects: mahara
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.