Ticket #4250 (new Defect)

Opened 5 months ago

Last modified 4 days ago

Widgets columns order upgrading from 1.7 to 1.8

Reported by: adayth Owned by:
Priority: normal Milestone: Elgg 1.8.x
Component: Core Version: 1.8
Severity: minor Keywords:
Cc: brett@… Difficulty:

Description (last modified by ewinslow) (diff)

I have a site upgraded from elgg 1.7 to elgg 1.8.1. I noticed that widgets columns are changed from 1.7 to 1.8.

In 1.7 we had these columns:

left middle right

In 1.8 we have these columns:

col3 col2 col1

And the widgets columns equivalence are:

left --> col1 middle --> col2 right --> col3

So these means that in old 1.7 profiles we have changed widgets from left to right. This happens in profile and dashboard.

Change History

Changed 5 months ago by cash

The old widget code was really bad and was mostly rewritten for Elgg 1.8. The notion of right, left, and middle columns does not mean much anymore because we now support arbitrary numbers of columns and the ordering is determined by CSS now. The default theme floats them right so that column 1 is on the far right. A different theme could float them left.

Here is the code to swap the storage of the old left and right columns:

$ia = elgg_set_ignore_access(true);
$options = array(
	'type' => 'object',
	'subtype' => 'widget',
	'limit' => 0,
);
$batch = new ElggBatch('elgg_get_entities', $options);

foreach ($batch as $entity) {
	$old_column = $entity->column;
	if ($old_column == 3) {
		$entity->column = 1;
	} else if ($old_column == 1) {
		$entity->column = 3;
	}
}
elgg_set_ignore_access($ia);

Right now I see this as more of a site specific issue or theming issue rather than something that needs an upgrade script. Anyone have comments on this?

Changed 4 months ago by brettp

The problem is we do migrate this data but present it differently. Since these are options users explicitly ordered and set, it looks like a mistake on our side that it's displaying backward.

If we decide to migrate it, we'll have to only migrate for users coming from 1.7 or we'll inverse the widget order for existing 1.8 installs.

Changed 4 months ago by cash

We need to assign this to a 1.8 milestone or close.

There is nothing we can do about sites that have already migrated to 1.8. They can figure out the date of their upgrade and run the above script on users created after that date.

For sites still on 1.7, we can add an upgrade script that checks the current version before running. We need to make sure it runs at the right time (probably before the script that upgrades all plugins to objects).

Changed 4 months ago by adayth

I agree with an upgrade script from 1.7 to 1.8. However I think we should put the above script in the wiki linked with upgrade to 1.8 section.

I ran the script in my 1.8.1 site and I found a side effect. It also changes the default profile and dashboard widgets columns order.

Changed 4 days ago by ewinslow

  • description modified (diff)
  • milestone changed from Needs Review to Elgg 1.8.x
Note: See TracTickets for help on using tickets.