← Back to team overview

mahara-contributors team mailing list archive

[Bug 1287262] Re: unable to create group home page

 

Too bad, that was the only lead I had! ;)

Hm, well based on the fact that it says "(id=)", we know the $layoutid
variable is null or an empty string. That means the only code path it
could have followed was that $this->get_layout() returned null, and
$numrows == 1.

That's not too surprising. New pages start out with a NULL layout and
numrows set to 1. This changes if the user picks a different layout from
the layouts tab, in which case it changes to point to the chosen layout.
If the user adds or removes columns by using the optional account
setting that lets you add/remove columns from the layout page using
buttons, then it goes back to NULL.

When the layout is NULL, the number of columns on each row, and their
widths, is meant to be determined by looking in the view_rows_columns
table (which in turn maps to the view_layout_columns table to get the
widths of the columns).

Now, with a $layoutid of NULL and a $numrows of 1, the code is going to
go through the series of loops inside the if statement "if ($numrows ==
1)". Based on the fact that it throws that exception, it means that it
made it out without finding a suitable layout, and hence never assigned
a value to $layout->id. So that means you're missing records from one or
more of these tables: "view_layout_rows_columns", "view_layout", or
"usr_custom_layout".

Since this happens with newly created groups, probably what happened is
that the group homepage template page didn't get its layout information
properly updated to the new layout format.

Hm... all that code inside the "else if (!$layoutid) {" part of that
function is pretty wonky, especially the part for $numrows == 1.
Perhaps, rather than trying to fix the layout records for the group
homepage by hand, you could just delete the special block for handling
pages with just 1 row, so that they're handled the same as pages with
multiple rows? And get rid of the part where it checks the $layout->id
and throws an exception. So then it'll look like this:

        else if (!$layoutid) {
                // multiple rows
                // get widths for each row, based on equal spacing of columns
                $layoutid = 0;
                $layout->id = $layoutid;
                foreach ($columnsperrow as $row) {
                    $numcolumns = $row->columns;
                    $widths = self::$defaultcolumnlayouts[$numcolumns];
                    $layout->rows[$row->row]['widths'] = $widths;
                    $layout->rows[$row->row]['columns'] = $numcolumns;
                }
        }
        
        return $layout;

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1287262

Title:
  unable to create  group home page

Status in Mahara ePortfolio:
  Incomplete

Bug description:
  mahara version 1.8.1
  mysql 5.6
  Since upgrading from 1.7.2 to 1.8.1 we are unable to create new group home pages. After selecting 'create group', adding a group and selecting 'save group', the 'About' tab displays 'A nonrecoverable error occurred.' the error log displays:

  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7] [WAR] ba (lib/view.php:2725) Unknown view layout (id=), referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php
  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7] Call stack (most recent first):, referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php
  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7]   * View->get_layout() at /data/mahara-vhosts/v181/lib/view.php:1776, referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php
  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7]   * View->build_column_datastructure(1, false) at /data/mahara-vhosts/v181/lib/view.php:1828, referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php
  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7]   * View->get_column_datastructure(1, 1) at /data/mahara-vhosts/v181/lib/view.php:1911, referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php
  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7]   * View->build_column(1, 1, false) at /data/mahara-vhosts/v181/lib/view.php:1886, referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php
  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7]   * View->build_columns(1, false) at /data/mahara-vhosts/v181/lib/view.php:1871, referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php
  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7]   * View->build_rows() at /data/mahara-vhosts/v181/group/view.php:68, referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php
  [Mon Mar 03 16:46:57 2014] [error] [client 128.40.192.7] , referer: https://v181.myportfolio-dev.ucl.ac.uk/group/edit.php

  If I select the 'my groups' tab, the group is displayed but I get the
  same error message if I try and edit it. If I select the group, the
  same error is displayed on the 'about' tab but all other tabs work
  correctly.

  I suspect that something went wrong during the upgrade, although no error messages were reported in the error log. 9 new tables were created and the correct schema changes appear to have been applied according to the lib/db/upgrade.php. We didn't test creating groups on our uat instance before upgrading production and have now rolled back production to 1.7.2. However the problem exists on our dev and uat environments and we won't upgrade production until we can fix it on dev and uat. The dev and uat databases are a clone of production. I'm not sure if it's worth mentioning but the auto-increment is set to 2 on production and 1 on dev and uat. I'm wondering if something is going wrong during the upgrade when the new tables are populated. 
  Please let me know if I can provide any more information.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1287262/+subscriptions


References