root/modules/branches/2.6/music/install.php

Revision 8424, 1.0 kB (checked in by mickecarlsson, 4 years ago)

Closes #3924, thank you GamerGamer?43

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to native
Line 
1 <?php
2 global $asterisk_conf;
3 global $amp_conf;
4 require_once("modules/music/functions.inc.php");
5
6 $File_Write="";
7 $tresults = music_list($amp_conf['ASTVARLIBDIR']."/mohmp3");
8 if (isset($tresults)) {
9   foreach ($tresults as $tresult)  {
10     if ($tresult == "default" ) {
11       $dir = $asterisk_conf['astvarlibdir']."/mohmp3/";
12     } elseif ($tresult == "none") {
13       $dir = $amp_conf['ASTVARLIBDIR']."/mohmp3/.nomusic_reserved";
14       if (!is_dir($dir)) {
15         mkdir("$dir", 0755);
16       }
17       touch($dir."/silence.wav");
18     } else {
19     $dir = $amp_conf['ASTVARLIBDIR']."/mohmp3/";
20     }
21     if (file_exists("{$dir}.random")) {
22       $File_Write.="[{$tresult}]\nmode=files\ndirectory={$dir}\nrandom=yes\n";
23     } else {
24       $File_Write.="[{$tresult}]\nmode=files\ndirectory={$dir}\n";
25     }
26   }
27 }
28 $handle = fopen("/etc/asterisk/musiconhold_additional.conf", "w");
29
30 if (fwrite($handle, $File_Write) === FALSE) {
31   echo _("Cannot write to file")." ($tmpfname)";
32   exit;
33 }
34
35 fclose($handle);
36
37 needreload();
38
39 ?>
Note: See TracBrowser for help on using the browser.