2024.8.23
Loading...
Searching...
No Matches
Bins Class Reference

Public Member Functions

 __construct ()
 
 getAll ()
 
 getApache ()
 
 getFilezilla ()
 
 getLogsPath ()
 
 getMailhog ()
 
 getMailpit ()
 
 getMariadb ()
 
 getMemcached ()
 
 getMysql ()
 
 getNodejs ()
 
 getPhp ()
 
 getPostgresql ()
 
 getServices ()
 
 getXlight ()
 
 reload ()
 
 update ()
 

Data Fields

const TYPE = 'bins'
 

Private Attributes

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

Detailed Description

The Bins class manages various bin modules such as Mailhog, Mailpit, Memcached, Apache, PHP, MySQL, MariaDB, PostgreSQL, Node.js, FileZilla, 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()

Bins::__construct ( )

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

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

37 {
38 Util::logInitClass($this);
39 }
static logInitClass($classInstance)

References Util\logInitClass().

Member Function Documentation

◆ getAll()

Bins::getAll ( )

Retrieves all bin modules.

Returns
array An array of all bin modules.

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

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

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

Referenced by reload(), and update().

+ Here is the caller graph for this function:

◆ getApache()

Bins::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 135 of file class.bins.php.

136 {
137 if ($this->apache == null) {
138 $this->apache = new BinApache('apache', self::TYPE);
139 }
140 return $this->apache;
141 }

References $apache.

Referenced by getAll(), and getServices().

+ Here is the caller graph for this function:

◆ getFilezilla()

Bins::getFilezilla ( )

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

Returns
BinFilezilla The FileZilla bin module.

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

220 {
221 if ($this->filezilla == null) {
222 $this->filezilla = new BinFilezilla('filezilla', self::TYPE);
223 }
224 return $this->filezilla;
225 }

References $filezilla.

Referenced by getAll(), getLogsPath(), and getServices().

+ Here is the caller graph for this function:

◆ getLogsPath()

Bins::getLogsPath ( )

Retrieves the log paths for all bin modules.

Returns
array An array of log paths for all bin modules.

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

247 {
248 return array(
249 $this->getFilezilla()->getLogsPath(),
250 );
251 }
getLogsPath()

References getFilezilla(), and getLogsPath().

Referenced by getLogsPath().

+ Here is the caller graph for this function:

◆ getMailhog()

Bins::getMailhog ( )

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

Returns
BinMailhog The Mailhog bin module.

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

94 {
95 if ($this->mailhog == null) {
96 $this->mailhog = new BinMailhog('mailhog', self::TYPE);
97 }
98 return $this->mailhog;
99 }

References $mailhog.

Referenced by getAll(), and getServices().

+ Here is the caller graph for this function:

◆ getMailpit()

Bins::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 107 of file class.bins.php.

108 {
109 if ($this->mailpit == null) {
110 $this->mailpit = new BinMailpit('mailpit', self::TYPE);
111 }
112 return $this->mailpit;
113 }

References $mailpit.

Referenced by getAll(), and getServices().

+ Here is the caller graph for this function:

◆ getMariadb()

Bins::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 177 of file class.bins.php.

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

References $mariadb.

Referenced by getAll(), and getServices().

+ Here is the caller graph for this function:

◆ getMemcached()

Bins::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 121 of file class.bins.php.

122 {
123 if ($this->memcached == null) {
124 $this->memcached = new BinMemcached('memcached', self::TYPE);
125 }
126 return $this->memcached;
127 }

References $memcached.

Referenced by getAll(), and getServices().

+ Here is the caller graph for this function:

◆ getMysql()

Bins::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 163 of file class.bins.php.

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

References $mysql.

Referenced by getAll(), and getServices().

+ Here is the caller graph for this function:

◆ getNodejs()

Bins::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 205 of file class.bins.php.

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

References $nodejs.

Referenced by getAll().

+ Here is the caller graph for this function:

◆ getPhp()

Bins::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 149 of file class.bins.php.

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

References $php.

Referenced by getAll().

+ Here is the caller graph for this function:

◆ getPostgresql()

Bins::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 return $this->postgresql;
197 }
$postgresql

References $postgresql.

Referenced by getAll(), and getServices().

+ Here is the caller graph for this function:

◆ getServices()

Bins::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 258 of file class.bins.php.

259 {
260 $result = array();
261
262 if ($this->getMailhog()->isEnable()) {
263 $result[BinMailhog::SERVICE_NAME] = $this->getMailhog()->getService();
264 }
265 if ($this->getMailpit()->isEnable()) {
266 $result[BinMailpit::SERVICE_NAME] = $this->getMailpit()->getService();
267 }
268 if ($this->getMemcached()->isEnable()) {
269 $result[BinMemcached::SERVICE_NAME] = $this->getMemcached()->getService();
270 }
271 if ($this->getApache()->isEnable()) {
272 $result[BinApache::SERVICE_NAME] = $this->getApache()->getService();
273 }
274 if ($this->getMysql()->isEnable()) {
275 $result[BinMysql::SERVICE_NAME] = $this->getMysql()->getService();
276 }
277 if ($this->getMariadb()->isEnable()) {
278 $result[BinMariadb::SERVICE_NAME] = $this->getMariadb()->getService();
279 }
280 if ($this->getPostgresql()->isEnable()) {
281 $result[BinPostgresql::SERVICE_NAME] = $this->getPostgresql()->getService();
282 }
283 if ($this->getFilezilla()->isEnable()) {
284 $result[BinFilezilla::SERVICE_NAME] = $this->getFilezilla()->getService();
285 }
286 if ($this->getXlight()->isEnable()) {
287 $result[BinXlight::SERVICE_NAME] = $this->getXlight()->getService();
288 }
289
290 return $result;
291 }
$result
const SERVICE_NAME

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

◆ getXlight()

Bins::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 233 of file class.bins.php.

234 {
235 if ($this->xlight == null) {
236 $this->xlight = new BinXlight('xlight', self::TYPE);
237 }
238 return $this->xlight;
239 }

References $xlight.

Referenced by getAll(), and getServices().

+ Here is the caller graph for this function:

◆ reload()

Bins::reload ( )

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

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

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

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

◆ update()

Bins::update ( )

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

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

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

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

Field Documentation

◆ $apache

Bins::$apache
private

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

Referenced by getApache().

◆ $filezilla

Bins::$filezilla
private

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

Referenced by getFilezilla().

◆ $mailhog

Bins::$mailhog
private

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

Referenced by getMailhog().

◆ $mailpit

Bins::$mailpit
private

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

Referenced by getMailpit().

◆ $mariadb

Bins::$mariadb
private

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

Referenced by getMariadb().

◆ $memcached

Bins::$memcached
private

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

Referenced by getMemcached().

◆ $mysql

Bins::$mysql
private

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

Referenced by getMysql().

◆ $nodejs

Bins::$nodejs
private

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

Referenced by getNodejs().

◆ $php

Bins::$php
private

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

Referenced by getPhp().

◆ $postgresql

Bins::$postgresql
private

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

Referenced by getPostgresql().

◆ $xlight

Bins::$xlight
private

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

Referenced by getXlight().

◆ TYPE

const Bins::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: