Ticket #1441: fix-recordirs.dpatch

File fix-recordirs.dpatch, 3.5 kB (added by diego_iastrubni, 5 years ago)

recordings module patch

Line 
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## fix-recordirs.dpatch by  <diego@boole>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: No description.
6
7 @DPATCH@
8 diff -urNad freepbx-module-recordings/functions.inc.php /tmp/dpep.u8KTjH/freepbx-module-recordings/functions.inc.php
9 --- freepbx-module-recordings/functions.inc.php 2006-11-12 11:22:16.000000000 +0200
10 +++ /tmp/dpep.u8KTjH/freepbx-module-recordings/functions.inc.php  2006-11-26 16:44:15.000000000 +0200
11 @@ -1,13 +1,13 @@
12  <?php
13  
14  // Source and Destination Dirctories for recording
15 -$recordings_save_path = "/tmp/";
16  if ( (isset($amp_conf['ASTVARLIBDIR'])?$amp_conf['ASTVARLIBDIR']:'') == '') {
17   $recordings_astsnd_path = "/var/lib/asterisk";
18  } else {
19   $recordings_astsnd_path = $amp_conf['ASTVARLIBDIR'];
20  }
21  $recordings_astsnd_path .= "/sounds/";
22 +$recordings_save_path = "$recordings_astsnd_path/custom/";
23  
24  function recordings_get_config($engine) {
25   global $ext;  // is this the best way to pass this?
26 diff -urNad freepbx-module-recordings/page.recordings.php /tmp/dpep.u8KTjH/freepbx-module-recordings/page.recordings.php
27 --- freepbx-module-recordings/page.recordings.php 2006-11-12 11:22:16.000000000 +0200
28 +++ /tmp/dpep.u8KTjH/freepbx-module-recordings/page.recordings.php  2006-11-26 16:44:29.000000000 +0200
29 @@ -45,13 +45,14 @@
30     if (!file_exists($recordings_astsnd_path."custom")) {
31       if (!mkdir($recordings_astsnd_path."custom", 0775)) {
32         echo '<div class="content"><h5>'._("Failed to create").' '.$recordings_astsnd_path.'custom'.'</h5>';     
33 -     }   
34 +     }
35     } else {
36 -     // can't rename a file from one partition to another, must use mv or cp
37 -     // rename($recordings_save_path."{$dest}ivrrecording.wav",$recordings_astsnd_path."custom/{$filename}.wav");
38 -     exec("mv " . $recordings_save_path . "{$dest}ivrrecording.wav " . $recordings_astsnd_path."custom/{$filename}.wav");
39 -     $isok = recordings_add($rname, "custom/{$filename}.wav");
40 +     rename($recordings_save_path."ivr-tmp-{$dest}ivrrecording.wav",$recordings_astsnd_path."custom/{$filename}.wav");
41 +     
42 +     // original code from freepbx.org
43 +//     exec("mv " . $recordings_save_path . "{$dest}ivrrecording.wav " . $recordings_astsnd_path."custom/{$filename}.wav");
44  
45 +     $isok = recordings_add($rname, "{$filename}.wav");
46       recording_sidebar(null, $usersnum);
47       recording_addpage($usersnum);
48       if ($isok)
49 @@ -62,9 +63,9 @@
50   case "edit":
51     $filename = $_REQUEST['filename'];
52     if (file_exists($recordings_astsnd_path."{$filename}.wav")) {
53 -     copy($recordings_astsnd_path."{$filename}.wav", $recordings_save_path."{$dest}ivrrecording.wav");
54 +     rename($recordings_astsnd_path."{$filename}.wav", $recordings_save_path."ivr-tmp-{$dest}ivrrecording.wav");
55     } elseif (file_exists($recordings_astsnd_path."{$filename}.gsm")) {
56 -     copy($recordings_astsnd_path."{$filename}.gsm", $recordings_save_path."{$dest}ivrrecording.gsm");
57 +     rename($recordings_astsnd_path."{$filename}.gsm", $recordings_save_path."ivr-tmp-{$dest}ivrrecording.gsm");
58     } else {
59       echo '<div class="content"><h5>'._("Unable to locate").' '.$recordings_astsnd_path.$filename.' '._("with a wav or gsm suffix").'</h5>';
60     }
61 @@ -130,7 +131,7 @@
62     } else {
63       $dest = "{$usersnum}-";
64     }
65 -   $destfilename = $recordings_save_path.$dest."ivrrecording.wav";
66 +   $destfilename = $recordings_save_path."ivr-tmp-".$dest."ivrrecording.wav";
67     move_uploaded_file($_FILES['ivrfile']['tmp_name'], $destfilename);
68     system("chgrp asterisk ".$destfilename);
69     system("chmod g+rw ".$destfilename);