| | 1012 | /* As of Asterisk 1.4.16 or there abouts, a missing #include file will make the reload fail. So |
|---|
| | 1013 | we need to make sure that we have such for everything that is in our configs. We will simply |
|---|
| | 1014 | look for the #include statements and touch the files vs. trying to inventory everything we may |
|---|
| | 1015 | need and then forgetting something. |
|---|
| | 1016 | */ |
|---|
| | 1017 | |
|---|
| | 1018 | outn("creating missing #include files.."); |
|---|
| | 1019 | $include_err = false; |
|---|
| | 1020 | exec("grep '#include' ".$amp_conf['ASTETCDIR']."/*.conf | sed 's/;.*//; s/#include//'",$output,$retcode); |
|---|
| | 1021 | if ($retcode != 0) { |
|---|
| | 1022 | out("Error code $retcode: trying to search for missing #include files"); |
|---|
| | 1023 | $include_err = true; |
|---|
| | 1024 | } |
|---|
| | 1025 | |
|---|
| | 1026 | foreach($output as $file) { |
|---|
| | 1027 | if (trim($file) == '') { |
|---|
| | 1028 | continue; |
|---|
| | 1029 | } |
|---|
| | 1030 | $parse1 = explode(':',$file); |
|---|
| | 1031 | $parse2 = explode(';',$parse1[1]); |
|---|
| | 1032 | $rawfile = trim($parse2[0]); |
|---|
| | 1033 | if ($rawfile == '') { |
|---|
| | 1034 | continue; |
|---|
| | 1035 | } |
|---|
| | 1036 | |
|---|
| | 1037 | $target = ($rawfile[0] == '/') ? $rawfile : $amp_conf['ASTETCDIR']."/$rawfile"; |
|---|
| | 1038 | |
|---|
| | 1039 | if (!file_exists($target)) { |
|---|
| | 1040 | exec("touch $target", $output, $retcode); |
|---|
| | 1041 | if ($retcode != 0) { |
|---|
| | 1042 | out("Error code $retcode: trying to create empty file $target"); |
|---|
| | 1043 | $include_err = true; |
|---|
| | 1044 | } |
|---|
| | 1045 | } |
|---|
| | 1046 | } |
|---|
| | 1047 | if (! $include_err) { |
|---|
| | 1048 | out("OK"); |
|---|
| | 1049 | } |
|---|