Bearsampp 2025.8.29
Loading...
Searching...
No Matches
ToolBruno Class Reference
Inheritance diagram for ToolBruno:

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 = 'brunoExe'
const ROOT_CFG_VERSION = 'brunoVersion'
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 ToolBruno

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

Definition at line 19 of file class.tool.bruno.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $id,
$type )

Constructor for the ToolBruno class.

Initializes the ToolBruno 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 47 of file class.tool.bruno.php.

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

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

Member Function Documentation

◆ getExe()

getExe ( )

Gets the path to the Bruno executable.

Returns
string The path to the Bruno executable.

Definition at line 113 of file class.tool.bruno.php.

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

References $exe.

◆ reload()

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 Bruno 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 62 of file class.tool.bruno.php.

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

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

Referenced by __construct(), and setVersion().

◆ setVersion()

setVersion ( $version)

Sets the version of the Bruno IDE 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 101 of file class.tool.bruno.php.

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

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

Field Documentation

◆ $exe

$exe
private

Definition at line 36 of file class.tool.bruno.php.

Referenced by getExe().

◆ LOCAL_CFG_EXE

const LOCAL_CFG_EXE = 'brunoExe'

Configuration key for the Bruno executable in the local configuration.

Definition at line 29 of file class.tool.bruno.php.

◆ ROOT_CFG_VERSION

const ROOT_CFG_VERSION = 'brunoVersion'

Configuration key for the Bruno version in the root configuration.

Definition at line 24 of file class.tool.bruno.php.


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