Bearsampp 2026.9.23
Loading...
Searching...
No Matches
class.tool.bruno.php
Go to the documentation of this file.
1<?php
2/*
3 *
4 * * Copyright (c) 2021-2026 Bearsampp
5 * * License: GNU General Public License version 3 or later; see LICENSE.txt
6 * * Website: https://bearsampp.com
7 * * Github: https://github.com/Bearsampp
8 *
9 */
10
19class ToolBruno extends Module
20{
24 const ROOT_CFG_VERSION = 'brunoVersion';
25
29 const LOCAL_CFG_EXE = 'brunoExe';
30
36 private $exe;
37
47 public function __construct($id, $type)
48 {
49 Log::initClass($this);
50 $this->reload($id, $type);
51 }
52
63 public function reload($id = null, $type = null)
64 {
66 Log::reloadClass($this);
67
68 $this->name = $bearsamppLang->getValue(Lang::BRUNO);
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 }
75
76 if (!$this->enable) {
77 Log::info($this->name . ' is not enabled!');
78
79 return;
80 }
81 if (!is_dir($this->currentPath)) {
82 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
83 }
84 if (!is_dir($this->symlinkPath)) {
85 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
86
87 return;
88 }
89 if (!is_file($this->bearsamppConf)) {
90 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
91 }
92 if (!is_file($this->exe)) {
93 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
94 }
95 }
96
105 public function setVersion($version)
106 {
107 global $bearsamppConfig;
108 $this->version = $version;
109 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
110 $this->reload();
111 }
112
118 public function getExe()
119 {
120 return $this->exe;
121 }
122}
123
global $bearsamppLang
const BRUNO
const ERROR_EXE_NOT_FOUND
const ERROR_CONF_NOT_FOUND
const ERROR_FILE_NOT_FOUND
static info($data, $file=null)
static reloadClass($classInstance)
static error($data, $file=null)
static initClass($classInstance)
setVersion($version)
reload($id=null, $type=null)
const ROOT_CFG_VERSION
__construct($id, $type)
global $bearsamppConfig
Definition homepage.php:46