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 | |
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
-rw-r--r-- | actions/widgets/upgrade.php (renamed from engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php) | 13 | ||||
-rw-r--r-- | engine/lib/widgets.php | 1 | ||||
-rw-r--r-- | languages/en.php | 1 | ||||
-rw-r--r-- | views/default/admin/appearance/default_widgets.php | 16 |
4 files changed, 27 insertions, 4 deletions
diff --git a/engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php b/actions/widgets/upgrade.php index 6a5f2fa02..0a5cf8d48 100644 --- a/engine/lib/upgrades/2011032300-1.8_svn-update_default_widgets-7daf5a459720d06d.php +++ b/actions/widgets/upgrade.php @@ -1,10 +1,12 @@ <?php /** - * Elgg 1.8-svn upgrade 2011032300 - * update_default_widgets + * Upgrade default widgets for Elgg 1.8 * * Pre-1.8, default widgets were stored as metadata on a defaultwidgets object. * Now they are stored as widget objects owned by the site. + * + * @package Elgg.Core + * @subpackage Widgets.Management */ $object = elgg_get_entities(array( @@ -14,8 +16,7 @@ $object = elgg_get_entities(array( )); if (!$object) { - // nothing to upgrade - return true; + forward(REFERER); } $object = $object[0]; @@ -58,3 +59,7 @@ foreach (array('profile', 'dashboard') as $context) { } } elgg_set_ignore_access($ia); + +$object->delete(); +system_message(elgg_echo('upgrade:core')); +forward(REFERER); 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"); } diff --git a/languages/en.php b/languages/en.php index 427452aa9..86fa9c7e7 100644 --- a/languages/en.php +++ b/languages/en.php @@ -795,6 +795,7 @@ $english = array( 'post' => 'Post', 'submit' => 'Submit', 'comment' => 'Comment', + 'upgrade' => 'Upgrade', 'site' => 'Site', 'activity' => 'Activity', diff --git a/views/default/admin/appearance/default_widgets.php b/views/default/admin/appearance/default_widgets.php index ce9f6a5c2..5ce0d0acf 100644 --- a/views/default/admin/appearance/default_widgets.php +++ b/views/default/admin/appearance/default_widgets.php @@ -6,6 +6,22 @@ * @subpackage Administration.DefaultWidgets */ +$object = elgg_get_entities(array( + 'type' => 'object', + 'subtype' => 'moddefaultwidgets', + 'limit' => 1, +)); + +if ($object) { + echo elgg_view('output/url', array( + 'text' => elgg_echo('upgrade'), + 'href' => 'action/widgets/upgrade', + 'is_action' => true, + 'class' => 'elgg_button elgg-button-submit', + 'title' => 'Upgrade your default widgets to work on Elgg 1.8', + )); +} + elgg_push_context('default_widgets'); $widget_context = get_input('widget_context'); $list = elgg_trigger_plugin_hook('get_list', 'default_widgets', null, array()); |