version_check.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * A caching proxy for retrieving version information from https://www.phpmyadmin.net/
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. use PhpMyAdmin\Core;
  9. use PhpMyAdmin\VersionInformation;
  10. use PhpMyAdmin\Response;
  11. $_GET['ajax_request'] = 'true';
  12. require_once 'libraries/common.inc.php';
  13. // Disabling standard response.
  14. Response::getInstance()->disable();
  15. // Always send the correct headers
  16. Core::headerJSON();
  17. $versionInformation = new VersionInformation();
  18. $versionDetails = $versionInformation->getLatestVersion();
  19. if (empty($versionDetails)) {
  20. echo json_encode(array());
  21. } else {
  22. $latestCompatible = $versionInformation->getLatestCompatibleVersion(
  23. $versionDetails->releases
  24. );
  25. $version = '';
  26. $date = '';
  27. if ($latestCompatible != null) {
  28. $version = $latestCompatible['version'];
  29. $date = $latestCompatible['date'];
  30. }
  31. echo json_encode(
  32. array(
  33. 'version' => (! empty($version) ? $version : ''),
  34. 'date' => (! empty($date) ? $date : ''),
  35. )
  36. );
  37. }