diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-04-09 19:14:38 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-04-09 19:14:38 +0000 |
commit | cab1ccee2adc382151ce89674498a93addb89b34 (patch) | |
tree | 7cb3bdf756b0ae66660b2213de106659d5804b75 /engine | |
parent | 30a1df9bcf1ac12a8aec0f307f53f8eb6d105809 (diff) | |
download | elgg-cab1ccee2adc382151ce89674498a93addb89b34.tar.gz elgg-cab1ccee2adc382151ce89674498a93addb89b34.tar.bz2 |
Fixes #3193 moves default widgets upgrade to an action
git-svn-id: http://code.elgg.org/elgg/trunk@8971 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php | 60 | ||||
-rw-r--r-- | engine/lib/widgets.php | 1 |
2 files changed, 1 insertions, 60 deletions
diff --git a/engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php b/engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php deleted file mode 100644 index 6a5f2fa02..000000000 --- a/engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * Elgg 1.8-svn upgrade 2011032300 - * update_default_widgets - * - * Pre-1.8, default widgets were stored as metadata on a defaultwidgets object. - * Now they are stored as widget objects owned by the site. - */ - -$object = elgg_get_entities(array( - 'type' => 'object', - 'subtype' => 'moddefaultwidgets', - 'limit' => 1, -)); - -if (!$object) { - // nothing to upgrade - return true; -} - -$object = $object[0]; - -$site = elgg_get_site_entity(); - -$ia = elgg_set_ignore_access(true); -foreach (array('profile', 'dashboard') as $context) { - if (isset($object->$context)) { - elgg_push_context($context); - elgg_push_context('default_widgets'); - elgg_push_context('widgets'); - - // deserialize the widget information - list($left, $middle, $right) = split('%%', $object->$context); - $left_widgets = split('::', $left); - $middle_widgets = split('::', $middle); - $right_widgets = split('::', $right); - - // 1st column is right column in default theme - $widgets = array( - 1 => array_reverse($right_widgets), - 2 => array_reverse($middle_widgets), - 3 => array_reverse($left_widgets), - ); - - foreach ($widgets as $column => $column_widgets) { - foreach ($column_widgets as $handler) { - $guid = elgg_create_widget($site->getGUID(), $handler, $context); - if ($guid) { - $widget = get_entity($guid); - $widget->move($column, 0); - } - } - } - - elgg_pop_context(); - elgg_pop_context(); - elgg_pop_context(); - } -} -elgg_set_ignore_access($ia); diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index b20f92f74..cc3cf20e4 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -272,6 +272,7 @@ function elgg_widgets_init() { elgg_register_action('widgets/add'); elgg_register_action('widgets/move'); elgg_register_action('widgets/delete'); + elgg_register_action('widgets/upgrade', '', 'admin'); run_function_once("elgg_widget_run_once"); } |