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

Public Member Functions

 __construct ()
 call ($actionName, $actionArgs=null)
 exists ()
 process ()

Data Fields

const ABOUT = 'about'
const ADD_ALIAS = 'addAlias'
const ADD_VHOST = 'addVhost'
const CHANGE_BROWSER = 'changeBrowser'
const CHANGE_DB_ROOT_PWD = 'changeDbRootPwd'
const CHANGE_PORT = 'changePort'
const CHECK_PORT = 'checkPort'
const CHECK_VERSION = 'checkVersion'
const CLEAR_FOLDERS = 'clearFolders'
const DEBUG_APACHE = 'debugApache'
const DEBUG_MARIADB = 'debugMariadb'
const DEBUG_MYSQL = 'debugMysql'
const DEBUG_POSTGRESQL = 'debugPostgresql'
const EDIT_ALIAS = 'editAlias'
const EDIT_VHOST = 'editVhost'
const ENABLE = 'enable'
const EXEC = 'exec'
const EXT = 'ext'
const GEN_SSL_CERTIFICATE = 'genSslCertificate'
const LAUNCH_STARTUP = 'launchStartup'
const LOADING = 'loading'
const MANUAL_RESTART = 'manualRestart'
const QUIT = 'quit'
const REBUILD_INI = 'rebuildIni'
const REFRESH_REPOS = 'refreshRepos'
const REFRESH_REPOS_STARTUP = 'refreshReposStartup'
const RELOAD = 'reload'
const RESTART = 'restart'
const SERVICE = 'service'
const STARTUP = 'startup'
const SWITCH_APACHE_MODULE = 'switchApacheModule'
const SWITCH_LANG = 'switchLang'
const SWITCH_LOGS_VERBOSE = 'switchLogsVerbose'
const SWITCH_ONLINE = 'switchOnline'
const SWITCH_PHP_EXTENSION = 'switchPhpExtension'
const SWITCH_PHP_PARAM = 'switchPhpParam'
const SWITCH_VERSION = 'switchVersion'

Private Attributes

 $current

Detailed Description

Class Action handles the execution of various actions based on command line arguments.

Definition at line 13 of file class.action.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor for the Action class. Initializes the Action object.

Definition at line 64 of file class.action.php.

65 {
66 // Initialization code can be added here if needed
67 }

Member Function Documentation

◆ call()

call ( $actionName,
$actionArgs = null )

Calls a specific action by name with optional arguments.

This method constructs the action class name from the provided action name, checks if the class exists, and then initializes the action class with the provided arguments.

Parameters
string$actionNameThe name of the action to call.
mixed$actionArgsOptional arguments for the action.
Returns
void

Definition at line 110 of file class.action.php.

111 {
112 $actionClass = 'Action' . ucfirst($actionName);
113 if (class_exists($actionClass)) {
114 Util::logDebug('Start ' . $actionClass);
115 new $actionClass($actionArgs);
116 }
117 }
static logDebug($data, $file=null)

References Util\logDebug().

◆ exists()

exists ( )

Checks if the action exists in the command line arguments.

This method verifies if the command line arguments contain an action by checking the presence and non-emptiness of the second argument.

Returns
bool Returns true if the action exists, false otherwise.

Definition at line 127 of file class.action.php.

128 {
129 return isset($_SERVER['argv'])
130 && isset($_SERVER['argv'][1])
131 && !empty($_SERVER['argv'][1]);
132 }

Referenced by process().

◆ process()

process ( )

Processes the action based on command line arguments.

This method checks if an action exists in the command line arguments, cleans the argument, constructs the action class name, and then initializes the action class with the provided arguments.

Returns
void

Definition at line 78 of file class.action.php.

79 {
80 if ($this->exists()) {
81 $action = Util::cleanArgv(1);
82 $actionClass = 'Action' . ucfirst($action);
83
84 $args = array();
85 foreach ($_SERVER['argv'] as $key => $arg) {
86 if ($key > 1) {
87 $args[] = $action == self::EXT ? $arg : base64_decode($arg);
88 }
89 }
90
91 $this->current = null;
92 if (class_exists($actionClass)) {
93 Util::logDebug('Start ' . $actionClass);
94 $this->current = new $actionClass($args);
95 }
96 }
97 }
static cleanArgv($name, $type='text')

References Util\cleanArgv(), exists(), and Util\logDebug().

Field Documentation

◆ $current

$current
private

Definition at line 58 of file class.action.php.

◆ ABOUT

const ABOUT = 'about'

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

Referenced by TplApp\getSectionMenuRight().

◆ ADD_ALIAS

const ADD_ALIAS = 'addAlias'

Definition at line 17 of file class.action.php.

Referenced by TplAppApache\getActionAddAlias().

◆ ADD_VHOST

const ADD_VHOST = 'addVhost'

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

