Changeset 4274
- Timestamp:
- 06/30/07 15:14:09 (6 years ago)
- Files:
-
- freepbx/branches/2.2 (modified) (1 prop)
- freepbx/branches/2.2/amp_conf/bin/retrieve_conf (modified) (3 diffs)
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 196 196 // **** Create symlinks array 197 197 $symlink_dirs = array(); 198 $symlink_dirs['agi-bin'] = (isset($amp_conf['ASTAGIDIR']) ? $amp_conf['ASTAGIDIR'] : '/var/lib/asterisk/agi-bin');199 198 $symlink_dirs['sounds'] = (isset($amp_conf['ASTVARLIBDIR']) ? $amp_conf['ASTVARLIBDIR'] : '/var/lib/asterisk').'/sounds'; 200 199 $symlink_dirs['bin'] = (isset($amp_conf['AMPBIN']) ? $amp_conf['AMPBIN'] : '/var/lib/asterisk/bin'); 201 200 $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'); 202 204 203 205 switch ($db_engine) … … 306 308 // create symlinks for files in appropriate sub directories 307 309 symlink_subdirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key ); 310 cp_subdirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key ); 308 311 } 309 312 } … … 429 432 } 430 433 434 function 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 474 function 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 431 479 432 480 // run legacy retrieve scripts
