1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-10 08:34:20 +02:00

PHP: Use ?:

This commit is contained in:
Jakub Vrana
2025-03-06 18:12:22 +01:00
parent dc50bf17ea
commit 94a4f61db2
17 changed files with 24 additions and 24 deletions

View File

@@ -57,7 +57,7 @@ if (isset($_GET["clickhouse"])) {
function connect($server, $username, $password) {
preg_match('~^(https?://)?(.*)~', $server, $match);
$this->_url = ($match[1] ? $match[1] : "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$this->_url = ($match[1] ?: "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$return = $this->query('SELECT 1');
return (bool) $return;
}

View File

@@ -78,7 +78,7 @@ if (isset($_GET["elastic"])) {
*/
function connect($server, $username, $password) {
preg_match('~^(https?://)?(.*)~', $server, $match);
$this->_url = ($match[1] ? $match[1] : "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$this->_url = ($match[1] ?: "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$return = $this->query('');
if ($return) {
$this->server_info = $return['version']['number'];
@@ -529,7 +529,7 @@ if (isset($_GET["elastic"])) {
$properties = array();
foreach ($fields as $f) {
$field_name = trim($f[1][0]);
$field_type = trim($f[1][1] ? $f[1][1] : "text");
$field_type = trim($f[1][1] ?: "text");
$properties[$field_name] = array(
'type' => $field_type
);

View File

@@ -68,7 +68,7 @@ if (isset($_GET["elastic5"])) {
function connect($server, $username, $password) {
preg_match('~^(https?://)?(.*)~', $server, $match);
$this->_url = ($match[1] ? $match[1] : "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$this->_url = ($match[1] ?: "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$return = $this->query('');
if ($return) {
$this->server_info = $return['version']['number'];
@@ -505,7 +505,7 @@ if (isset($_GET["elastic5"])) {
$properties = array();
foreach ($fields as $f) {
$field_name = trim($f[1][0]);
$field_type = trim($f[1][1] ? $f[1][1] : "text");
$field_type = trim($f[1][1] ?: "text");
$properties[$field_name] = array(
'type' => $field_type
);

View File

@@ -439,7 +439,7 @@ if (isset($_GET["simpledb"])) {
}
$connection->error = '';
$tag = $action . "Result";
return ($xml->$tag ? $xml->$tag : true);
return ($xml->$tag ?: true);
}
function sdb_request_all($action, $tag, $params = array(), $timeout = 0) {