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

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 = 'ngrokExe'
 
const ROOT_CFG_VERSION = 'ngrokVersion'
 
- 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 ToolNgrok

This class represents the Ngrok tool module in the Bearsampp application. It extends the Module class and provides functionalities specific to Ngrok, such as loading configurations, setting versions, and retrieving executable paths.

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

Constructor & Destructor Documentation

◆ __construct()

ToolNgrok::__construct ( $id,
$type )

Constructor for the ToolNgrok class.

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

Definition at line 40 of file class.tool.ngrok.php.

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

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

Member Function Documentation

◆ getExe()

ToolNgrok::getExe ( )

Gets the path to the Ngrok executable.

Returns
string The path to the Ngrok executable.

Definition at line 99 of file class.tool.ngrok.php.

99 {
100 return $this->exe;
101 }

References $exe.

◆ reload()

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

Reloads the Ngrok 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 51 of file class.tool.ngrok.php.

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

Referenced by __construct(), and setVersion().

+ Here is the caller graph for this function:

◆ setVersion()

ToolNgrok::setVersion ( $version)

Sets the version of the Ngrok module and reloads the configuration.

Parameters
string$versionThe version to set.

Reimplemented from Module.

Definition at line 87 of file class.tool.ngrok.php.

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

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

Field Documentation

◆ $exe

ToolNgrok::$exe
private

Definition at line 32 of file class.tool.ngrok.php.

Referenced by getExe().

◆ LOCAL_CFG_EXE

const ToolNgrok::LOCAL_CFG_EXE = 'ngrokExe'

Configuration key for the Ngrok executable in the local configuration.

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

Referenced by reload().

◆ ROOT_CFG_VERSION

const ToolNgrok::ROOT_CFG_VERSION = 'ngrokVersion'

Configuration key for the Ngrok version in the root configuration.

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


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