app_defaults.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2019
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. //proccess this only one time
  22. if ($domains_processed == 1) {
  23. //set the database driver
  24. $sql = "select * from v_databases ";
  25. $sql .= "where database_driver is null ";
  26. $database = new database;
  27. $result = $database->select($sql, null, 'all');
  28. foreach ($result as &$row) {
  29. $database_uuid = $row["database_uuid"];
  30. $database_type = $row["database_type"];
  31. $database_type_array = explode(":", $database_type);
  32. if ($database_type_array[0] == "odbc") {
  33. $database_driver = $database_type_array[1];
  34. }
  35. else {
  36. $database_driver = $database_type_array[0];
  37. }
  38. $sql = "update v_databases set ";
  39. $sql .= "database_driver = :database_driver ";
  40. $sql .= "where database_uuid = :database_uuid ";
  41. $parameters['database_driver'] = $database_driver;
  42. $parameters['database_uuid'] = $database_uuid;
  43. $database = new database;
  44. $database->execute($sql, $parameters);
  45. unset($sql, $parameters);
  46. }
  47. unset($result);
  48. }
  49. ?>