Bearsampp
2026.9.23
Toggle main menu visibility
Loading...
Searching...
No Matches
class.bins.php
Go to the documentation of this file.
1
<?php
2
/*
3
*
4
* * Copyright (c) 2021-2026 Bearsampp
5
* * License: GNU General Public License version 3 or later; see LICENSE.txt
6
* * Website: https://bearsampp.com
7
* * Github: https://github.com/Bearsampp
8
*
9
*/
10
16
class
Bins
17
{
21
const
TYPE
=
'bins'
;
22
24
private
$apache
;
26
private
$mailpit
;
28
private
$mariadb
;
30
private
$memcached
;
32
private
$mysql
;
34
private
$nodejs
;
36
private
$php
;
38
private
$postgresql
;
40
private
$xlight
;
41
46
public
function
__construct
()
47
{
48
Log::initClass
($this);
49
}
50
55
public
function
reload
()
56
{
57
Log::info
(
'Reload bins'
);
58
foreach
($this->
getAll
() as $bin) {
59
$bin->reload();
60
}
61
}
62
67
public
function
update
()
68
{
69
Log::info
(
'Update bins config'
);
70
foreach
($this->
getAll
() as $bin) {
71
$bin->update();
72
}
73
}
74
80
public
function
getAll
()
81
{
82
return
array(
83
$this->
getApache
(),
84
$this->
getMailpit
(),
85
$this->
getMemcached
(),
86
$this->
getMariadb
(),
87
$this->
getMysql
(),
88
$this->
getNodejs
(),
89
$this->
getPhp
(),
90
$this->
getPostgresql
(),
91
$this->
getXlight
(),
92
);
93
}
94
101
public
function
getMailpit
()
102
{
103
if
($this->mailpit ==
null
) {
104
$this->mailpit =
new
BinMailpit
(
'mailpit'
, self::TYPE);
105
}
106
107
return
$this->mailpit
;
108
}
109
116
public
function
getMemcached
()
117
{
118
if
($this->memcached ==
null
) {
119
$this->memcached =
new
BinMemcached
(
'memcached'
, self::TYPE);
120
}
121
122
return
$this->memcached
;
123
}
124
131
public
function
getApache
()
132
{
133
if
($this->apache ==
null
) {
134
$this->apache =
new
BinApache
(
'apache'
, self::TYPE);
135
}
136
137
return
$this->apache
;
138
}
139
146
public
function
getPhp
()
147
{
148
if
($this->php ==
null
) {
149
$this->php =
new
BinPhp
(
'php'
, self::TYPE);
150
}
151
152
return
$this->php
;
153
}
154
161
public
function
getMysql
()
162
{
163
if
($this->mysql ==
null
) {
164
$this->mysql =
new
BinMysql
(
'mysql'
, self::TYPE);
165
}
166
167
return
$this->mysql
;
168
}
169
176
public
function
getMariadb
()
177
{
178
if
($this->mariadb ==
null
) {
179
$this->mariadb =
new
BinMariadb
(
'mariadb'
, self::TYPE);
180
}
181
182
return
$this->mariadb
;
183
}
184
191
public
function
getPostgresql
()
192
{
193
if
($this->postgresql ==
null
) {
194
$this->postgresql =
new
BinPostgresql
(
'postgresql'
, self::TYPE);
195
}
196
197
return
$this->postgresql
;
198
}
199
206
public
function
getNodejs
()
207
{
208
if
($this->nodejs ==
null
) {
209
$this->nodejs =
new
BinNodejs
(
'nodejs'
, self::TYPE);
210
}
211
212
return
$this->nodejs
;
213
}
214
221
public
function
getXlight
()
222
{
223
if
($this->xlight ==
null
) {
224
$this->xlight =
new
BinXlight
(
'xlight'
, self::TYPE);
225
}
226
227
return
$this->xlight
;
228
}
229
241
public
function
getBinByName
(
string
$name): ?object
242
{
243
foreach
($this->
getAll
() as $bin) {
244
if
($bin->getName() === $name) {
245
return
$bin;
246
}
247
}
248
249
return
null
;
250
}
251
257
public
function
getServices
()
258
{
259
$result
= array();
260
261
if
($this->
getMailpit
()->isEnable()) {
262
$result
[
BinMailpit::SERVICE_NAME
] = $this->
getMailpit
()->getService();
263
}
264
if
($this->
getMemcached
()->isEnable()) {
265
$result
[
BinMemcached::SERVICE_NAME
] = $this->
getMemcached
()->getService();
266
}
267
if
($this->
getApache
()->isEnable()) {
268
$result
[
BinApache::SERVICE_NAME
] = $this->
getApache
()->getService();
269
}
270
if
($this->
getMysql
()->isEnable()) {
271
$result
[
BinMysql::SERVICE_NAME
] = $this->
getMysql
()->getService();
272
}
273
if
($this->
getMariadb
()->isEnable()) {
274
$result
[
BinMariadb::SERVICE_NAME
] = $this->
getMariadb
()->getService();
275
}
276
if
($this->
getPostgresql
()->isEnable()) {
277
$result
[
BinPostgresql::SERVICE_NAME
] = $this->
getPostgresql
()->getService();
278
}
279
if
($this->
getXlight
()->isEnable()) {
280
$result
[
BinXlight::SERVICE_NAME
] = $this->
getXlight
()->getService();
281
}
282
283
return
$result
;
284
}
285
}
286
$result
$result
Definition
ajax.apache.php:19
BinApache
Definition
class.bin.apache.php:18
BinApache\SERVICE_NAME
const SERVICE_NAME
Definition
class.bin.apache.php:22
BinMailpit
Definition
class.bin.mailpit.php:18
BinMailpit\SERVICE_NAME
const SERVICE_NAME
Definition
class.bin.mailpit.php:22
BinMariadb
Definition
class.bin.mariadb.php:17
BinMariadb\SERVICE_NAME
const SERVICE_NAME
Definition
class.bin.mariadb.php:21
BinMemcached
Definition
class.bin.memcached.php:17
BinMemcached\SERVICE_NAME
const SERVICE_NAME
Definition
class.bin.memcached.php:21
BinMysql
Definition
class.bin.mysql.php:17
BinMysql\SERVICE_NAME
const SERVICE_NAME
Definition
class.bin.mysql.php:21
BinNodejs
Definition
class.bin.nodejs.php:49
BinPhp
Definition
class.bin.php.php:18
BinPostgresql
Definition
class.bin.postgresql.php:17
BinPostgresql\SERVICE_NAME
const SERVICE_NAME
Definition
class.bin.postgresql.php:21
BinXlight
Definition
class.bin.xlight.php:18
BinXlight\SERVICE_NAME
const SERVICE_NAME
Definition
class.bin.xlight.php:22
Bins
Definition
class.bins.php:17
Bins\$apache
$apache
Definition
class.bins.php:24
Bins\__construct
__construct()
Definition
class.bins.php:46
Bins\getMysql
getMysql()
Definition
class.bins.php:161
Bins\$mariadb
$mariadb
Definition
class.bins.php:28
Bins\$nodejs
$nodejs
Definition
class.bins.php:34
Bins\getServices
getServices()
Definition
class.bins.php:257
Bins\getXlight
getXlight()
Definition
class.bins.php:221
Bins\$php
$php
Definition
class.bins.php:36
Bins\getPostgresql
getPostgresql()
Definition
class.bins.php:191
Bins\$xlight
$xlight
Definition
class.bins.php:40
Bins\getMemcached
getMemcached()
Definition
class.bins.php:116
Bins\getApache
getApache()
Definition
class.bins.php:131
Bins\reload
reload()
Definition
class.bins.php:55
Bins\update
update()
Definition
class.bins.php:67
Bins\TYPE
const TYPE
Definition
class.bins.php:21
Bins\getMailpit
getMailpit()
Definition
class.bins.php:101
Bins\$postgresql
$postgresql
Definition
class.bins.php:38
Bins\$mailpit
$mailpit
Definition
class.bins.php:26
Bins\getAll
getAll()
Definition
class.bins.php:80
Bins\getMariadb
getMariadb()
Definition
class.bins.php:176
Bins\$mysql
$mysql
Definition
class.bins.php:32
Bins\getPhp
getPhp()
Definition
class.bins.php:146
Bins\$memcached
$memcached
Definition
class.bins.php:30
Bins\getNodejs
getNodejs()
Definition
class.bins.php:206
Bins\getBinByName
getBinByName(string $name)
Definition
class.bins.php:241
Log\info
static info($data, $file=null)
Definition
class.log.php:737
Log\initClass
static initClass($classInstance)
Definition
class.log.php:784
sandbox
core
classes
bins
class.bins.php
Generated by
1.17.0