Bearsampp 2026.9.23
Loading...
Searching...
No Matches
Bins Class Reference

Public Member Functions

 __construct ()
 getAll ()
 getApache ()
 getBinByName (string $name)
 getMailpit ()
 getMariadb ()
 getMemcached ()
 getMysql ()
 getNodejs ()
 getPhp ()
 getPostgresql ()
 getServices ()
 getXlight ()
 reload ()
 update ()

Data Fields

const TYPE = 'bins'

Private Attributes

 $apache
 $mailpit
 $mariadb
 $memcached
 $mysql
 $nodejs
 $php
 $postgresql
 $xlight

Detailed Description

The Bins class manages various bin modules such as Mailpit, Memcached, Apache, PHP, MySQL, MariaDB, PostgreSQL, Node.js and Xlight. It provides methods to initialize, reload, update, and retrieve these modules. The class also handles logging and service management for the enabled bin modules.

Definition at line 16 of file class.bins.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor for the Bins class. Initializes the Bins object and logs the initialization.

Definition at line 46 of file class.bins.php.

47 {
48 Log::initClass($this);
49 }
static initClass($classInstance)

References Log\initClass().

Here is the call graph for this function:

Member Function Documentation

◆ getAll()

getAll ( )

Retrieves all bin modules.

Returns
array An array of all bin modules.

Definition at line 80 of file class.bins.php.

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 }
getMysql()
getXlight()
getPostgresql()
getMemcached()
getApache()
getMailpit()
getMariadb()
getNodejs()

References getApache(), getMailpit(), getMariadb(), getMemcached(), getMysql(), getNodejs(), getPhp(), getPostgresql(), and getXlight().

Referenced by getBinByName(), reload(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getApache()

getApache ( )

Retrieves the Apache bin module. If the Apache module is not initialized, it creates a new instance.

Returns
BinApache The Apache bin module.

Definition at line 131 of file class.bins.php.

132 {
133 if ($this->apache == null) {
134 $this->apache = new BinApache('apache', self::TYPE);
135 }
136
137 return $this->apache;
138 }

References $apache.

Referenced by getAll(), and getServices().

Here is the caller graph for this function:

◆ getBinByName()

getBinByName ( string $name)

Finds a bin by its display name.

Iterates over all bins and returns the one whose getName() matches the provided string. Returns null if no bin matches, so callers can handle unrecognised names without branching on each individual service.

Parameters
string$nameThe display name to look up (as returned by getName()).
Returns
object|null The matching bin object, or null if not found.

Definition at line 241 of file class.bins.php.

241 : ?object
242 {
243 foreach ($this->getAll() as $bin) {
244 if ($bin->getName() === $name) {
245 return $bin;
246 }
247 }
248
249 return null;
250 }
getAll()

References getAll().

Here is the call graph for this function:

◆ getMailpit()

getMailpit ( )

Retrieves the Mailpit bin module. If the Mailpit module is not initialized, it creates a new instance.

Returns
BinMailpit The Mailpit bin module.

Definition at line 101 of file class.bins.php.

102 {
103 if ($this->mailpit == null) {
104 $this->mailpit = new BinMailpit('mailpit', self::TYPE);
105 }
106
107 return $this->mailpit;
108 }

References $mailpit.

Referenced by getAll(), and getServices().

Here is the caller graph for this function:

◆ getMariadb()

getMariadb ( )

Retrieves the MariaDB bin module. If the MariaDB module is not initialized, it creates a new instance.

Returns
BinMariadb The MariaDB bin module.

Definition at line 176 of file class.bins.php.

177 {
178 if ($this->mariadb == null) {
179 $this->mariadb = new BinMariadb('mariadb', self::TYPE);
180 }
181
182 return $this->mariadb;
183 }

References $mariadb.

Referenced by getAll(), and getServices().

Here is the caller graph for this function:

◆ getMemcached()

getMemcached ( )

Retrieves the Memcached bin module. If the Memcached module is not initialized, it creates a new instance.

Returns
BinMemcached The Memcached bin module.

Definition at line 116 of file class.bins.php.

117 {
118 if ($this->memcached == null) {
119 $this->memcached = new BinMemcached('memcached', self::TYPE);
120 }
121
122 return $this->memcached;
123 }

References $memcached.

Referenced by getAll(), and getServices().

Here is the caller graph for this function:

◆ getMysql()

getMysql ( )

Retrieves the MySQL bin module. If the MySQL module is not initialized, it creates a new instance.

Returns
BinMysql The MySQL bin module.

Definition at line 161 of file class.bins.php.

162 {
163 if ($this->mysql == null) {
164 $this->mysql = new BinMysql('mysql', self::TYPE);
165 }
166
167 return $this->mysql;
168 }

References $mysql.

Referenced by getAll(), and getServices().

Here is the caller graph for this function:

◆ getNodejs()

getNodejs ( )

Retrieves the Node.js bin module. If the Node.js module is not initialized, it creates a new instance.

Returns
BinNodejs The Node.js bin module.

Definition at line 206 of file class.bins.php.

207 {
208 if ($this->nodejs == null) {
209 $this->nodejs = new BinNodejs('nodejs', self::TYPE);
210 }
211
212 return $this->nodejs;
213 }

References $nodejs.

Referenced by getAll().

Here is the caller graph for this function:

◆ getPhp()

getPhp ( )

Retrieves the PHP bin module. If the PHP module is not initialized, it creates a new instance.

Returns
BinPhp The PHP bin module.

Definition at line 146 of file class.bins.php.

147 {
148 if ($this->php == null) {
149 $this->php = new BinPhp('php', self::TYPE);
150 }
151
152 return $this->php;
153 }

References $php.

Referenced by getAll().

Here is the caller graph for this function:

◆ getPostgresql()

getPostgresql ( )

Retrieves the PostgreSQL bin module. If the PostgreSQL module is not initialized, it creates a new instance.

Returns
BinPostgresql The PostgreSQL bin module.

Definition at line 191 of file class.bins.php.

192 {
193 if ($this->postgresql == null) {
194 $this->postgresql = new BinPostgresql('postgresql', self::TYPE);
195 }
196
197 return $this->postgresql;
198 }
$postgresql

References $postgresql.

Referenced by getAll(), and getServices().

Here is the caller graph for this function:

◆ getServices()

getServices ( )

Retrieves the services for all enabled bin modules.

Returns
array An associative array of service names and their corresponding service objects.

Definition at line 257 of file class.bins.php.

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 }
$result
const SERVICE_NAME

