Changeset 5331

Show
Ignore:
Timestamp:
12/01/07 22:22:25 (1 year ago)
Author:
p_lindheimer
Message:

added XTNCONFICTABORT and BADDESTABORT options to about retrieve_conf, changed retireve_conf to not run legacy generation for sip, iax,zap and queues if proper core_conf or queues_conf classes are found

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/bin/retrieve_conf

    r5275 r5331  
    342342} 
    343343 
    344  
    345344$engineinfo = engine_getinfo(); 
    346345if($engineinfo['version'] == 0){ 
     
    351350$engine = $engineinfo['engine']; 
    352351$version = $engineinfo['version']; 
     352 
     353// Check for and report any extension conflicts 
     354// 
     355 
     356$extens_ok = true; 
     357$dests_ok = true; 
     358 
     359$nt = notifications::create($db); 
     360 
     361$my_hash = array_flip($active_modules); 
     362$my_prob_extens = framework_list_extension_conflicts($my_hash); 
     363 
     364if (empty($my_prob_extens)) { 
     365        $nt->delete('retrieve_conf', 'XTNCONFLICT'); 
     366} else { 
     367        $previous = null; 
     368        $str = null; 
     369        $count = 0; 
     370        foreach ($my_prob_extens as $extens) { 
     371                foreach ($extens as $exten => $details) { 
     372                        if ($exten != $previous) { 
     373                                $str .=  "Extension: $exten:<br />"; 
     374                                $count++; 
     375                        } 
     376                        $str .= sprintf("%8s: %s<br />",$details['status'], $details['description']); 
     377                        $previous = $exten; 
     378                } 
     379        } 
     380        $nt->add_error('retrieve_conf', 'XTNCONFLICT', sprintf(_("There are %s conflicting extensions"),$count), $str); 
     381        $extens_ok = false; 
     382} 
     383 
     384// Check for and report any bogus destinations 
     385// 
     386$my_probs = framework_list_problem_destinations($my_hash, !$amp_conf['CUSTOMASERROR']); 
     387 
     388if (empty($my_probs)) { 
     389        $nt->delete('retrieve_conf', 'BADDEST'); 
     390} else { 
     391        $results = array(); 
     392        $count = 0; 
     393        $str = null; 
     394        foreach ($my_probs as $problem) { 
     395                //print_r($problem); 
     396                $results[$problem['status']][] = $problem['description']; 
     397                $count++; 
     398        } 
     399        foreach ($results as $status => $subjects) { 
     400                $str .= sprintf(_("DEST STATUS: %s%s"),$status,"\n"); 
     401                foreach ($subjects as $subject) { 
     402                        //$str .= $subject."<br />"; 
     403                        $str .= "   ".$subject."\n"; 
     404                } 
     405        } 
     406        $nt->add_error('retrieve_conf', 'BADDEST', sprintf(_("There are %s bad destinations"),$count), $str); 
     407        $dests_ok = false; 
     408} 
     409 
     410if ((!$exten_ok && $amp_conf['XTNCONFLICTABORT']) || (!$dest_ok && $amp_conf['BADDESTABORT'])) { 
     411        out(_("Aborting reload because extension conflicts or bad destinations")); 
     412        exit(20); 
     413} 
    353414 
    354415// run all of the *_get_config and _hookGet_config functions, which will populate the appropriate objects 
     
    400461                } 
    401462        } 
    402 } 
    403  
    404 // Check for and report any extension conflicts 
    405 // 
    406 $nt = notifications::create($db); 
    407  
    408 $my_hash = array_flip($active_modules); 
    409 $my_prob_extens = framework_list_extension_conflicts($my_hash); 
    410  
    411 if (empty($my_prob_extens)) { 
    412         $nt->delete('retrieve_conf', 'XTNCONFLICT'); 
    413 } else { 
    414         $previous = null; 
    415         $str = null; 
    416         $count = 0; 
    417         foreach ($my_prob_extens as $extens) { 
    418                 foreach ($extens as $exten => $details) { 
    419                         if ($exten != $previous) { 
    420                                 $str .=  "Extension: $exten:<br />"; 
    421                                 $count++; 
    422                         } 
    423                         $str .= sprintf("%8s: %s<br />",$details['status'], $details['description']); 
    424                         $previous = $exten; 
    425                 } 
    426         } 
    427         $nt->add_error('retrieve_conf', 'XTNCONFLICT', sprintf(_("There are %s conflicting extensions"),$count), $str); 
    428 } 
    429  
    430 // Check for and report any bogus destinations 
    431 // 
    432 $my_probs = framework_list_problem_destinations($my_hash, !$amp_conf['CUSTOMASERROR']); 
    433  
    434 if (empty($my_probs)) { 
    435         $nt->delete('retrieve_conf', 'BADDEST'); 
    436 } else { 
    437         $results = array(); 
    438         $count = 0; 
    439         $str = null; 
    440         foreach ($my_probs as $problem) { 
    441                 //print_r($problem); 
    442                 $results[$problem['status']][] = $problem['description']; 
    443                 $count++; 
    444         } 
    445         foreach ($results as $status => $subjects) { 
    446                 $str .= sprintf(_("DEST STATUS: %s%s"),$status,"\n"); 
    447                 foreach ($subjects as $subject) { 
    448                         //$str .= $subject."<br />"; 
    449                         $str .= "   ".$subject."\n"; 
    450                 } 
    451         } 
    452         $nt->add_error('retrieve_conf', 'BADDEST', sprintf(_("There are %s bad destinations"),$count), $str); 
    453463} 
    454464 
     
    660670include("libfreepbx.confgen.php"); 
    661671 
    662 // run legacy retrieve scripts 
    663 // TODO these legacy retrieve scripts should be obsoleted, in favor of classes like extensions class 
    664  
    665 //script to write op_server.cfg file from mysql  
     672// script to write op_server.cfg file from mysql  
     673// 
    666674$script = $amp_conf['AMPBIN'].'/retrieve_op_conf_from_mysql.pl '.$amportalconf.' '.rtrim($asterisk_conf['astetcdir'],DIRECTORY_SEPARATOR); 
    667675exec($script); 
     
    669677// generate configuration files 
    670678// 
    671 generate_configurations_sip($version); 
    672 generate_configurations_iax($version); 
    673 generate_configurations_zap($version); 
    674 generate_configurations_queues($version); 
     679// Leave the legacy scripts in for a little while to help with odd-ball upgrade scenarios if they haven't gotten 
     680// a module upgraded yet. In particular Queues 
     681// 
     682if (!isset($core_conf) || !is_a($core_conf, "core_conf")) { 
     683        generate_configurations_sip($version); 
     684        generate_configurations_iax($version); 
     685        generate_configurations_zap($version); 
     686
     687if (!isset($queues_conf) || !is_a($queues_conf, "queues_conf")) { 
     688        generate_configurations_queues($version); 
     689
    675690         
    676691// Check and install the freepbx-cron-scheduler.php manager 
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r5317 r5331  
    5555        'CUSTOMASERROR'  => array('bool' , false), 
    5656        'DYNAMICHINTS'   => array('bool' , false), 
     57        'BADDESTABORT'   => array('bool' , false), 
     58        'XTNCONFLICTABORT' => array('bool' , false), 
    5759); 
    5860 
  • freepbx/trunk/amportal.conf

    r5319 r5331  
    141141# configured with "execincludes=yes" set in the [options] section. 
    142142# DYNAMICHINTS=true 
     143 
     144# XTNCONFLICTABORT, BADDESTABORT 
     145# setting either of these to true will result in retrieve_conf aborting during a reload if an extension 
     146# conflict is detected or a destination is detected. It is usually better to allow the reload to go 
     147# through and then correct the problem but these can be set if a more strict behavior is desired 
     148# both default to false if not set 
     149XTNCONFLICTABORT=false 
     150BADDESTABORT=false