From ec922197ed92e3dc0e15ab4d6ba340015f46bf43 Mon Sep 17 00:00:00 2001 From: Steve Beaver Date: Wed, 9 Aug 2017 09:23:24 -0400 Subject: Revise upgrade script to insert support widget at the top of column 2 Add old support widget to obsolete files list --- src/etc/inc/upgrade_config.inc | 29 +++++++++++++++++++++++++++-- src/etc/pfSense.obsoletedfiles | 1 + 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index b567249..a8d5370 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -5323,12 +5323,37 @@ function upgrade_165_to_166() { } } -/* Force the Netgate Services and Support widget to be active on upgrade. */ +/* Force the Netgate Services and Support widget to be active on upgrade. + New widget is added at the top of column 2 */ function upgrade_166_to_167() { global $config; if (strpos($config['widgets']['sequence'], 'netgate_services_and_support') === false) { - $config['widgets']['sequence'] .= ',netgate_services_and_support:col2:open:0'; + + $widgets = explode(",", $config['widgets']['sequence']); + $cnt = count($widgets); + $col2 = $cnt; + $newsequence = array(); + + // Locate the firt column 2 widget + for ($idx=0;$idx<$cnt;$idx++) { + if (strpos($widgets[$idx], 'col2') !== false) { + $col2 = $idx; + break; + } + } + + // Loop through the widgets inserting the new widget before the first col2 widget + for ($old=0,$new=0;$old<$cnt;$old++,$new++) { + $newsequence[$new] = $widgets[$old]; + + if ($old == ($col2 - 1)) { + $new++; + $newsequence[$new] = "netgate_services_and_support:col2:open:0"; + } + } + + $config['widgets']['sequence'] = implode(",", $newsequence); } } diff --git a/src/etc/pfSense.obsoletedfiles b/src/etc/pfSense.obsoletedfiles index 2241256..802c8ca 100644 --- a/src/etc/pfSense.obsoletedfiles +++ b/src/etc/pfSense.obsoletedfiles @@ -1016,6 +1016,7 @@ /usr/local/www/vpn_pppoe_users.php /usr/local/www/vpn_pppoe_users_edit.php /usr/local/www/widgets/widgets/deactivated +/usr/local/www/widgets/widgets/support.widget.php /usr/local/www/wizards/traffic_shaper_wizard.inc /usr/local/www/wizards/traffic_shaper_wizard.xml /usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc -- cgit v1.1