Changeset 4274

Show
Ignore:
Timestamp:
06/30/07 15:14:09 (6 years ago)
Author:
p_lindheimer
Message:

Merged revisions 4273 via svnmerge from
https://amportal.svn.sourceforge.net/svnroot/amportal/freepbx/branches/2.3

........

r4273 | p_lindheimer | 2007-06-30 12:12:43 -0700 (Sat, 30 Jun 2007) | 1 line


#2020: change from symlink to copy of agi-bin from modules to address error that occurs on some systems. If you do not want to copy over a modified version, you must change it to remove write access

........

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.2

    • Property svnmerge-integrated changed from /freepbx/branches/2.3:1-4135,4219,4249,4258,4262 /freepbx/trunk:1-3224,3231,3245-3246,3291-3295,3297,3299-3332,3336,3338-3365,3367-3373,3375-3388,3390-3391,3393-3395,3419,3437,3567,3614-3622,3624,3652,3688,3696,3756,3850,3885,4005,4084,4105 to /freepbx/branches/2.3:1-4135,4219,4249,4258,4262,4273 /freepbx/trunk:1-3224,3231,3245-3246,3291-3295,3297,3299-3332,3336,3338-3365,3367-3373,3375-3388,3390-3391,3393-3395,3419,3437,3567,3614-3622,3624,3652,3688,3696,3756,3850,3885,4005,4084,4105
  • freepbx/branches/2.2/amp_conf/bin/retrieve_conf

    r4085 r4274  
    196196// **** Create symlinks array 
    197197$symlink_dirs = array(); 
    198 $symlink_dirs['agi-bin'] = (isset($amp_conf['ASTAGIDIR']) ? $amp_conf['ASTAGIDIR'] : '/var/lib/asterisk/agi-bin'); 
    199198$symlink_dirs['sounds'] = (isset($amp_conf['ASTVARLIBDIR']) ? $amp_conf['ASTVARLIBDIR'] : '/var/lib/asterisk').'/sounds'; 
    200199$symlink_dirs['bin'] = (isset($amp_conf['AMPBIN']) ? $amp_conf['AMPBIN'] : '/var/lib/asterisk/bin'); 
    201200$symlink_dirs['etc'] = (isset($amp_conf['ASTETCDIR']) ? $amp_conf['ASTETCDIR'] : '/etc/asterisk'); 
     201 
     202$cp_dirs = array(); 
     203$cp_dirs['agi-bin'] = (isset($amp_conf['ASTAGIDIR']) ? $amp_conf['ASTAGIDIR'] : '/var/lib/asterisk/agi-bin'); 
    202204 
    203205switch ($db_engine) 
     
    306308      // create symlinks for files in appropriate sub directories 
    307309      symlink_subdirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key ); 
     310      cp_subdirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key ); 
    308311    } 
    309312  } 
     
    429432} 
    430433 
     434function cp_subdirs($moduledir) { 
     435  global $cp_dirs; 
     436 
     437  foreach ($cp_dirs as $subdir => $targetdir) { 
     438    $dir = addslash($moduledir).$subdir; 
     439    if (is_dir($dir)) { 
     440      $d = opendir($dir); 
     441      while ($file = readdir($d)) { 
     442        if ($file[0] != '.') { 
     443          $sourcefile = addslash($dir).$file; 
     444          $targetfile = addslash($targetdir).$file; 
     445 
     446          if (file_exists($targetfile)) { 
     447            set_error_handler("report_errors"); 
     448            if (is_link($targetfile)) { 
     449              if (unlink($targetfile)) { 
     450                freepbx_log('retrieve-conf', 'devel-debug', "$targetfile was symbolic link, unlink successful"); 
     451              } else { 
     452                restore_error_handler(); 
     453                freepbx_log('retrieve-conf', 'error', "$targetfile is a symblolic link, failed to unlink!"); 
     454                break; 
     455              } 
     456            } 
     457          } 
     458          // OK, now either the file is a regular file or isn't there, so proceed 
     459          // 
     460          set_error_handler("report_errors"); 
     461          if (copy($sourcefile,$targetfile)) { 
     462            freepbx_log('retrieve-conf', 'devel-debug', "$targetfile successfully copied"); 
     463          } else { 
     464            freepbx_log('retrieve-conf', 'error', "$targetfile failed to copy from module directory"); 
     465          } 
     466          restore_error_handler(); 
     467        } 
     468      } 
     469      closedir($d); 
     470    } 
     471  } 
     472} 
     473 
     474function report_errors($errno, $errstr, $errfile, $errline) { 
     475  freepbx_log('retrieve-conf', 'error', "php reported: '".mysql_real_escape_string($errstr)."' after copy or unlink attempt!"); 
     476} 
     477 
     478 
    431479 
    432480// run legacy retrieve scripts