Bearsampp
2026.9.23
Toggle main menu visibility
Loading...
Searching...
No Matches
class.tool.ruby.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2026 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: Bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
18
class
ToolRuby
extends
Module
19
{
23
const
ROOT_CFG_VERSION
=
'rubyVersion'
;
24
28
const
LOCAL_CFG_EXE
=
'rubyExe'
;
29
33
const
LOCAL_CFG_CONSOLE_EXE
=
'rubyConsoleExe'
;
34
38
private
$exe
;
39
43
private
$consoleExe
;
44
51
public
function
__construct
(
$id
,
$type
)
52
{
53
Log::initClass
($this);
54
$this->
reload
(
$id
,
$type
);
55
}
56
63
public
function
reload
(
$id
=
null
,
$type
=
null
)
64
{
65
global
$bearsamppConfig
,
$bearsamppLang
;
66
Log::reloadClass
($this);
67
68
$this->name =
$bearsamppLang
->getValue(
Lang::RUBY
);
69
$this->version =
$bearsamppConfig
->getRaw(self::ROOT_CFG_VERSION);
70
parent::reload(
$id
,
$type
);
71
72
if
($this->bearsamppConfRaw !==
false
) {
73
$this->exe = $this->symlinkPath .
'/'
. $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
74
$this->consoleExe = $this->symlinkPath .
'/'
. $this->bearsamppConfRaw[self::LOCAL_CFG_CONSOLE_EXE];
75
}
76
77
if
(!$this->enable) {
78
Log::info
($this->name .
' is not enabled!'
);
79
80
return
;
81
}
82
if
(!is_dir($this->currentPath)) {
83
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->currentPath));
84
}
85
if
(!is_dir($this->symlinkPath)) {
86
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->symlinkPath));
87
88
return
;
89
}
90
if
(!is_file($this->bearsamppConf)) {
91
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_CONF_NOT_FOUND
), $this->name .
' '
. $this->version, $this->bearsamppConf));
92
}
93
if
(!is_file($this->exe)) {
94
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_EXE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->exe));
95
}
96
if
(!is_file($this->consoleExe)) {
97
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_EXE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->consoleExe));
98
}
99
}
100
106
public
function
setVersion
(
$version
)
107
{
108
global
$bearsamppConfig
;
109
$this->version =
$version
;
110
$bearsamppConfig
->replace(self::ROOT_CFG_VERSION,
$version
);
111
$this->
reload
();
112
}
113
119
public
function
getExe
()
120
{
121
return
$this->exe
;
122
}
123
129
public
function
getConsoleExe
()
130
{
131
return
$this->consoleExe
;
132
}
133
}
134
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
Lang\RUBY
const RUBY
Definition
class.lang.php:151
Lang\ERROR_EXE_NOT_FOUND
const ERROR_EXE_NOT_FOUND
Definition
class.lang.php:155
Lang\ERROR_CONF_NOT_FOUND
const ERROR_CONF_NOT_FOUND
Definition
class.lang.php:154
Lang\ERROR_FILE_NOT_FOUND
const ERROR_FILE_NOT_FOUND
Definition
class.lang.php:156
Log\info
static info($data, $file=null)
Definition
class.log.php:737
Log\reloadClass
static reloadClass($classInstance)
Definition
class.log.php:805
Log\error
static error($data, $file=null)
Definition
class.log.php:760
Log\initClass
static initClass($classInstance)
Definition
class.log.php:784
Module
Definition
class.module.php:15
Module\$version
$version
Definition
class.module.php:29
Module\$type
$type
Definition
class.module.php:20
Module\$id
$id
Definition
class.module.php:23
ToolRuby
Definition
class.tool.ruby.php:19
ToolRuby\getExe
getExe()
Definition
class.tool.ruby.php:119
ToolRuby\LOCAL_CFG_EXE
const LOCAL_CFG_EXE
Definition
class.tool.ruby.php:28
ToolRuby\LOCAL_CFG_CONSOLE_EXE
const LOCAL_CFG_CONSOLE_EXE
Definition
class.tool.ruby.php:33
ToolRuby\setVersion
setVersion($version)
Definition
class.tool.ruby.php:106
ToolRuby\reload
reload($id=null, $type=null)
Definition
class.tool.ruby.php:63
ToolRuby\ROOT_CFG_VERSION
const ROOT_CFG_VERSION
Definition
class.tool.ruby.php:23
ToolRuby\__construct
__construct($id, $type)
Definition
class.tool.ruby.php:51
ToolRuby\$consoleExe
$consoleExe
Definition
class.tool.ruby.php:43
ToolRuby\$exe
$exe
Definition
class.tool.ruby.php:38
ToolRuby\getConsoleExe
getConsoleExe()
Definition
class.tool.ruby.php:129
$bearsamppConfig
global $bearsamppConfig
Definition
homepage.php:46
sandbox
core
classes
tools
class.tool.ruby.php
Generated by
1.17.0