Changeset 5967

Show
Ignore:
Timestamp:
07/08/08 13:48:45 (2 months ago)
Author:
p_lindheimer
Message:

additional code needed to bypass the file_get_contents() and fopen() to freepbx.org URLs and try with wget, default behavior is to first try as always and fail over if needed but it can be forced to always go the wget route if you know you have this issue which can save significant time in the delay that sometimes occurs when this issue is present

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r5960 r5967  
    5959        'XTNCONFLICTABORT' => array('bool' , false), 
    6060        'USEDEVSTATE'    => array('bool' , false), 
     61        'MODULEADMINWGET'=> array('bool' , false), 
    6162); 
    6263 
     
    21322133                } 
    21332134                //$fn = "/usr/src/freepbx-modules/modules.xml"; 
    2134                 $data = @ file_get_contents($fn); 
     2135                if (!$amp_conf['MODULEADMINWGET']) { 
     2136                        $data = @ file_get_contents($fn); 
     2137                } else { 
     2138                        $data = ""; 
     2139                } 
    21352140 
    21362141                if (empty($data)) { 
     
    27462751        } 
    27472752         
    2748         if (!$dp = @fopen($url,'r')) { 
    2749                 return array(sprintf(_("Error opening %s for reading"), $url)); 
     2753        // Check MODULEADMINWGET first so we don't execute the fopen() if set 
     2754        // 
     2755        if ($amp_conf['MODULEADMINWGET'] || !$dp = @fopen($url,'r')) { 
     2756                exec("wget -O $filename $url 2> /dev/null", $filedata, $retcode); 
     2757                if ($retcode != 0) { 
     2758                        return array(sprintf(_("Error opening %s for reading"), $url)); 
     2759                } else { 
     2760                        if (!$dp = @fopen($filename,'r')) { 
     2761                                return array(sprintf(_("Error opening %s for reading"), $url)); 
     2762                        } 
     2763                } 
    27502764        } 
    27512765         
     
    33403354        } 
    33413355 
    3342         $announcement = @ file_get_contents("http://mirror.freepbx.org/version-".getversion().".html".$options); 
     3356        if (!$amp_conf['MODULEADMINWGET']) { 
     3357                $announcement = @ file_get_contents("http://mirror.freepbx.org/version-".getversion().".html".$options); 
     3358        } else { 
     3359                $announcement = ''; 
     3360        } 
     3361        if (empty($announcement)) { 
     3362                exec("wget -O - $fn 2> /dev/null", $data_arr, $retcode); 
     3363                $announcement = implode("\n",$data_arr); 
     3364        } 
    33433365        return $announcement; 
    33443366} 
  • freepbx/trunk/amportal.conf

    r5819 r5967  
    146146# SERVERINTITLE if set to true, the browser title will be preceded with the server name. default false 
    147147SERVERINTITLE=false 
     148 
     149# USEDEVSTATE = true DEFAULT VALUE false 
     150# If this is set, it assumes that you are running Asterisk 1.4 or higher and want to take advantage of the 
     151# func_devstate.c backport available from Asterisk 1.6 which allows custom hints to be created to support 
     152# BLF for server side feature codes such as daynight, followme, etc. 
     153# 
     154USEDEVSTATE=true 
     155 
     156# MODULEADMINWGET=true DEFAULT VALUE false 
     157# Module Admin normally tries to get its online information through direct file open type calls to URLs that 
     158# go back to the freepbx.org server. If it fails, typically because of content filters in firewalls that don't 
     159# like the way PHP formats the requests, the code will fall back and try a wget to pull the information. 
     160# This will often solve the problem. However, in such environemnts there can be a significant timeout before 
     161# the failed file open calls to the URLs return and there are often 2-3 of these that occur. Setting this value 
     162# will force FreePBX to avoid the attempt to open the URL and go straight to the wget calls. 
     163# 
     164MODULEADMINWGET=true 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads