Bearsampp
2026.9.23
Toggle main menu visibility
Loading...
Searching...
No Matches
class.tool.composer.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
16
class
ToolComposer
extends
Module
17
{
21
const
ROOT_CFG_VERSION
=
'composerVersion'
;
22
26
const
LOCAL_CFG_EXE
=
'composerExe'
;
27
33
private
$exe
;
34
41
public
function
__construct
(
$id
,
$type
)
42
{
43
Log::initClass
($this);
44
$this->
reload
(
$id
,
$type
);
45
}
46
53
public
function
reload
(
$id
=
null
,
$type
=
null
)
54
{
55
global
$bearsamppConfig
,
$bearsamppLang
;
56
Log::reloadClass
($this);
57
58
$this->name =
$bearsamppLang
->getValue(
Lang::COMPOSER
);
59
$this->version =
$bearsamppConfig
->getRaw(self::ROOT_CFG_VERSION);
60
parent::reload(
$id
,
$type
);
61
62
if
($this->bearsamppConfRaw !==
false
) {
63
$this->exe = $this->symlinkPath .
'/'
. $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
64
}
65
66
if
(!$this->enable) {
67
Log::info
($this->name .
' is not enabled!'
);
68
69
return
;
70
}
71
if
(!is_dir($this->currentPath)) {
72
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->currentPath));
73
}
74
if
(!is_dir($this->symlinkPath)) {
75
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_FILE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->symlinkPath));
76
77
return
;
78
}
79
if
(!is_file($this->bearsamppConf)) {
80
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_CONF_NOT_FOUND
), $this->name .
' '
. $this->version, $this->bearsamppConf));
81
}
82
if
(!is_file($this->exe)) {
83
Log::error
(sprintf(
$bearsamppLang
->getValue(
Lang::ERROR_EXE_NOT_FOUND
), $this->name .
' '
. $this->version, $this->exe));
84
}
85
}
86
92
public
function
setVersion
(
$version
)
93
{
94
global
$bearsamppConfig
;
95
$this->version =
$version
;
96
$bearsamppConfig
->replace(self::ROOT_CFG_VERSION,
$version
);
97
$this->
reload
();
98
}
99
105
public
function
getExe
()
106
{
107
return
$this->exe
;
108
}
109
}
110
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
Lang\COMPOSER
const COMPOSER
Definition
class.lang.php:144
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
ToolComposer
Definition
class.tool.composer.php:17
ToolComposer\getExe
getExe()
Definition
class.tool.composer.php:105
ToolComposer\LOCAL_CFG_EXE
const LOCAL_CFG_EXE
Definition
class.tool.composer.php:26
ToolComposer\setVersion
setVersion($version)
Definition
class.tool.composer.php:92
ToolComposer\reload
reload($id=null, $type=null)
Definition
class.tool.composer.php:53
ToolComposer\ROOT_CFG_VERSION
const ROOT_CFG_VERSION
Definition
class.tool.composer.php:21
ToolComposer\__construct
__construct($id, $type)
Definition
class.tool.composer.php:41
ToolComposer\$exe
$exe
Definition
class.tool.composer.php:33
$bearsamppConfig
global $bearsamppConfig
Definition
homepage.php:46
sandbox
core
classes
tools
class.tool.composer.php
Generated by
1.17.0