2024.8.23
Loading...
Searching...
No Matches
ToolXdc Class Reference
+ Inheritance diagram for ToolXdc:
+ Collaboration diagram for ToolXdc:

Public Member Functions

 __construct ($id, $type)
 
 getExe ()
 
 reload ($id=null, $type=null)
 
 setVersion ($version)
 
- 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_EXE = 'xdcExe'
 
const ROOT_CFG_VERSION = 'xdcVersion'
 
- Data Fields inherited from Module
const BUNDLE_RELEASE = 'bundleRelease'
 

Private Attributes

 $exe
 

Additional Inherited Members

- Protected Member Functions inherited from Module
 __construct ()
 
 replace ($key, $value)
 
 replaceAll ($params)
 
 updateConfig ($version=null, $sub=0, $showWindow=false)
 
- Protected Attributes inherited from Module
 $bearsamppConf
 
 $bearsamppConfRaw
 
 $currentPath
 
 $enable
 
 $name
 
 $release = 'N/A'
 
 $rootPath
 
 $symlinkPath
 
 $version
 

Detailed Description

Class ToolXdc

This class represents the XDC tool module in the Bearsampp application. It extends the abstract Module class and provides specific functionalities for managing the XDC tool, including loading configurations, setting versions, and retrieving the executable path.

Definition at line 18 of file class.tool.xdc.php.

Constructor & Destructor Documentation

◆ __construct()

ToolXdc::__construct ( $id,
$type )

Constructor for the ToolXdc class.

Initializes the ToolXdc instance by logging the initialization and reloading the module configuration with the provided ID and type.

Parameters
string$idThe ID of the module.
string$typeThe type of the module.

Definition at line 46 of file class.tool.xdc.php.

46 {
47 Util::logInitClass($this);
48 $this->reload($id, $type);
49 }
reload($id=null, $type=null)
static logInitClass($classInstance)

References Module\$id, Module\$type, Util\logInitClass(), and reload().

Member Function Documentation

◆ getExe()

ToolXdc::getExe ( )

Gets the path to the XDC executable.

Returns
string The path to the XDC executable.

Definition at line 112 of file class.tool.xdc.php.

112 {
113 return $this->exe;
114 }

References $exe.

◆ reload()

ToolXdc::reload ( $id = null,
$type = null )

Reloads the module configuration based on the provided ID and type.

This method overrides the parent reload method to include additional configurations specific to the XDC tool. It sets the name, version, and executable path, and logs errors if the module is not properly configured.

Parameters
string | null$idThe ID of the module. If null, the current ID is used.
string | null$typeThe type of the module. If null, the current type is used.

Reimplemented from Module.

Definition at line 61 of file class.tool.xdc.php.

61 {
64
65 $this->name = $bearsamppLang->getValue(Lang::XDC);
66 $this->version = $bearsamppConfig->getRaw(self::ROOT_CFG_VERSION);
67 parent::reload($id, $type);
68
69 if ($this->bearsamppConfRaw !== false) {
70 $this->exe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
71 }
72
73 if (!$this->enable) {
74 Util::logInfo($this->name . ' is not enabled!');
75 return;
76 }
77 if (!is_dir($this->currentPath)) {
78 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
79 }
80 if (!is_dir($this->symlinkPath)) {
81 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
82 return;
83 }
84 if (!is_file($this->bearsamppConf)) {
85 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
86 }
87 if (!is_file($this->exe)) {
88 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
89 }
90 }
global $bearsamppLang
const ERROR_FILE_NOT_FOUND
const ERROR_CONF_NOT_FOUND
const ERROR_EXE_NOT_FOUND
const XDC
const LOCAL_CFG_EXE
static logReloadClass($classInstance)
static logError($data, $file=null)
static logInfo($data, $file=null)
global $bearsamppConfig
Definition homepage.php:26

References $bearsamppConfig, $bearsamppLang, Module\$id, Module\$type, Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, LOCAL_CFG_EXE, Util\logError(), Util\logInfo(), Util\logReloadClass(), and Lang\XDC.

Referenced by __construct(), and setVersion().

+ Here is the caller graph for this function:

◆ setVersion()

ToolXdc::setVersion ( $version)

Sets the version of the XDC tool.

This method updates the version in the configuration and reloads the module to apply the new version.

Parameters
string$versionThe version to set.

Reimplemented from Module.

Definition at line 100 of file class.tool.xdc.php.

100 {
101 global $bearsamppConfig;
102 $this->version = $version;
103 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
104 $this->reload();
105 }

References $bearsamppConfig, Module\$version, and reload().

Field Documentation

◆ $exe

ToolXdc::$exe
private

Definition at line 35 of file class.tool.xdc.php.

Referenced by getExe().

◆ LOCAL_CFG_EXE

const ToolXdc::LOCAL_CFG_EXE = 'xdcExe'

Configuration key for the XDC executable in the local configuration.

Definition at line 28 of file class.tool.xdc.php.

Referenced by reload().

◆ ROOT_CFG_VERSION

const ToolXdc::ROOT_CFG_VERSION = 'xdcVersion'

Configuration key for the XDC version in the root configuration.

Definition at line 23 of file class.tool.xdc.php.


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