2024.8.23
|
Public Member Functions | |
__construct ($id, $type) | |
getConf () | |
getExe () | |
getLaunch () | |
getNpm () | |
getVars () | |
reload ($id=null, $type=null) | |
setEnable ($enabled, $showWindow=false) | |
setVersion ($version) | |
switchVersion ($version, $showWindow=false) | |
Public Member Functions inherited from Module | |
__toString () | |
getCurrentPath () | |
getId () | |
getName () | |
getRelease () | |
getRootPath () | |
getSymlinkPath () | |
getType () | |
getVersion () | |
getVersionList () | |
isEnable () | |
update ($sub=0, $showWindow=false) | |
Data Fields | |
const | LOCAL_CFG_CONF = 'nodejsConf' |
const | LOCAL_CFG_EXE = 'nodejsExe' |
const | LOCAL_CFG_LAUNCH = 'nodejsLaunch' |
const | LOCAL_CFG_NPM = 'nodejsNpm' |
const | LOCAL_CFG_VARS = 'nodejsVars' |
const | ROOT_CFG_ENABLE = 'nodejsEnable' |
const | ROOT_CFG_VERSION = 'nodejsVersion' |
Data Fields inherited from Module | |
const | BUNDLE_RELEASE = 'bundleRelease' |
Protected Member Functions | |
updateConfig ($version=null, $sub=0, $showWindow=false) | |
Protected Member Functions inherited from Module | |
__construct () | |
replace ($key, $value) | |
replaceAll ($params) | |
Private Attributes | |
$conf | |
$exe | |
$launch | |
$npm | |
$vars | |
Additional Inherited Members | |
Protected Attributes inherited from Module | |
$bearsamppConf | |
$bearsamppConfRaw | |
$currentPath | |
$enable | |
$name | |
$release = 'N/A' | |
$rootPath | |
$symlinkPath | |
$version | |
Class BinNodejs
The BinNodejs
class extends the Module
class and provides functionalities specific to managing the Node.js module within the Bearsampp application. It includes methods for reloading the module configuration, switching versions, enabling/disabling the module, and retrieving various configuration paths such as the executable, configuration file, variables file, npm executable, and launch script.
Constants:
ROOT_CFG_ENABLE
: Configuration key for enabling the Node.js module.ROOT_CFG_VERSION
: Configuration key for the Node.js version.LOCAL_CFG_EXE
: Configuration key for the Node.js executable.LOCAL_CFG_VARS
: Configuration key for the Node.js variables.LOCAL_CFG_NPM
: Configuration key for the npm executable.LOCAL_CFG_LAUNCH
: Configuration key for the Node.js launch script.LOCAL_CFG_CONF
: Configuration key for the Node.js configuration file.Properties:
exe
: Path to the Node.js executable.conf
: Path to the Node.js configuration file.vars
: Path to the Node.js variables file.npm
: Path to the npm executable.launch
: Path to the Node.js launch script.Methods:
__construct($id, $type)
: Constructs a BinNodejs
object and initializes the module with the given ID and type.reload($id = null, $type = null)
: Reloads the module configuration based on the provided ID and type.switchVersion($version, $showWindow = false)
: Switches the Node.js version to the specified version.updateConfig($version = null, $sub = 0, $showWindow = false)
: Updates the module configuration with a specific version.setVersion($version)
: Sets the version of the module.setEnable($enabled, $showWindow = false)
: Enables or disables the module.getExe()
: Retrieves the executable path for Node.js.getConf()
: Retrieves the configuration file path for Node.js.getVars()
: Retrieves the variables file path for Node.js.getNpm()
: Retrieves the npm executable path for Node.js.getLaunch()
: Retrieves the launch script path for Node.js. Definition at line 48 of file class.bin.nodejs.php.
BinNodejs::__construct | ( | $id, | |
$type ) |
Constructs a BinNodejs object and initializes the module with the given ID and type.
string | $id | The ID of the module. |
string | $type | The type of the module. |
Definition at line 71 of file class.bin.nodejs.php.
References Module\$id, Module\$type, Util\logInitClass(), and reload().
BinNodejs::getConf | ( | ) |
Retrieves the configuration file path for Node.js.
Definition at line 248 of file class.bin.nodejs.php.
References $conf.
Referenced by updateConfig().
BinNodejs::getExe | ( | ) |
Retrieves the executable path for Node.js.
Definition at line 239 of file class.bin.nodejs.php.
References $exe.
BinNodejs::getLaunch | ( | ) |
Retrieves the launch script path for Node.js.
Definition at line 275 of file class.bin.nodejs.php.
References $launch.
BinNodejs::getNpm | ( | ) |
Retrieves the npm executable path for Node.js.
Definition at line 266 of file class.bin.nodejs.php.
References $npm.
BinNodejs::getVars | ( | ) |
Retrieves the variables file path for Node.js.
Definition at line 257 of file class.bin.nodejs.php.
References $vars.
BinNodejs::reload | ( | $id = null, | |
$type = null ) |
Reloads the module configuration based on the provided ID and type.
string | null | $id | The ID of the module. If null, the current ID is used. |
string | null | $type | The type of the module. If null, the current type is used. |
Reimplemented from Module.
Definition at line 82 of file class.bin.nodejs.php.
References $bearsamppConfig, $bearsamppLang, Module\$id, Module\$type, Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, LOCAL_CFG_CONF, LOCAL_CFG_EXE, LOCAL_CFG_LAUNCH, LOCAL_CFG_NPM, LOCAL_CFG_VARS, Util\logError(), Util\logInfo(), Util\logReloadClass(), and Lang\NODEJS.
Referenced by __construct(), and setVersion().
BinNodejs::setEnable | ( | $enabled, | |
$showWindow = false ) |
Enables or disables the module.
int | $enabled | The enable status (1 for enabled, 0 for disabled). |
bool | $showWindow | Whether to show a window during the enable/disable process. |
Definition at line 215 of file class.bin.nodejs.php.
References $bearsamppConfig, $bearsamppLang, Config\DISABLED, Lang\ENABLE_BUNDLE_NOT_EXIST, Lang\ENABLE_TITLE, Config\ENABLED, Module\getName(), Module\getVersion(), Util\logDebug(), and Util\logInfo().
BinNodejs::setVersion | ( | $version | ) |
Sets the version of the module.
string | $version | The version to set. |
Reimplemented from Module.
Definition at line 202 of file class.bin.nodejs.php.
References $bearsamppConfig, Module\$version, and reload().
Referenced by updateConfig().
BinNodejs::switchVersion | ( | $version, | |
$showWindow = false ) |
Switches the Node.js version to the specified version.
string | $version | The version to switch to. |
bool | $showWindow | Whether to show a window during the switch process. |
Definition at line 140 of file class.bin.nodejs.php.
References Module\$version, Util\logDebug(), and updateConfig().
|
protected |
Updates the module configuration with a specific version.
string | null | $version | The version to update to. If null, the current version is used. |
int | $sub | The sub-level for logging indentation. |
bool | $showWindow | Whether to show a window during the update process. |
Reimplemented from Module.
Definition at line 153 of file class.bin.nodejs.php.
References Module\$bearsamppConf, Module\$bearsamppConfRaw, $bearsamppLang, $conf, Module\$version, Lang\BEARSAMPP_CONF_MALFORMED_ERROR, Lang\BEARSAMPP_CONF_NOT_FOUND_ERROR, getConf(), Module\getName(), Module\getVersion(), Util\logDebug(), Util\logError(), setVersion(), and Lang\SWITCH_VERSION_TITLE.
Referenced by switchVersion().
|
private |
Definition at line 60 of file class.bin.nodejs.php.
Referenced by getConf(), and updateConfig().
|
private |
Definition at line 59 of file class.bin.nodejs.php.
Referenced by getExe().
|
private |
Definition at line 63 of file class.bin.nodejs.php.
Referenced by getLaunch().
|
private |
Definition at line 62 of file class.bin.nodejs.php.
Referenced by getNpm().
|
private |
Definition at line 61 of file class.bin.nodejs.php.
Referenced by getVars().
const BinNodejs::LOCAL_CFG_CONF = 'nodejsConf' |
Definition at line 57 of file class.bin.nodejs.php.
Referenced by reload().
const BinNodejs::LOCAL_CFG_EXE = 'nodejsExe' |
Definition at line 53 of file class.bin.nodejs.php.
Referenced by reload().
const BinNodejs::LOCAL_CFG_LAUNCH = 'nodejsLaunch' |
Definition at line 56 of file class.bin.nodejs.php.
Referenced by reload().
const BinNodejs::LOCAL_CFG_NPM = 'nodejsNpm' |
Definition at line 55 of file class.bin.nodejs.php.
Referenced by reload().
const BinNodejs::LOCAL_CFG_VARS = 'nodejsVars' |
Definition at line 54 of file class.bin.nodejs.php.
Referenced by reload().
const BinNodejs::ROOT_CFG_ENABLE = 'nodejsEnable' |
Definition at line 50 of file class.bin.nodejs.php.
const BinNodejs::ROOT_CFG_VERSION = 'nodejsVersion' |
Definition at line 51 of file class.bin.nodejs.php.