Bearsampp
2026.7.11
Toggle main menu visibility
Loading...
Searching...
No Matches
ajax.mariadb.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2024 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: Bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
10
global
$bearsamppBins
,
$bearsamppLang
;
11
20
21
// Initialize result array to store port status and versions information
22
$result
= array(
23
'checkport'
=>
''
,
24
'versions'
=>
''
,
25
);
26
27
// Check port
28
$port
=
$bearsamppBins
->getMariadb()->getPort();
29
30
$textServiceStarted
=
$bearsamppLang
->getValue(
Lang::HOMEPAGE_SERVICE_STARTED
);
31
$textServiceStopped
=
$bearsamppLang
->getValue(
Lang::HOMEPAGE_SERVICE_STOPPED
);
32
$textDisabled
=
$bearsamppLang
->getValue(
Lang::DISABLED
);
33
39
if
(
$bearsamppBins
->getMariadb()->isEnable()) {
40
if
(
$bearsamppBins
->getMariadb()->checkPort(
$port
)) {
41
$result
[
'checkport'
] .=
'<span class="float-end badge text-bg-success">'
. sprintf(
$textServiceStarted
,
$port
) .
'</span>'
;
42
}
else
{
43
$result
[
'checkport'
] .=
'<span class="float-end badge text-bg-danger">'
.
$textServiceStopped
.
'</span>'
;
44
}
45
}
else
{
46
$result
[
'checkport'
] =
'<span class="float-end badge text-bg-secondary">'
.
$textDisabled
.
'</span>'
;
47
}
48
53
foreach
(
$bearsamppBins
->getMariadb()->getVersionList() as $version) {
54
if
($version !=
$bearsamppBins
->getMariadb()->getVersion()) {
55
$result
[
'versions'
] .=
'<span class="m-1 badge text-bg-secondary">'
. $version .
'</span>'
;
56
}
else
{
57
$result
[
'versions'
] .=
'<span class="m-1 badge text-bg-primary">'
.
$bearsamppBins
->getMariadb()->getVersion() .
'</span>'
;
58
}
59
}
60
61
// Output the result as a JSON-encoded string
62
echo json_encode(
$result
);
63
$result
$result
Definition
ajax.apache.php:19
$textServiceStopped
$textServiceStopped
Definition
ajax.apache.php:38
$textDisabled
$textDisabled
Definition
ajax.apache.php:39
$bearsamppBins
global $bearsamppBins
Definition
ajax.apache.php:16
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
$port
$port
Definition
ajax.apache.php:34
$textServiceStarted
$textServiceStarted
Definition
ajax.apache.php:37
Lang\DISABLED
const DISABLED
Definition
class.lang.php:36
Lang\HOMEPAGE_SERVICE_STOPPED
const HOMEPAGE_SERVICE_STOPPED
Definition
class.lang.php:379
Lang\HOMEPAGE_SERVICE_STARTED
const HOMEPAGE_SERVICE_STARTED
Definition
class.lang.php:378
sandbox
core
resources
homepage
ajax
ajax.mariadb.php
Generated by
1.17.0