group files error after upgrade

Bug #1099811 reported by Gordon McLeod on 2013-01-15
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
Medium
Son Nguyen
1.6
Medium
Son Nguyen
1.7
Medium
Son Nguyen
1.8
Medium
Son Nguyen

Bug Description

Hi,
I upgraded to Mahara 1.6.2 on two sites. When upgrading both sites I had to alter the database to remove a latin1 collation somewhere in the tables, as outlined here - https://mahara.org/interaction/forum/topic.php?id=1770 The upgrade then ran and appeared to work, but I discovered a couple of closely related issues. In the first site I'm getting an error whenever any user tries to add a file to a page within a group (see screenshot). In the second test site the Files tab in groups is missing completely.

My best guess is that a table or index has either been corrupted or was missed from the upgrade - but I'm stumped about how to proceed in fixing this. Any suggestions would be welcome. The page not found issue is the priority.

Thanks, Gordon.

Gordon McLeod (g-mcleod1) wrote :
Melissa Draper (melissa) wrote :

Hi Gordon,

On your database, does the following query show you data that looks like the right page?

select * from view where id = 9691;

Gordon McLeod (g-mcleod1) wrote :

Hi Melissa,

Yes - running that query shows the correct content in the database (at least based on the title field). I note a few fields like 'owner' are null - I've attached a screenshot as I'm not sure if they should be populated. As the same thing is happening to all group pages I can't compare this with a working version at the moment.

Thanks, Gordon.

Gordon McLeod (g-mcleod1) wrote :

Second set of fields.

I've been getting a similar problem on a client's site.

