Forums | Mahara Community
Support
/
Upgrading 1.9.1 to 16.04.3
23 September 2016, 21:28
Hi,
We're running 1.9.1 and I am trying to upgrade it to the latest version, but the upgrade is failing every time.
The first problem was with the block_instances table, so I have had to change the index on that table to INDEX instead of UNIQUE.
Now, when i try to run the upgrade it says:
Failed to install (check logs for xmldb errors)
- install_from_xmldb_file(string(size 62)) at /var/www/html/mahara/htdocs/lib/upgrade.php:412
- upgrade_plugin(object(stdClass)) at /var/www/html/mahara/htdocs/lib/db/upgrade.php:4073
- xmldb_core_upgrade(string(size 10)) at /var/www/html/mahara/htdocs/lib/upgrade.php:342
- upgrade_core(object(stdClass)) at /var/www/html/mahara/htdocs/admin/upgrade.json.php:87
The error logs weren't working either, so I've had to add some code in just to get them to log, and this is what it#s saying:
Filling in level-1 child artefact paths
Filling in level-2 child artefact paths
Filling in level-3 child artefact paths
Filling in level-4 child artefact paths
Done filling in child artefact paths
Create 'objectionable' table.
Table objectionable exists. Create skipped
Migrating objectionable records to new format
Drop constraint on 'view_access'
Update 'view_access' accesstype
Add 'artefact_access' table.
Table artefact_access exists. Create skipped
Add module related tables
Table module_installed exists. Create skipped
Table module_cron exists. Create skipped
Table module_config exists. Create skipped
Table module_event_subscription exists. Create skipped
Fix up auth_clean_expired_password_requests cron
Add 'feedbacknotify' option to 'group' table
Delete leftover data which are not associated to any institution
Delete leftover custom layouts / usr registration
Check blocktype 'text' is installed
Allow anonymous pages
Add 'allowarchives' column to the 'group' table
Add 'submittedstatus' column to 'view' table
Need to update the submitted status for any existing views that are submitted
Add 'submittedstatus' column to 'collection' table
Need to update the submitted status for any existing collections that are submitted
Adding the export queue / submission tables
Table export_queue exists. Create skipped
Table export_queue_items exists. Create skipped
Table export_archive exists. Create skipped
Table archived_submissions exists. Create skipped
Add the socialprofile artefacttype
12/12
Clean up elasticsearch fields for the old messaging fields
Delete unused, but still installed artefact types
Install the social profile blocktype so users can see their migrated data
Install 'multirecipientnotification' plugin
Make sure default notifications are not set to 'none'
Place skin fonts in their correct directories
Unlock root user grouphomepage template in case it is locked
Add cacheversion and assign random string
Add in 'shortcut' category to 'blocktype_category'
Fix up group homepages so that no duplicate 'groupview' blocks are present
Remove layout preview thumbs directory
Add a 'sortorder' column to 'blocktype_installed_category'
Need to update any dashboard pages to not have skins
Remove bbcode formatting from existing wall posts
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
Update search config settings
Update block categories for plugins
Updating TinyMCE emoticon locations in mahara database
Updating 'block_instance' data for TinyMCE
4/4
Force install of annotation and webservices plugins
mysqli error: [1050: Table 'artefact_annotation_deletedby' already exists] in EXECUTE("CREATE TABLE artefact_annotation_deletedby (
id BIGINT(10) NOT NULL auto_increment,
name VARCHAR(50) NOT NULL,
CONSTRAINT PRIMARY KEY (id)
)ENGINE=innodb")
Command was: CREATE TABLE artefact_annotation_deletedby (
id BIGINT(10) NOT NULL auto_increment,
name VARCHAR(50) NOT NULL,
CONSTRAINT PRIMARY KEY (id)
)ENGINE=innodb
Could not execute command: CREATE TABLE artefact_annotation_deletedby (
id BIGINT(10) NOT NULL auto_increment,
name VARCHAR(50) NOT NULL,
CONSTRAINT PRIMARY KEY (id)
)ENGINE=innodb
mysqli error: [1050: Table 'artefact_annotation' already exists] in EXECUTE("CREATE TABLE artefact_annotation (
annotation BIGINT(10) NOT NULL,
artefact BIGINT(10) DEFAULT NULL,
view BIGINT(10) DEFAULT NULL,
CONSTRAINT PRIMARY KEY (annotation),
CONSTRAINT arteanno_ann_fk FOREIGN KEY (annotation) REFERENCES artefact (id),
CONSTRAINT arteanno_art_fk FOREIGN KEY (artefact) REFERENCES artefact (id),
CONSTRAINT arteanno_vie_fk FOREIGN KEY (view) REFERENCES view (id)
)ENGINE=innodb")
Command was: CREATE TABLE artefact_annotation (
annotation BIGINT(10) NOT NULL,
artefact BIGINT(10) DEFAULT NULL,
view BIGINT(10) DEFAULT NULL,
CONSTRAINT PRIMARY KEY (annotation),
CONSTRAINT arteanno_ann_fk FOREIGN KEY (annotation) REFERENCES artefact (id),
CONSTRAINT arteanno_art_fk FOREIGN KEY (artefact) REFERENCES artefact (id),
CONSTRAINT arteanno_vie_fk FOREIGN KEY (view) REFERENCES view (id)
)ENGINE=innodb
Could not execute command: CREATE TABLE artefact_annotation (
annotation BIGINT(10) NOT NULL,
artefact BIGINT(10) DEFAULT NULL,
view BIGINT(10) DEFAULT NULL,
CONSTRAINT PRIMARY KEY (annotation),
CONSTRAINT arteanno_ann_fk FOREIGN KEY (annotation) REFERENCES artefact (id),
CONSTRAINT arteanno_art_fk FOREIGN KEY (artefact) REFERENCES artefact (id),
CONSTRAINT arteanno_vie_fk FOREIGN KEY (view) REFERENCES view (id)
)ENGINE=innodb
mysqli error: [1050: Table 'artefact_annotation_feedback' already exists] in EXECUTE("CREATE TABLE artefact_annotation_feedback (
artefact BIGINT(10) NOT NULL,
onannotation BIGINT(10) NOT NULL,
private TINYINT(1) unsigned NOT NULL DEFAULT 0,
deletedby VARCHAR(50) DEFAULT NULL,
requestpublic VARCHAR(50) DEFAULT NULL,
lastcontentupdate DATETIME DEFAULT NULL,
CONSTRAINT PRIMARY KEY (artefact),
CONSTRAINT arteannofeed_art_fk FOREIGN KEY (artefact) REFERENCES artefact (id),
CONSTRAINT arteannofeed_ona_fk FOREIGN KEY (onannotation) REFERENCES artefact (id),
CONSTRAINT arteannofeed_del_fk FOREIGN KEY (deletedby) REFERENCES artefact_annotation_deletedby (name),
CONSTRAINT arteannofeed_req_fk FOREIGN KEY (requestpublic) REFERENCES artefact_annotation_deletedby (name)
)ENGINE=innodb")
Command was: CREATE TABLE artefact_annotation_feedback (
artefact BIGINT(10) NOT NULL,
onannotation BIGINT(10) NOT NULL,
private TINYINT(1) unsigned NOT NULL DEFAULT 0,
deletedby VARCHAR(50) DEFAULT NULL,
requestpublic VARCHAR(50) DEFAULT NULL,
lastcontentupdate DATETIME DEFAULT NULL,
CONSTRAINT PRIMARY KEY (artefact),
CONSTRAINT arteannofeed_art_fk FOREIGN KEY (artefact) REFERENCES artefact (id),
CONSTRAINT arteannofeed_ona_fk FOREIGN KEY (onannotation) REFERENCES artefact (id),
CONSTRAINT arteannofeed_del_fk FOREIGN KEY (deletedby) REFERENCES artefact_annotation_deletedby (name),
CONSTRAINT arteannofeed_req_fk FOREIGN KEY (requestpublic) REFERENCES artefact_annotation_deletedby (name)
)ENGINE=innodb
Could not execute command: CREATE TABLE artefact_annotation_feedback (
artefact BIGINT(10) NOT NULL,
onannotation BIGINT(10) NOT NULL,
private TINYINT(1) unsigned NOT NULL DEFAULT 0,
deletedby VARCHAR(50) DEFAULT NULL,
requestpublic VARCHAR(50) DEFAULT NULL,
lastcontentupdate DATETIME DEFAULT NULL,
CONSTRAINT PRIMARY KEY (artefact),
CONSTRAINT arteannofeed_art_fk FOREIGN KEY (artefact) REFERENCES artefact (id),
CONSTRAINT arteannofeed_ona_fk FOREIGN KEY (onannotation) REFERENCES artefact (id),
CONSTRAINT arteannofeed_del_fk FOREIGN KEY (deletedby) REFERENCES artefact_annotation_deletedby (name),
CONSTRAINT arteannofeed_req_fk FOREIGN KEY (requestpublic) REFERENCES artefact_annotation_deletedby (name)
)ENGINE=innodb
Array to string conversion
Array
Failed to install (check logs for xmldb errors)
Does anyone know what I need to do to fix this?
Do I need to upgrade to a lower version first, and then upgrade to the latest one?
Thanks
23 September 2016, 22:42
Hi Conn,
The block_instance bug is a known issue and has been fixed Mahara 16.04.4.
https://bugs.launchpad.net/mahara/+bug/1613135
I'd recommend using that version.
You should be able to upgrade from 1.9 to 16.04 without an intermediate step.
When you rerun the upgrade, please make sure to drop the database, restore the backup and start the upgrade again.
It doesn't know where you last upgraded to and tries to create the same table again.
Please let me know how you go.
Cheers,
Ghada
26 September 2016, 21:44
Hi,
16.04.4 doesn't seem to have been released yet, so I'll need to do 16.04.3 for now, as currently my Mahara is just sitting there unusable.
I think I've resolved the block_instance problem, by removing the UNIQUE index before I do the upgrade, but then it just fails on something else (see the error log posted previously).
26 September 2016, 22:39
I've just tried upgrading to a previous version instead to see if I can upgrade 1 step at a time (1.10.1) and even that has failed, though it hasn't given me any actual error messages, just "Failed to upgrade".
27 September 2016, 0:20
Hi Conn,
Can you please confirm:
1. That you delete the database and restore the original 1.9.1 database before each upgrade trial?
2. Please run the following query against your 1.91. database and let me know the results:
select * from artefact_installed;
select * from blocktype_installed;
3. Can you please confirm that these tables do not exist in your 1.9.1 database?
artefact_annotation_deletedby
artefact_annotation
artefact_annotation_feedback
4. Are you also able to add more logging to see what the $data value is when it comes back from this call (line 4072 in htdocs/lib/db/upgrade.php):
$data in this line ... if ($data = check_upgrades('artefact.annotation')) {
It's a very strange error because it is indicating that the annotation tables already exist and they definitely should not in version 1.9.
Also, I'm not convinced that you're resolved the issue with the duplicate key for block_instances. I think it will cause you issues down the road after the upgrade. You should consider cherry-picking the commit from the bug fix:
* https://reviews.mahara.org/#/c/6877/
The command is:
* git fetch https://reviews.mahara.org/mahara refs/changes/77/6877/1 && git cherry-pick FETCH_HEAD
Thanks,
Ghada
27 September 2016, 1:17
With point 1 above, please confirm you drop the database - that you are NOT restoring the database over the existing one. It must be dropped before the restore.
Thanks,
Ghada
27 September 2016, 3:33
Hi,
I've got past the "core" errors now, you were right I'd forgotten to delete some of the tables that it created the first time I ran the upgrade.
However now it is erroring on the artefect.blog component.
Failed to get a recordset: mysqli error: [1146: Table 'mahara.artefact_file_embedded' doesn't exist] in EXECUTE("SELECT "id" FROM "artefact_file_embedded" WHERE "fileid" = '131' AND "resourcetype" = 'blogpost' AND "resourceid" = '132' ") Command was: SELECT "id" FROM "artefact_file_embedded" WHERE "fileid" = ? AND "resourcetype" = ? AND "resourceid" = ? and values was (0:131,1:blogpost,2:132)
- get_recordset_sql(string(size 108), array(size 3)) at /var/www/html/mahara/htdocs/lib/dml.php:825
- get_field_sql(string(size 108), array(size 3)) at /var/www/html/mahara/htdocs/lib/dml.php:813
- get_field(string(size 22), string(size 2), string(size 6), string(size 3), string(size 12), string(size 8), string(size 10), string(size 3)) at/var/www/html/mahara/htdocs/lib/embeddedimage.php:87
- EmbeddedImage::prepare_embedded_images(string(size 1654), string(size 8), string(size 3), null, string(size 1)) at/var/www/html/mahara/htdocs/artefact/blog/db/upgrade.php:75
- xmldb_artefact_blog_upgrade(string(size 10)) at /var/www/html/mahara/htdocs/lib/upgrade.php:418
- upgrade_plugin(object(stdClass)) at /var/www/html/mahara/htdocs/admin/upgrade.json.php:87
Looking at the code, it looks like in the blog upgrade, it's calling this method:
EmbeddedImage::prepare_embedded_images
Which in turn is calling this:
$imgispublic = get_field('artefact_file_embedded', 'id', 'fileid', $imgid, 'resourcetype', $resourcetype, 'resourceid', $resourceid);
But because it is running the artefact.blog upgrade before the artefect.file upgrade, that artefact_file_embedded table hasn't been created yet, so it fails.
For now I will just have to try and create that table beforehand and see if that works, but it looks like that's a error in the upgrade script?
27 September 2016, 9:43
Hi Conn,
In order to be able to assist you, can you please confirm that you drop the database first before you restore it?
It's not enough that you delete tables.
Thanks,
Ghada
27 September 2016, 20:48
Hi,
Yes, I was dropping the database for that 2nd lot of errors.
I've got it working now, but I had to change the upgrade code to ensure that file_embedded table was created before the artefact.blog upgrade code was run, as specified in my previous post.