Bearsampp
2026.7.11
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-2024 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
Log::initClass
($this);
53
$this->
reload
(
$id
,
$type
);
54
}
55
62
public
function
reload
(
$id
=
null
,
$type
=
null
) {
63
global
$bearsamppConfig
,
$bearsamppLang
;
64
Log::reloadClass
($this);
65
66
$this->name =
$bearsamppLang
->getValue(
Lang::RUBY
);
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
$this->consoleExe = $this->symlinkPath .
'/'
. $this->bearsamppConfRaw[self::LOCAL_CFG_CONSOLE_EXE];
73
}
74
75
if
(!$this->enable) {
76
Log::info
($this->name .
' is not enabled!'
);
77
return
;
78
}
79
if
(!is_dir($this->currentPath)) {
80
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->currentPath));
81
}
82
if
(!is_dir($this->symlinkPath)) {
83
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->symlinkPath));
84
return
;
85
}
86
if
(!is_file($this->bearsamppConf)) {
87
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_CONF_NOT_FOUND
), $this->name .
' '
. $this->version, $this->bearsamppConf));
88
}
89
if
(!is_file($this->exe)) {
90
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_EXE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->exe));
91
}
92
if
(!is_file($this->consoleExe)) {
93
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_EXE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->consoleExe));
94
}
95
}
96
102
public
function
setVersion
(
$version
) {
103
global
$bearsamppConfig
;
104
$this->version =
$version
;
105
$bearsamppConfig
->replace(self::ROOT_CFG_VERSION,
$version
);
106
$this->
reload
();
107
}
108
114
public
function
getExe
() {
115
return
$this->exe
;
116
}
117
123
public
function
getConsoleExe
() {
124
return
$this->consoleExe
;
125
}
126
}
127
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
Lang\RUBY
const RUBY
Definition
class.lang.php:150
Lang\ERROR_EXE_NOT_FOUND
const ERROR_EXE_NOT_FOUND
Definition
class.lang.php:154
Lang\ERROR_CONF_NOT_FOUND
const ERROR_CONF_NOT_FOUND
Definition
class.lang.php:153
Lang\ERROR_FILE_NOT_FOUND
const ERROR_FILE_NOT_FOUND
Definition
class.lang.php:155
Log\info
static info($data, $file=null)
Definition
class.log.php:627
Log\reloadClass
static reloadClass($classInstance)
Definition
class.log.php:670
Log\error
static error($data, $file=null)
Definition
class.log.php:650
Log\initClass
static initClass($classInstance)
Definition
class.log.php:660
Module
Definition
class.module.php:15
Module\$version
$version
Definition
class.module.php:24
Module\$type
$type
Definition
class.module.php:20
Module\$id
$id
Definition
class.module.php:21
ToolRuby
Definition
class.tool.ruby.php:19
ToolRuby\getExe
getExe()
Definition
class.tool.ruby.php:114
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:102
ToolRuby\reload
reload($id=null, $type=null)
Definition
class.tool.ruby.php:62
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:123
$bearsamppConfig
global $bearsamppConfig
Definition
homepage.php:41
sandbox
core
classes
tools
class.tool.ruby.php
Generated by
1.17.0