sysinfo.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Bibliotheca
  4. *
  5. * Copyright 2018-2024 Johannes Keßler
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.
  19. */
  20. $TemplateData['bibVersion'] = BIB_VERSION;
  21. $TemplateData['apacheVersion'] = $_SERVER['SERVER_SOFTWARE'];
  22. if(function_exists("apache_get_version")) {
  23. $TemplateData['apacheVersion'] = apache_get_version();
  24. }
  25. $TemplateData['phpVersion'] = phpversion();
  26. $TemplateData['mysqlVersion'] = mysqli_get_server_info($DB);
  27. $overallTableSize = 0; // MB
  28. $queryStr = "SELECT (DATA_LENGTH + INDEX_LENGTH) AS `size`
  29. FROM information_schema.TABLES
  30. WHERE TABLE_SCHEMA = 'bibliotheca'
  31. ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC";
  32. if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
  33. try {
  34. $query = $DB->query($queryStr);
  35. if($query !== false && $query->num_rows > 0) {
  36. while(($result = $query->fetch_assoc()) != false) {
  37. $overallTableSize += $result['size'];
  38. }
  39. }
  40. }
  41. catch (Exception $e) {
  42. Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
  43. }
  44. $TemplateData['overallTableSize'] = Summoner::bytesToHuman($overallTableSize);
  45. $TemplateData['overallStorageSize'] = Summoner::bytesToHuman(Summoner::folderSize(PATH_STORAGE));
  46. require_once 'lib/trite.class.php';
  47. $Trite = new Trite($DB,$Doomguy);
  48. $TemplateData['existingCollections'] = $Trite->getCollections("write");
  49. foreach($TemplateData['existingCollections'] as $k=>$v) {
  50. $Trite->load($k);
  51. $TemplateData['existingCollections'][$k] = $Trite->getStats();
  52. }