References $result, getApache(), getMailpit(), getMariadb(), getMemcached(), getMysql(), getPostgresql(), getXlight(), BinApache\SERVICE_NAME, BinMailpit\SERVICE_NAME, BinMariadb\SERVICE_NAME, BinMemcached\SERVICE_NAME, BinMysql\SERVICE_NAME, BinPostgresql\SERVICE_NAME, and BinXlight\SERVICE_NAME.

Here is the call graph for this function:

◆ getXlight()

getXlight ( )

Retrieves the Xlight bin module. If the Xlight module is not initialized, it creates a new instance.

Returns
BinXlight The Xlight bin module.

Definition at line 221 of file class.bins.php.

222 {
223 if ($this->xlight == null) {
224 $this->xlight = new BinXlight('xlight', self::TYPE);
225 }
226
227 return $this->xlight;
228 }

References $xlight.

Referenced by getAll(), and getServices().

Here is the caller graph for this function:

◆ reload()

reload ( )

Reloads the configuration for all bin modules. Logs the reload action and calls the reload method on each bin module.

Definition at line 55 of file class.bins.php.

56 {
57 Log::info('Reload bins');
58 foreach ($this->getAll() as $bin) {
59 $bin->reload();
60 }
61 }
static info($data, $file=null)

References getAll(), and Log\info().

Here is the call graph for this function:

◆ update()

update ( )

Updates the configuration for all bin modules. Logs the update action and calls the update method on each bin module.

Definition at line 67 of file class.bins.php.

68 {
69 Log::info('Update bins config');
70 foreach ($this->getAll() as $bin) {
71 $bin->update();
72 }
73 }

References getAll(), and Log\info().

Here is the call graph for this function:

Field Documentation

◆ $apache

$apache
private

Definition at line 24 of file class.bins.php.

Referenced by getApache().

◆ $mailpit

$mailpit
private

Definition at line 26 of file class.bins.php.

Referenced by getMailpit().

◆ $mariadb

$mariadb
private

Definition at line 28 of file class.bins.php.

Referenced by getMariadb().

◆ $memcached

$memcached
private

Definition at line 30 of file class.bins.php.

Referenced by getMemcached().

◆ $mysql

$mysql
private

Definition at line 32 of file class.bins.php.

Referenced by getMysql().

◆ $nodejs

$nodejs
private

Definition at line 34 of file class.bins.php.

Referenced by getNodejs().

◆ $php

$php
private

Definition at line 36 of file class.bins.php.

Referenced by getPhp().

◆ $postgresql

$postgresql
private

Definition at line 38 of file class.bins.php.

Referenced by getPostgresql().

◆ $xlight

$xlight
private

Definition at line 40 of file class.bins.php.

Referenced by getXlight().

◆ TYPE

const TYPE = 'bins'

The type identifier for bin modules.

Definition at line 21 of file class.bins.php.

Referenced by Module\reload().


The documentation for this class was generated from the following file: