image blocks disappearing from mahara page

Bug #1626462 reported by Andrew
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Expired
Undecided
Unassigned

Bug Description

Hi,

I'd like to report a bug with images image blocks disappearing from Mahara pages - this problem has occurred more than once and is becoming increasingly concerning. The problem arises when a user (in this case, a learner) uploads links images to image blocks on one of their personal pages. The images appear as expected however at some point they then seem to disappear and there is no longer any images displaying. This seems to be purely affecting images content blocks (in this case image blocks) as the comments section remains present. It appears that no files are actually deleted, just the blocks from the page are missing. It may be a problem with other types of blocks, but in this case, only image blocks were present on the page. I thought it also best to mention that I noticed this issue when logging in as the user (masquerading) to check something on their behalf, however I think this may be pure coincidental.

The Mahara version here is 16.04.3 (2016033117) running on Linux. I have been able to identify this problem using Google Chrome (version 53.0.2785.116 m). I should also report that we have been made aware of the same issue from another client who is also running the exact same version (16.04.3) and this would further suggest that this is a bug needing addressed.

Thanks
Andy

Andrew (andrewsynergy)
summary: - images disappearing from mahara page
+ image blocks disappearing from mahara page
Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Andrew:

Can I get you to check a couple of things:

1) Is the site using MySQL or Postgres?
2) Is the page that is missing blocks also missing rows in the database table view_rows_columns ?
3) Does putting the fix in this patch https://reviews.mahara.org/#/c/7014/ and refreshing (in a browser) the broken page fix the problem?

Cheers

Robert

Changed in mahara:
status: New → Incomplete
Revision history for this message
Andrew (andrewsynergy) wrote :

Hi Robert,

1) MySQL

2) Are you able to confirm how we can identify if this is the case? I have taken the ID from that users page (where the content has disappeared) and checked for this ID in the view_rows_column table and found no entries. Is this correct approach?

Thanks
Andy

Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Andrew

Yes, if the view_rows_column table has no entries for the view ID then yes this is the issue.

Ok to find out what should be in the view_rows_columns table you can do this:

SELECT id, layout, type FROM view WHERE id = [ID];

where ID = the view id number, eg 5

If the 'layout' result is not null then run this command:

SELECT v.id, vlrc.row, vlc.columns FROM view_layout_rows_columns vlrc JOIN view_layout_columns vlc ON vlc.id = vlrc.columns WHERE viewlayout = [LAYOUTID];

where LAYOUTID = the number in the layout column from previous sql query, eg 12.

It should show you what row,columns values are missing from the view_rows_columns table.

Otherwise if the 'layout' result is null or empty it means the layout hasn't been changed since the page was made and so we need to find the default layout, so run this command:

SELECT vrc.row, vrc.columns FROM view v JOIN view_rows_columns vrc ON vrc.view = v.id WHERE v.template = 2 AND v.type = [TYPE];

where TYPE = the type of the view, eg 'portfolio'

This will give you the default layout info for this view type

You can then add back in the missing data and the page should be not broken again, for example for view ID = 5:

INSERT INTO view_rows_columns (view, row, columns) VALUES (5, 1, 3);

The patch I made does this querying for you and replacing the missing rows automatically when you visit the page.

Revision history for this message
Andrew (andrewsynergy) wrote :

Hi Robert,

We decided to opt for the patch approach in order to try and resolve this issue. We currently have two clients who are affected and have applied the patch to both of their codebases. We applied the exact same process to both - however one of the client's content has not been reinstated whereas the other has. Are there any other factors that we need to consider when carrying out this process or do you have any idea why this might've been the case? From my understanding, with this code in place - the issue of content disappearing should now have been resolved however our main concern now is to try and get the initial content reinstated.

Thanks
Andy

Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Andy

For the client that didn't have the content reinstated - can you look at their database for a page that is not displaying correctly and run this command:

SELECT bi.blocktype FROM block_instance bi WHERE view = [id of page];

This should show you which blocks should be appearing on the page

Then run:

SELECT bi.blocktype FROM block_instance bi JOIN view v ON v.id = bi.view JOIN view_rows_columns vrc ON vrc.view = v.id WHERE v.id = [id of page];

This will show you the same list if the info in view_rows_columns exists.

If the first command is not empty but the second one is then there is still something amiss with the fix. If the first command is empty it means the page itself is actually empty (no blocks associated with the page).

Cheers

Robert

Revision history for this message
Robert Lyon (robertl-9) wrote :

Also note the fix for the page will only come into play when someone navigates to view it in the browser.

Revision history for this message
Andrew (andrewsynergy) wrote :

Hi Robert,

Thanks for your reply.

I've had a look at the database using your advice and can confirm that your first suggested query did return some content. I then used the same ID and applied it to the 2nd SQL command and can confirm that it also came back with content. Not sure its relevant but thought it worth mentioning that the the first piece of SQL returned 47 rows whereas the second piece of SQL returned double that, 94 rows.

I've had a look at the view.php file in /lib/ and can confirm that it definitely contains the bug fix code. I can also confirm that we've hide that particular page in the browser (we used this as a means of testing to see if the contents of the page had returned). Again not sure how relevant this is but in order to view the page we have to masquerade as the user (as opposed to viewing it with the admin account whereby view permission is denied) and then navigate to the page - Not sure if this would have any impact? (ie if the user themselves hit the page directly would this have the desired affect of reinstating the content).

Have you any ideas on possible next steps in this case? Thanks for you help to this point.

Thanks
Andy

Revision history for this message
Andrew (andrewsynergy) wrote :

Hi Robert,

Do you have any thoughts on this?

Thanks
Andy

Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Andrew,

That all sounds normal now.

One more thing you can test is this:
1) Masquerade as user and edit the sharing for the page and share it with user 'admin'.
2) Stop masquerading and visit the page normally (as admin user) if that looks ok then things are all fixed
3) Masquerade as user again and edit the sharing for the page and remove the share with user 'admin'.

Cheers

Robert

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Mahara because there has been no activity for 60 days.]

Changed in mahara:
status: Incomplete → Expired
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.