Can't edit group homepage template on upgraded site

Bug #1369315 reported by Kristina Hoeppner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon

Bug Description

Mahara 1.10 dev:

I upgraded my user manual Mahara instance from Mahara 1.9 to 1.10dev, but don't have an edit button for the group homepage template under Admin -> Config site -> Pages. I do see one on a fresh install.

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

Hi Kristina,

Ok, I've not been able to replicate yet but what I think has happened is this.

In the template for displaying that page is:

{if !$view.submittedto && (!$view.locked || $editlocked)}
  ... display the edit button ...
{/if}

So I suspect in your case the view is locked for some reason.

You can check this out by looking at the db for the site page templates by going:

SELECT v.* FROM "view" v WHERE v.owner = 0 ORDER BY v.title, v.id;

and seeing if any of the results have locked = 1

If it is the case that locked = 1 then I think the problem is caused by the following code in the db/upgrade.php script:

    if ($oldversion < 2014022400) {
        // Make sure artefacts are properly locked for submitted views.
        // Can be a problem for older sites
        $submitted = get_records_sql_array("SELECT v.owner FROM {view_artefact} va
                        LEFT JOIN {view} v on v.id = va.view
                        LEFT JOIN {artefact} a on a.id = va.artefact
                        WHERE (v.submittedgroup IS NOT NULL OR v.submittedhost IS NOT NULL)", array());
        if ($submitted) {
            require_once(get_config('docroot') . 'artefact/lib.php');
            foreach ($submitted as $record) {
                ArtefactType::update_locked($record->owner);
            }
        }
    }

I suspect something in your mahara instance had some views submitted and somehow that made the group homepage template get marked as locked for some reason.

Aaron Wells (u-aaronw)
Changed in mahara:
status: New → Triaged
importance: Undecided → High
status: Triaged → Incomplete
Robert Lyon (robertl-9)
Changed in mahara:
status: Incomplete → Invalid
Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Kristina,

On looking at your database dump I notice that the default group homepage template was set to locked before your upgrade so that is the reason why you couldn't edit it after the upgrade.

As the system installs the the three default templates in an unlocked state I can only conclude you ended up locking it somehow and because the templates are owned by user with id 0 I can't see how you could have done that via the mahara interface as you can't log in as user 0

Robert Lyon (robertl-9)
Changed in mahara:
status: Invalid → In Progress
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/3704

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

Ok, turns out there is a problem if you are upgrading from a version earlier than 1.5.0 as there is a db call to ugrade all grouphomepages to be locked including the root user one.

Have added patch to fix this

Son Nguyen (ngson2000)
Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

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

commit f36fbc1c98349a68adee8ee574e524e105d6a79b
Author: Robert Lyon <email address hidden>
Date: Thu Sep 18 11:07:28 2014 +1200

Unlock root group homepage template to allow for editing (Bug #1369315)

Due to the line 1868 in lib/db/upgrade.php
commit 1e4f1c55cc032dd4dea6ed7467746edfffa4e7d5

All group homepages were locked including the one owned by root user.
That was fine before as one couldn't edit the root user's template
but now you can so we need to let this view be unlocked.

Only an issue if upgrading from version before 1.5.0

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

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/3813

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3813
Committed: http://gitorious.org/mahara/mahara/commit/a68f8ea02f89a29af69d64b80580941b29a7ed42
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit a68f8ea02f89a29af69d64b80580941b29a7ed42
Author: Robert Lyon <email address hidden>
Date: Thu Sep 18 11:07:28 2014 +1200

Unlock root group homepage template to allow for editing (Bug #1369315)

Due to the line 1868 in lib/db/upgrade.php
commit 1e4f1c55cc032dd4dea6ed7467746edfffa4e7d5

All group homepages were locked including the one owned by root user.
That was fine before as one couldn't edit the root user's template
but now you can so we need to let this view be unlocked.

Only an issue if upgrading from version before 1.5.0

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

Aaron Wells (u-aaronw)
Changed in mahara:
status: Fix Committed → Fix Released
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.