Translated using Weblate (French)
[phpmyadmin.git] / version_check.php
blob30a20008e2af06cfbecd4eaa1409c99d8a61f790
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 */
8 declare(strict_types=1);
10 use PhpMyAdmin\Core;
11 use PhpMyAdmin\Response;
12 use PhpMyAdmin\VersionInformation;
14 if (! defined('ROOT_PATH')) {
15 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
18 $_GET['ajax_request'] = 'true';
20 require_once ROOT_PATH . 'libraries/common.inc.php';
22 // Disabling standard response.
23 Response::getInstance()->disable();
25 // Always send the correct headers
26 Core::headerJSON();
28 $versionInformation = new VersionInformation();
29 $versionDetails = $versionInformation->getLatestVersion();
31 if (empty($versionDetails)) {
32 echo json_encode([]);
33 } else {
34 $latestCompatible = $versionInformation->getLatestCompatibleVersion(
35 $versionDetails->releases
37 $version = '';
38 $date = '';
39 if ($latestCompatible != null) {
40 $version = $latestCompatible['version'];
41 $date = $latestCompatible['date'];
43 echo json_encode(
45 'version' => ! empty($version) ? $version : '',
46 'date' => ! empty($date) ? $date : '',