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

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 = 'yarnExe'
 
const ROOT_CFG_VERSION = 'yarnVersion'
 
- 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 ToolYarn

This class represents the Yarn tool module in the Bearsampp application. It extends the abstract Module class and provides specific functionalities for managing the Yarn tool, including version management and executable path handling.

Definition at line 17 of file class.tool.yarn.php.

Constructor & Destructor Documentation

◆ __construct()

ToolYarn::__construct ( $id,
$type )

Constructor for the ToolYarn class.

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

Definition at line 42 of file class.tool.yarn.php.

42 {
43 Util::logInitClass($this);
44 $this->reload($id, $type);
45 }
reload($id=null, $type=null)
static logInitClass($classInstance)

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

Member Function Documentation

◆ getExe()

ToolYarn::getExe ( )

Gets the path to the Yarn executable.

Returns
string The path to the Yarn executable.

Definition at line 101 of file class.tool.yarn.php.

101 {
102 return $this->exe;
103 }

References $exe.

◆ reload()

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

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

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 53 of file class.tool.yarn.php.

53 {
56
57 $this->name = $bearsamppLang->getValue(Lang::YARN);
58 $this->version = $bearsamppConfig->getRaw(self::ROOT_CFG_VERSION);
59 parent::reload($id, $type);
60
61 if ($this->bearsamppConfRaw !== false) {
62 $this->exe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
63 }
64
65 if (!$this->enable) {
66 Util::logInfo($this->name . ' is not enabled!');
67 return;
68 }
69 if (!is_dir($this->currentPath)) {
70 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
71 }
72 if (!is_dir($this->symlinkPath)) {
73 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
74 return;
75 }
76 if (!is_file($this->bearsamppConf)) {
77 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
78 }
79 if (!is_file($this->exe)) {
80 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
81 }
82 }
global $bearsamppLang
const ERROR_FILE_NOT_FOUND
const YARN
const ERROR_CONF_NOT_FOUND
const ERROR_EXE_NOT_FOUND
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\YARN.

Referenced by __construct(), and setVersion().

+ Here is the caller graph for this function:

◆ setVersion()

ToolYarn::setVersion ( $version)

Sets the version of the Yarn module and updates the configuration.

Parameters
string$versionThe version to set.

Reimplemented from Module.

Definition at line 89 of file class.tool.yarn.php.

89 {
90 global $bearsamppConfig;
91 $this->version = $version;
92 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
93 $this->reload();
94 }

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

Field Documentation

◆ $exe

ToolYarn::$exe
private

Definition at line 34 of file class.tool.yarn.php.

Referenced by getExe().

◆ LOCAL_CFG_EXE

const ToolYarn::LOCAL_CFG_EXE = 'yarnExe'

Configuration key for the Yarn executable in the local configuration.

Definition at line 27 of file class.tool.yarn.php.

Referenced by reload().

◆ ROOT_CFG_VERSION

const ToolYarn::ROOT_CFG_VERSION = 'yarnVersion'

Configuration key for the Yarn version in the root configuration.

Definition at line 22 of file class.tool.yarn.php.


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