Changeset 6181 for modules

Show
Ignore:
Timestamp:
07/25/08 11:23:17 (4 months ago)
Author:
p_lindheimer
Message:

fixes #2779 create warning if indications.conf can't be written

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/core/functions.inc.php

    r6165 r6181  
    39153915        global $asterisk_conf; 
    39163916 
     3917        $notify =& notifications::create($db); 
     3918 
    39173919        $sql = "SELECT value FROM globals WHERE variable='TONEZONE'"; 
    39183920        $result = $db->getRow($sql,DB_FETCHMODE_ASSOC); 
     
    39203922        $filename = isset($asterisk_conf["astetcdir"]) && $asterisk_conf["astetcdir"] != '' ? rtrim($asterisk_conf["astetcdir"],DIRECTORY_SEPARATOR) : "/etc/asterisk"; 
    39213923        $filename .= "/indications.conf"; 
    3922         $fd = fopen($filename, "w"); 
    3923         fwrite($fd, "[general]\ncountry=".$result['value']."\n\n"); 
    3924  
    3925         $zonelist = general_get_zonelist(); 
    3926         foreach ($zonelist as $zone) { 
    3927                 fwrite($fd, "[{$zone['iso']}]\n{$zone['conf']}\n\n"); 
    3928         } 
    3929         fclose($fd); 
     3924 
     3925        if (($fd = fopen($filename, "w")) === false) { 
     3926                $desc = sprintf(_("Failed to open %s for writing, aborting attempt to write the country indications. The file may be readonly or the permissions may be incorrect."), $filename); 
     3927                $notify->add_error('core','INDICATIONS',_("Failed to write indications.conf"), $desc); 
     3928                return; 
     3929        } else { 
     3930                $notify->delete('core', 'INDICATIONS'); 
     3931 
     3932                fwrite($fd, "[general]\ncountry=".$result['value']."\n\n"); 
     3933 
     3934                $zonelist = general_get_zonelist(); 
     3935                foreach ($zonelist as $zone) { 
     3936                        fwrite($fd, "[{$zone['iso']}]\n{$zone['conf']}\n\n"); 
     3937                } 
     3938                fclose($fd); 
     3939        } 
    39303940} 
    39313941/* end page.routing.php functions */ 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads