upgrade_schema.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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-2020
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. // set included, if not
  22. if (!isset($included)) { $included = false; }
  23. //check the permission
  24. if(defined('STDIN')) {
  25. //includes files
  26. require_once dirname(__DIR__, 2) . "/resources/require.php";
  27. require_once "resources/functions.php";
  28. //set the format
  29. $format = 'text'; //html, text
  30. }
  31. else if (!$included) {
  32. //includes files
  33. require_once dirname(__DIR__, 2) . "/resources/require.php";
  34. require_once "resources/check_auth.php";
  35. if (permission_exists('upgrade_schema') || if_group("superadmin")) {
  36. //echo "access granted";
  37. }
  38. else {
  39. echo "access denied";
  40. exit;
  41. }
  42. require_once "resources/header.php";
  43. //set the title and format
  44. $document['title'] = $text['title-upgrade_schema'];
  45. $format = 'html'; //html, text
  46. }
  47. //add multi-lingual support
  48. $language = new text;
  49. $text = $language->get();
  50. //get the database schema put it into an array then compare and update the database as needed.
  51. require_once "resources/classes/schema.php";
  52. $obj = new schema;
  53. if (isset($argv[1]) && $argv[1] == 'data_types') {
  54. $obj->data_types = true;
  55. }
  56. echo $obj->schema($format);
  57. //formatting for html
  58. if (!$included && $format == 'html') {
  59. echo "<br />\n";
  60. echo "<br />\n";
  61. require_once "resources/footer.php";
  62. }
  63. ?>