voicemail_directories.php 883 B

123456789101112131415161718192021222324
  1. <?php
  2. //migrate existing attachment preferences to new column, where appropriate
  3. $sql = "update v_voicemails set voicemail_file = 'attach' where voicemail_attach_file = 'true'";
  4. //$db->exec(check_sql($sql));
  5. //unset($sql);
  6. //add that the directory structure for voicemail each domain and voicemail id is
  7. $sql = "select d.domain_name, v.voicemail_id ";
  8. $sql .= "from v_domains as d, v_voicemails as v ";
  9. $sql .= "where v.domain_uuid = d.domain_uuid ";
  10. $prep_statement = $db->prepare($sql);
  11. $prep_statement->execute();
  12. $voicemails = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
  13. foreach ($voicemails as $row) {
  14. $path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$row['domain_name'].'/'.$row['voicemail_id'];
  15. if (!file_exists($path)) {
  16. event_socket_mkdir($path);
  17. //mkdir($path, 0744, true);
  18. }
  19. }
  20. unset ($prep_statement, $sql);
  21. ?>