Changeset 14152

Show
Ignore:
Timestamp:
06/19/12 11:23:43 (1 year ago)
Author:
p_lindheimer
Message:

add 2.10.1 upgrade dir, migration for writetimeout re #5839, and remove some advanced settings that are no longer used

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.10/upgrades/2.10.1/migration.php

    r12873 r14152  
    55$freepbx_conf =& freepbx_conf::create(); 
    66 
    7 // TODO: remember to put these into beta 2 migration also, most of these may not have originally been in the alpha/beta1 migration stage 
    8 // 
    9  
     7outn(_("removing deprecated Advanced settings if needed..")); 
    108//depricated views 
    119// 
    12 $freepbx_conf->remove_conf_settings('VIEW_FREEPBX'); 
    13 $freepbx_conf->remove_conf_settings('VIEW_FREEPBX_ADMIN'); 
    14 $freepbx_conf->remove_conf_settings('VIEW_FREEPBX_RELOAD'); 
    15 $freepbx_conf->remove_conf_settings('VIEW_FREEPBX_RELOADBAR'); 
    16 $freepbx_conf->remove_conf_settings('VIEW_UNAUTHORIZED'); 
    17 $freepbx_conf->remove_conf_settings('VIEW_LOGGEDOUT'); 
    18 $freepbx_conf->remove_conf_settings('VIEW_LOGGEDOUT'); 
    1910$freepbx_conf->remove_conf_settings('BRAND_FREEPBX_ALT_RIGHT'); 
    2011$freepbx_conf->remove_conf_settings('BRAND_IMAGE_FREEPBX_LINK_RIGHT'); 
     12$freepbx_conf->remove_conf_settings('BRAND_HIDE_LOGO_RIGHT'); 
     13$freepbx_conf->remove_conf_settings('BRAND_HIDE_HEADER_VERSION'); 
     14$freepbx_conf->remove_conf_settings('BRAND_HIDE_HEADER_MENUS'); 
     15$freepbx_conf->remove_conf_settings('AMPADMINLOGO'); 
    2116$freepbx_conf->remove_conf_settings('BRAND_IMAGE_HIDE_NAV_BACKGROUND'); 
    22 $freepbx_conf->remove_conf_settings('BRAND_HIDE_LOGO_RIGHT'); 
    23 $freepbx_conf->remove_conf_settings('BRAND_HIDE_HEADER_MENUS'); 
    24 $freepbx_conf->remove_conf_settings('BRAND_HIDE_HEADER_VERSION'); 
    25 $freepbx_conf->remove_conf_settings('VIEW_REPORTS'); 
    26 $freepbx_conf->remove_conf_settings('VIEW_PANEL'); 
    27 $freepbx_conf->remove_conf_settings('BRAND_IMAGE_FREEPBX_LEFT'); 
     17$freepbx_conf->remove_conf_settings('BRAND_IMAGE_SHADOW_SIDE_BACKGROUND'); 
     18$freepbx_conf->remove_conf_settings('BRAND_IMAGE_FREEPBX_RIGHT'); 
     19$freepbx_conf->remove_conf_settings('BRAND_IMAGE_RELOAD_LOADING'); 
    2820 
    2921//commit all settings 
    3022$freepbx_conf->commit_conf_settings(); 
     23out(_("ok")); 
    3124 
    32 //settings 
    33 global $amp_conf; 
     25/* Check and add if necessary the writetimeout setting to the manager configuration 
     26 */ 
    3427 
    35 $outdated = array( 
    36   $amp_conf['AMPWEBROOT'] . '_asterisk', 
    37   $amp_conf['AMPWEBROOT'] . '/admin/views/freepbx.php', 
    38   $amp_conf['AMPWEBROOT'] . '/admin/views/freepbx_admin.php', 
    39   $amp_conf['AMPWEBROOT'] . '/admin/views/freepbx_reload.php', 
    40   $amp_conf['AMPWEBROOT'] . '/admin/views/freepbx_reloadbar.php', 
    41   $amp_conf['AMPWEBROOT'] . '/admin/views/freepbx_footer.php', 
    42   $amp_conf['AMPWEBROOT'] . '/admin/views/unauthorized.php', 
    43   $amp_conf['AMPWEBROOT'] . '/admin/views/loggedout.php',  
    44 ); 
     28// Read in manager.conf and strip out any #includes to avoid warnings 
     29// 
     30$orig_manager = file($amp_conf['ASTETCDIR'] . '/manager.conf'); 
     31if (is_array($orig_manager) && !empty($orig_manager)) { 
     32  $manager = array(); 
     33  foreach ($orig_manager as $l) { 
     34    $tl = trim($l); 
     35    if ($tl[0] != '#') { 
     36      $manager[] = $l; 
     37    } 
     38  } 
    4539 
    46 out("Cleaning up deprecated or moved files:"); 
     40  // check if we already have writetimeout by parsing as an ini file 
     41  // 
     42  $manager_ini = parse_ini_string(implode("", $manager), true); 
     43  unset($manager); 
     44  if (!isset($manager_ini[$amp_conf['AMPMGRUSER']]['writetimeout'])) { 
     45    out(_("writetimeout not present, adding")); 
    4746 
    48 foreach ($outdated as $file) { 
    49   outn("Checking $file.."); 
    50   if (file_exists($file) && !is_link($file)) { 
    51     unlink($file) ? out("removed") : out("failed to remove"); 
     47    // add the setting right after the section heading 
     48    // 
     49    foreach ($orig_manager as $l) { 
     50      $new_manager[] = $l; 
     51      if (trim($l) == '[' . $amp_conf['AMPMGRUSER'] . ']') { 
     52        $new_manager[] = 'writetimeout = ' . $amp_conf['ASTMGRWRITETIMEOUT'] . "\n"; 
     53      } 
     54    } 
     55    if (file_put_contents($amp_conf['ASTETCDIR'] . '/manager.conf', $new_manager)) { 
     56      out(_("writetimeout added to manager.conf")); 
     57    } else { 
     58      out(_("an error occurred trying to write out manager.conf changes")); 
     59    } 
     60    unset($new_manager); 
    5261  } else { 
    53     out("Not Required"); 
     62    out(_("writetimeout already exists")); 
    5463  } 
     64  unset($manager_ini); 
     65} else { 
     66  out(_("Failed to read manager file to add writetimeout")); 
    5567} 
    56 ?> 
     68unset($orig_manager); 
     69