Artefacts not locked in in submitted view

Bug #1281787 reported by Robert Lyon on 2014-02-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Robert Lyon

Bug Description

This looks to be problem with data on older sites. I've marked as high as bad data should be sorted asap

Looking in the database there are views submitted for review but artefacts used in the view are not locked.

To find the rows:
FROM view_artefact va
LEFT JOIN view v on = va.view
LEFT JOIN artefact a on = va.artefact
WHERE v.submittedgroup IS NOT NULL AND a.locked = 0

And to fix them:
UPDATE artefact SET locked = 1
FROM view_artefact va
LEFT JOIN view v on = va.view
LEFT JOIN artefact a on = va.artefact
WHERE v.submittedgroup IS NOT NULL AND a.locked = 0) AS subquery

More investigation into how the databases ended up with bad data is needed and then a db upgrade change will need to be added to /lib/db/upgrade.php if needed.

Robert Lyon (robertl-9) on 2014-02-23
Changed in mahara:
status: Confirmed → In Progress
Aaron Wells (u-aaronw) wrote :

Did you figure out what caused these to not get locked? As I just commented on the bug, I'd prefer not to push a data fix for this condition until we know for sure that it's not going to happen again; and the only way to know that, is to know what bug caused this and that we've fixed that bug.

Robert Lyon (robertl-9) wrote :

Ok, now I've figured out what is going on.

In v1.3 onwards there is a function called update_locked that correctly locks the related artefacts for the submitted view, in fact it takes the user id and makes sure all the things that need to be locked are and anything that doesn't need to be locked is unlocked.

In v1.2 the form submit function in view/submit.php only updated the view table and did not lock any artefacts at all.

So if a site has come from pre 1.3 and a user had submitted a view (or views) then but had not submitted anything post upgrade to 1.3 (or higher) then the submitted pages would not have the artefacts correctly locked.

The db update will check for any users that fall into this category and apply the locks for them (due to the probability they are old, not currently used accounts).

Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit 30891a616ebc51a8283db2fb41052ba30509c6b5
Author: Robert Lyon <email address hidden>
Date: Mon Feb 24 10:43:10 2014 +1300

Making sure artefacts are locked for submitted views (Bug #1281787)

This can be a problem for older sites.

Should update any that are not locked but should be and do nothing if
all is fine.

Change-Id: Ie5fd71ab76b24009450987681a4800ccc3a8f496
Signed-off-by: Robert Lyon <email address hidden>

Aaron Wells (u-aaronw) on 2014-02-25
Changed in mahara:
status: In Progress → Fix Committed
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