Forums | Mahara Community
Can't upgrade from 15.04 due to negative numbers in block_instance
09 August 2016, 20:14
I am aware this has been experienced in this ticket : mahara.org/interaction/forum/topic.php?id=7669
But luckily for them this was only the case for 2 records which could be swiftly changed.
My case however has many more lines of negative numbers.
Error message when upgrading Mahara :
"Could not execute command: UPDATE "block_instance" SET "order" = ? WHERE id = ?
- execute_sql(string(size 52), array(size 2)) at /lib/db/upgrade.php:4375
- xmldb_core_upgrade(string(size 10)) at lib/upgrade.php:342
- upgrade_core(object(stdClass)) at admin/upgrade.json.php:87
Does anyone have any ideas on how to combat this bug?
Thanks in advance!
10 August 2016, 18:04
The patch that Ghada provided on that other thread should be able to handle it, regardless of how many negative-numbered records you have.
11 August 2016, 1:36
Do you have any advice on adding the fix into the script?
I have tried appending Ghada's fix into my script but unfortunately when I follow the instructions and add the code at line 4125 - the output is the same.
I have also tried adding it in version order ( so I added it after the version previous to the one Ghada quoted) and the same outcome happened.
Sorry if it seems obvious and I'm missing the point.
11 August 2016, 11:10
It looks like Ghada's block (with version 2015092915) is quoting from the 15.10 upgrade script. If you're upgrading to Mahara 16.04, you'll find this block of code instead on line 4350, with version 2016030400. You should replace the contents of that block with the contents of Ghada's block (but leave the version number 2016030400 in place).
I believe Ghada's code basically adds a brief section in front of the standard version of the block, that tries to correct the negative numbers issue. It also contains some "if (is_mysql())" statements, so it might only work if you're on MySQL rather than Postgres.
If it works correctly for you, we should probably just upstream it into the standard Mahara distribution. Maybe with a check first to see whether the site contains any negative page numbers, to know whether we need to do that rectification step.
12 August 2016, 22:09
The update went well!
The instructions you suggested worked and allowed the upgrade to proceed.
Currently in the process of testing the site to see if there have been any repercussions of the change.
Will keep you updated!
15 August 2016, 13:06
In that case I'm going to proceed with incorporating Ghada's additional step into the core: https://bugs.launchpad.net/mahara/+bug/1613135