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

Public Member Functions

 __construct ()
 getAll ()
 getApache ()
 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 34 of file class.bins.php.

35 {
36 Util::logInitClass($this);
37 }
static logInitClass($classInstance)

References Util\logInitClass().

Member Function Documentation

◆ getAll()

getAll ( )

Retrieves all bin modules.

Returns
array An array of all bin modules.

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

69 {
70 return array(
71 $this->getApache(),
72 $this->getMailpit(),
73 $this->getMemcached(),
74 $this->getMariadb(),
75 $this->getMysql(),
76 $this->getNodejs(),
77 $this->getPhp(),
78 $this->getPostgresql(),
79 $this->getXlight(),
80 );
81 }
getMysql()
getXlight()
getPostgresql()
getMemcached()
getApache()
getMailpit()
getMariadb()
getNodejs()

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

Referenced by reload(), and update().

◆ 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 117 of file class.bins.php.

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

References $apache.

Referenced by getAll(), and getServices().

◆ 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 89 of file class.bins.php.

90 {
91 if ($this->mailpit == null) {
92 $this->mailpit = new BinMailpit('mailpit', self::TYPE);
93 }
94 return $this->mailpit;
95 }

References $mailpit.

Referenced by getAll(), and getServices().

◆ 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 159 of file class.bins.php.

160 {
161 if ($this->mariadb == null) {
162 $this->mariadb = new BinMariadb('mariadb', self::TYPE);
163 }
164 return $this->mariadb;
165 }

References $mariadb.

Referenced by getAll(), and getServices().

◆ 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 103 of file class.bins.php.

104 {
105 if ($this->memcached == null) {
106 $this->memcached = new BinMemcached('memcached', self::TYPE);
107 }
108 return $this->memcached;
109 }

References $memcached.

Referenced by getAll(), and getServices().

◆ 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 145 of file class.bins.php.

146 {
147 if ($this->mysql == null) {
148 $this->mysql = new BinMysql('mysql', self::TYPE);
149 }
150 return $this->mysql;
151 }

References $mysql.

Referenced by getAll(), and getServices().

◆ 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 187 of file class.bins.php.

188 {
189 if ($this->nodejs == null) {
190 $this->nodejs = new BinNodejs('nodejs', self::TYPE);
191 }
192 return $this->nodejs;
193 }

References $nodejs.

Referenced by getAll().

◆ 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 131 of file class.bins.php.

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

References $php.

Referenced by getAll().

◆ 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 173 of file class.bins.php.

174 {
175 if ($this->postgresql == null) {
176 $this->postgresql = new BinPostgresql('postgresql', self::TYPE);
177 }
178 return $this->postgresql;
179 }
$postgresql

References $postgresql.

Referenced by getAll(), and getServices().

◆ 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 214 of file class.bins.php.

215 {
216 $result = array();
217
218 if ($this->getMailpit()->isEnable()) {
219 $result[BinMailpit::SERVICE_NAME] = $this->getMailpit()->getService();
220 }
221 if ($this->getMemcached()->isEnable()) {
222 $result[BinMemcached::SERVICE_NAME] = $this->getMemcached()->getService();
223 }
224 if ($this->getApache()->isEnable()) {
225 $result[BinApache::SERVICE_NAME] = $this->getApache()->getService();
226 }
227 if ($this->getMysql()->isEnable()) {
228 $result[BinMysql::SERVICE_NAME] = $this->getMysql()->getService();
229 }
230 if ($this->getMariadb()->isEnable()) {
231 $result[BinMariadb::SERVICE_NAME] = $this->getMariadb()->getService();
232 }
233 if ($this->getPostgresql()->isEnable()) {
234 $result[BinPostgresql::SERVICE_NAME] = $this->getPostgresql()->getService();
235 }
236 if ($this->getXlight()->isEnable()) {
237 $result[BinXlight::SERVICE_NAME] = $this->getXlight()->getService();
238 }
239
240 return $result;
241 }
$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.

◆ 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 201 of file class.bins.php.

202 {
203 if ($this->xlight == null) {
204 $this->xlight = new BinXlight('xlight', self::TYPE);
205 }
206 return $this->xlight;
207 }

References $xlight.

Referenced by getAll(), and getServices().

◆ 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 43 of file class.bins.php.

44 {
45 Util::logInfo('Reload bins');
46 foreach ($this->getAll() as $bin) {
47 $bin->reload();
48 }
49 }
getAll()
static logInfo($data, $file=null)

References getAll(), and Util\logInfo().

◆ 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 55 of file class.bins.php.

56 {
57 Util::logInfo('Update bins config');
58 foreach ($this->getAll() as $bin) {
59 $bin->update();
60 }
61 }

References getAll(), and Util\logInfo().

Field Documentation

◆ $apache

$apache
private

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

Referenced by getApache().

◆ $mailpit

$mailpit
private

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

Referenced by getMailpit().

◆ $mariadb

$mariadb
private

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

Referenced by getMariadb().

◆ $memcached

$memcached
private

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

Referenced by getMemcached().

◆ $mysql

$mysql
private

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

Referenced by getMysql().

◆ $nodejs

$nodejs
private

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

Referenced by getNodejs().

◆ $php

$php
private

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

Referenced by getPhp().

◆ $postgresql

$postgresql
private

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

Referenced by getPostgresql().

◆ $xlight

$xlight
private

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

Referenced by getXlight().

◆ TYPE

const TYPE = 'bins'

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

Referenced by Module\reload().


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