fix: voicemail message delete bug #2100 (#2221)

bug: voicemail_id was never set so wrong path constructed and glob finds no matching files.

test case:
delete a voicemail message from the web interface

expected result:
voicemail is deleted in the database + file system

actual results:
voicemail is still on the file system
This commit is contained in:
jebsolutions
2016-12-01 13:53:12 -05:00
committed by FusionPBX
parent 2946866316
commit c5a47e0287

View File

@@ -53,19 +53,7 @@
$this->domain_uuid = $_SESSION['domain_uuid'];
}
//get the voicemail_id
if (!isset($this->voicemail_id)) {
$sql = "select voicemail_id from v_voicemails ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and voicemail_uuid = '".$this->voicemail_uuid."' ";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (is_array($result)) foreach ($result as &$row) {
$this->voicemail_id = $row["voicemail_id"];
}
unset ($prep_statement);
}
// note: no point calling get_voicemail_id here since $this->voicemail_uuid isn't set yet
}
public function __destruct() {
@@ -73,6 +61,21 @@
unset($this->$key);
}
}
public function get_voicemail_id() {
if (!isset($this->voicemail_id)) {
$sql = "select voicemail_id from v_voicemails ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and voicemail_uuid = '".$this->voicemail_uuid."' ";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (is_array($result)) foreach ($result as &$row) {
$this->voicemail_id = $row["voicemail_id"];
}
unset ($prep_statement);
}
}
public function voicemails() {
@@ -296,6 +299,7 @@
public function message_delete() {
//delete the recording
$this->get_voicemail_id();
$file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id;
if ($this->voicemail_message_uuid != '') {
foreach (glob($file_path."/intro_".$this->voicemail_message_uuid.".*") as $file_name) {