Referenced by TplAppApache\getActionAddVhost().

◆ CHANGE_BROWSER

const CHANGE_BROWSER = 'changeBrowser'

Definition at line 19 of file class.action.php.

Referenced by TplAppBrowser\getActionChangeBrowser().

◆ CHANGE_DB_ROOT_PWD

◆ CHANGE_PORT

◆ CHECK_PORT

◆ CHECK_VERSION

const CHECK_VERSION = 'checkVersion'

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

Referenced by TplApp\getSectionMenuRight(), and TplApp\getSectionStartupAction().

◆ CLEAR_FOLDERS

const CLEAR_FOLDERS = 'clearFolders'

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

Referenced by TplAppClearFolders\process().

◆ DEBUG_APACHE

const DEBUG_APACHE = 'debugApache'

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

Referenced by TplAppApache\getMenuApacheDebug().

◆ DEBUG_MARIADB

const DEBUG_MARIADB = 'debugMariadb'

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

Referenced by TplAppMariadb\getMenuMariadbDebug().

◆ DEBUG_MYSQL

const DEBUG_MYSQL = 'debugMysql'

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

Referenced by TplAppMysql\getMenuMysqlDebug().

◆ DEBUG_POSTGRESQL

const DEBUG_POSTGRESQL = 'debugPostgresql'

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

Referenced by TplAppPostgresql\getMenuPostgresqlDebug().

◆ EDIT_ALIAS

const EDIT_ALIAS = 'editAlias'

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

Referenced by TplAppApache\getActionEditAlias().

◆ EDIT_VHOST

const EDIT_VHOST = 'editVhost'

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

Referenced by TplAppApache\getActionEditVhost().

◆ ENABLE

◆ EXEC

const EXEC = 'exec'

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

Referenced by TplApp\getActionExec().

◆ EXT

const EXT = 'ext'

Definition at line 53 of file class.action.php.

◆ GEN_SSL_CERTIFICATE

const GEN_SSL_CERTIFICATE = 'genSslCertificate'

Definition at line 33 of file class.action.php.

Referenced by TplAppTools\getActionGenSslCertificate().

◆ LAUNCH_STARTUP

const LAUNCH_STARTUP = 'launchStartup'

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

Referenced by TplAppLaunchStartup\getActionLaunchStartup().

◆ LOADING

const LOADING = 'loading'

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

Referenced by Util\startLoading().

◆ MANUAL_RESTART

const MANUAL_RESTART = 'manualRestart'

Definition at line 35 of file class.action.php.

◆ QUIT

const QUIT = 'quit'

Definition at line 37 of file class.action.php.

Referenced by TplAppExit\getActionExit().

◆ REBUILD_INI

const REBUILD_INI = 'rebuildIni'

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

Referenced by TplAppRebuildIni\process().

◆ REFRESH_REPOS

const REFRESH_REPOS = 'refreshRepos'

Definition at line 39 of file class.action.php.

Referenced by TplAppGit\getActionRefreshGitRepos().

◆ REFRESH_REPOS_STARTUP

const REFRESH_REPOS_STARTUP = 'refreshReposStartup'

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

Referenced by TplAppGit\getActionRefreshGitReposStartup().

◆ RELOAD

const RELOAD = 'reload'

Definition at line 41 of file class.action.php.

Referenced by TplAppReload\getActionReload(), and ActionExt\procRefresh().

◆ RESTART

const RESTART = 'restart'

Definition at line 42 of file class.action.php.

Referenced by Batch\exitApp().

◆ SERVICE

◆ STARTUP

const STARTUP = 'startup'

Definition at line 44 of file class.action.php.

Referenced by TplApp\getSectionStartupAction().

◆ SWITCH_APACHE_MODULE

const SWITCH_APACHE_MODULE = 'switchApacheModule'

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

Referenced by TplAppApache\getActionSwitchApacheModule().

◆ SWITCH_LANG

const SWITCH_LANG = 'switchLang'

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

Referenced by TplAppLang\getActionSwitchLang(), and TplAppLang\getMenuLang().

◆ SWITCH_LOGS_VERBOSE

const SWITCH_LOGS_VERBOSE = 'switchLogsVerbose'

◆ SWITCH_ONLINE

const SWITCH_ONLINE = 'switchOnline'

Definition at line 50 of file class.action.php.

Referenced by TplAppOnline\getActionStatus().

◆ SWITCH_PHP_EXTENSION

const SWITCH_PHP_EXTENSION = 'switchPhpExtension'

Definition at line 48 of file class.action.php.

Referenced by TplAppPhp\getActionSwitchPhpExtension().

◆ SWITCH_PHP_PARAM

const SWITCH_PHP_PARAM = 'switchPhpParam'

Definition at line 49 of file class.action.php.

Referenced by TplAppPhp\getActionSwitchPhpSetting().

◆ SWITCH_VERSION


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