2024.8.23
Loading...
Searching...
No Matches
class.action.enable.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/**
11 * Class ActionEnable
12 *
13 * This class is responsible for enabling various services (Apache, PHP, MySQL, etc.) based on the provided arguments.
14 */
16{
17 /**
18 * Constructor for the ActionEnable class.
19 *
20 * @param array $args An array of arguments where the first element is the service name and the second element is the enable flag.
21 *
22 * @global object $bearsamppBins Global object containing instances of various services.
23 */
24 public function __construct($args)
25 {
26 global $bearsamppBins;
27
28 if ( isset( $args[0] ) && !empty( $args[0] ) && isset( $args[1] ) ) {
30 if ( $args[0] == $bearsamppBins->getApache()->getName() ) {
31 $bearsamppBins->getApache()->setEnable( $args[1], true );
32 }
33 elseif ( $args[0] == $bearsamppBins->getPhp()->getName() ) {
34 $bearsamppBins->getPhp()->setEnable( $args[1], true );
35 }
36 elseif ( $args[0] == $bearsamppBins->getMysql()->getName() ) {
37 $bearsamppBins->getMysql()->setEnable( $args[1], true );
38 }
39 elseif ( $args[0] == $bearsamppBins->getMariadb()->getName() ) {
40 $bearsamppBins->getMariadb()->setEnable( $args[1], true );
41 }
42 elseif ( $args[0] == $bearsamppBins->getNodejs()->getName() ) {
43 $bearsamppBins->getNodejs()->setEnable( $args[1], true );
44 }
45 elseif ( $args[0] == $bearsamppBins->getPostgresql()->getName() ) {
46 $bearsamppBins->getPostgresql()->setEnable( $args[1], true );
47 }
48 elseif ( $args[0] == $bearsamppBins->getFilezilla()->getName() ) {
49 $bearsamppBins->getFilezilla()->setEnable( $args[1], true );
50 }
51 elseif ( $args[0] == $bearsamppBins->getMailhog()->getName() ) {
52 $bearsamppBins->getMailhog()->setEnable( $args[1], true );
53 }
54 elseif ( $args[0] == $bearsamppBins->getMailpit()->getName() ) {
55 $bearsamppBins->getMailpit()->setEnable( $args[1], true );
56 }
57 elseif ( $args[0] == $bearsamppBins->getMemcached()->getName() ) {
58 $bearsamppBins->getMemcached()->setEnable( $args[1], true );
59 }
60 elseif ( $args[0] == $bearsamppBins->getXlight()->getName() ) {
61 $bearsamppBins->getXlight()->setEnable( $args[1], true );
62 }
63 }
64 }
65}
global $bearsamppBins
static startLoading()