Changeset 4273
- Timestamp:
- 06/30/07 15:12:43 (6 years ago)
- Files:
-
- freepbx/branches/2.3/amp_conf/bin/retrieve_conf (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/branches/2.3/amp_conf/bin/retrieve_conf
r4148 r4273 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'); 202 201 $symlink_dirs['images'] = (isset($amp_conf['AMPWEBROOT']) ? addslash($amp_conf['AMPWEBROOT'])."admin/images" : '/var/www/html/admin/images'); 202 203 $cp_dirs = array(); 204 $cp_dirs['agi-bin'] = (isset($amp_conf['ASTAGIDIR']) ? $amp_conf['ASTAGIDIR'] : '/var/lib/asterisk/agi-bin'); 203 205 204 206 switch ($db_engine) … … 307 309 // create symlinks for files in appropriate sub directories 308 310 symlink_subdirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key ); 311 cp_subdirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key ); 309 312 } 310 313 } … … 430 433 } 431 434 435 function cp_subdirs($moduledir) { 436 global $cp_dirs; 437 438 foreach ($cp_dirs as $subdir => $targetdir) { 439 $dir = addslash($moduledir).$subdir; 440 if (is_dir($dir)) { 441 $d = opendir($dir); 442 while ($file = readdir($d)) { 443 if ($file[0] != '.') { 444 $sourcefile = addslash($dir).$file; 445 $targetfile = addslash($targetdir).$file; 446 447 if (file_exists($targetfile)) { 448 set_error_handler("report_errors"); 449 if (is_link($targetfile)) { 450 if (unlink($targetfile)) { 451 freepbx_log('retrieve-conf', 'devel-debug', "$targetfile was symbolic link, unlink successful"); 452 } else { 453 restore_error_handler(); 454 freepbx_log('retrieve-conf', 'error', "$targetfile is a symblolic link, failed to unlink!"); 455 break; 456 } 457 } 458 } 459 // OK, now either the file is a regular file or isn't there, so proceed 460 // 461 set_error_handler("report_errors"); 462 if (copy($sourcefile,$targetfile)) { 463 freepbx_log('retrieve-conf', 'devel-debug', "$targetfile successfully copied"); 464 } else { 465 freepbx_log('retrieve-conf', 'error', "$targetfile failed to copy from module directory"); 466 } 467 restore_error_handler(); 468 } 469 } 470 closedir($d); 471 } 472 } 473 } 474 475 function report_errors($errno, $errstr, $errfile, $errline) { 476 freepbx_log('retrieve-conf', 'error', "php reported: '".mysql_real_escape_string($errstr)."' after copy or unlink attempt!"); 477 } 478 479 432 480 433 481 // run legacy retrieve scripts
