Translated using Weblate (Chinese (Simplified))
[phpmyadmin.git] / version_check.php
blob4805e5735c2c6c5cbb5e8faf7f34581e2cb6306c
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/
6 * @package PhpMyAdmin
7 */
9 use PhpMyAdmin\Core;
10 use PhpMyAdmin\VersionInformation;
11 use PhpMyAdmin\Response;
13 $_GET['ajax_request'] = 'true';
15 require_once 'libraries/common.inc.php';
17 // Disabling standard response.
18 Response::getInstance()->disable();
20 // Always send the correct headers
21 Core::headerJSON();
23 $versionInformation = new VersionInformation();
24 $versionDetails = $versionInformation->getLatestVersion();
26 if (empty($versionDetails)) {
27 echo json_encode(array());
28 } else {
29 $latestCompatible = $versionInformation->getLatestCompatibleVersion(
30 $versionDetails->releases
32 $version = '';
33 $date = '';
34 if ($latestCompatible != null) {
35 $version = $latestCompatible['version'];
36 $date = $latestCompatible['date'];
38 echo json_encode(
39 array(
40 'version' => (! empty($version) ? $version : ''),
41 'date' => (! empty($date) ? $date : ''),