When a new page is created within a group, the 'group' is set, but the 'owner' field is not set (I've traced through lib/view.php: function View::_create() and there is nowhere that I can see that makes any attempt to set the 'owner' field for group pages).

When you try to add anything to the page, the function activity_occurred('watchlist', $data) is called (line 1369 of view.php, in function process_changes). This then reaches ActivityTypeWatchlist::__construct(), which throws an exception if the 'owner' field is not set.

I'm afraid I'm not yet very familiar with the internals of Mahara (I am a Moodle developer most of the time), so I'm not quite sure which of these two functions are behaving incorrectly (the View::_create() function for not setting the 'owner' or the ActivityTypeWatchlist::__construct() function for expecting it to be set).

Gordon McLeod (g-mcleod1) wrote :

Hi Davo,

Would you mind having a quick chat about this issue to see if we can find a way to resolve it?
I've checked a backup of our Mahara 1.5.2 version and the database field for artefact owner is null there too for group content - but editing the group pages still works on that test site, so it's something else that changed during the upgrade to 1.6 which has caused the 'page not found' issue when trying to edit, though the issue you've outlined does need to be addressed. We make considerable use of group pages for collaboration and class reflective exercises, so being unable to edit groups sitewide is a pretty major issue here.
My e-mail is g.mcleod1 at rcs.ac.uk

Thanks, Gordon.

Gordon McLeod (g-mcleod1) wrote :

Just to add - I can create NEW pages within groups, but as soon as the page has been saved I'm then unable to edit that page as the 'Page with id xxxx not found' error then pops up.

I've managed to track down exactly why this was triggering on this site, but not on other Mahara sites (and to clear up confusion, the 'client' who's site I was investigating was Gordon's site - I was assigned the issue to investigate but only had the site name, not the contact name).

Usually the 'delay' field for the 'watchlist' activity is set to '1', so that the code which was throwing an exception on this site is only called via cron. With cron running, there is already a workaround in place to not throw an error if the 'owner' field is 'null', on the assumption that the owner must have been deleted before cron was called. This means that cron was silently coping with 'group' pages, none of which have an 'owner' value set.

On this site, the 'delay' field was set to '0', so the watchlist was being updated immediately and throwing an exception when the 'owner' field was null.

I would recommend fixing this by updating the ActivityTypeWatchlist '__construct()' function to simply return if the 'owner' is not found, rather than throwing an exception.

Changed in mahara:
status: New → Confirmed
Gordon McLeod (g-mcleod1) wrote :

Hi,
Davo - thank you for the solution and explanation.
Ironically the change to the watchlist delay was made because of the ongoing issue with the cron activity_process_queue not updating next runtime on the site (which was preventing watchlist from working). Changing the delay to 0 was set to see if notifications would be sent out instantly rather than waiting for a cron job to trigger - which seemed to work, as we then had notifications being sent out as intended. It was several days after that change was made before anyone reported they were having problems editing group pages.
Regards, Gordon.

Changed in mahara:
importance: Undecided → Medium
Son Nguyen (ngson2000) wrote :

This issue not only happens when upgrading to Mahara 1.6 but also to 1.8

Son Nguyen (ngson2000) wrote :

It also happens to institution pages

Son Nguyen (ngson2000) on 2013-12-17
Changed in mahara:
assignee: nobody → Son Nguyen (ngson2000)
status: Confirmed → In Progress
Son Nguyen (ngson2000) wrote :

This patch should be backported for 1.6, 1.7 and 1.8

Son Nguyen (ngson2000) wrote :
Son Nguyen (ngson2000) wrote :

Oh, my bad. https://reviews.mahara.org/2810 is the right patch for this bug

Son, how can this be tested?

Reviewed: https://reviews.mahara.org/2810
Committed: http://gitorious.org/mahara/mahara/commit/b4d567f2c631a9e5f1f95d729a723b190a2c224a
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit b4d567f2c631a9e5f1f95d729a723b190a2c224a
Author: Son Nguyen <email address hidden>
Date: Tue Dec 17 09:36:29 2013 +1300

Fix the watched group/institution page errors (Bug #1099811)

Get the correct owner info of a watched view in cases of group or
institution pages

Change-Id: I144f969a1cbe464892cc20a33fa6336928373278
Signed-off-by: Son Nguyen <email address hidden>

Mahara Bot (dev-mahara) wrote :

Patch for "1.7_STABLE" branch: https://reviews.mahara.org/3037

Mahara Bot (dev-mahara) wrote :

Patch for "1.6_STABLE" branch: https://reviews.mahara.org/3038

Reviewed: https://reviews.mahara.org/3036
Committed: http://gitorious.org/mahara/mahara/commit/6047c5f2fb2f61906811bce79748749e62b5d209
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.8_STABLE

commit 6047c5f2fb2f61906811bce79748749e62b5d209
Author: Son Nguyen <email address hidden>
Date: Tue Dec 17 09:36:29 2013 +1300

Fix the watched group/institution page errors (Bug #1099811)

Get the correct owner info of a watched view in cases of group or
institution pages

Change-Id: I144f969a1cbe464892cc20a33fa6336928373278
Signed-off-by: Son Nguyen <email address hidden>

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3037
Committed: http://gitorious.org/mahara/mahara/commit/39d8bc5b6da352afebdf871f2664161b5fb67dc4
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.7_STABLE

commit 39d8bc5b6da352afebdf871f2664161b5fb67dc4
Author: Son Nguyen <email address hidden>
Date: Tue Dec 17 09:36:29 2013 +1300

Fix the watched group/institution page errors (Bug #1099811)

Get the correct owner info of a watched view in cases of group or
institution pages

Change-Id: I144f969a1cbe464892cc20a33fa6336928373278
Signed-off-by: Son Nguyen <email address hidden>

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3038
Committed: http://gitorious.org/mahara/mahara/commit/8c8745efd532c47158470b9b68415a2068e9e593
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.6_STABLE

commit 8c8745efd532c47158470b9b68415a2068e9e593
Author: Son Nguyen <email address hidden>
Date: Tue Dec 17 09:36:29 2013 +1300

Fix the watched group/institution page errors (Bug #1099811)

Get the correct owner info of a watched view in cases of group or
institution pages

Change-Id: I144f969a1cbe464892cc20a33fa6336928373278
Signed-off-by: Son Nguyen <email address hidden>

Aaron Wells (u-aaronw) on 2014-04-03
no longer affects: mahara/1.9
Robert Lyon (robertl-9) on 2014-04-22
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers