Bearsampp 2025.8.29
Loading...
Searching...
No Matches
class.tool.bruno.php
Go to the documentation of this file.
1<?php
2/*
3 *
4 * * Copyright (c) 2021-2024 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 Util::logInitClass($this);
49 $this->reload($id, $type);
50 }
51
62 public function reload($id = null, $type = null) {
65
66 $this->name = $bearsamppLang->getValue(Lang::BRUNO);
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 }
73
74 if (!$this->enable) {
75 Util::logInfo($this->name . ' is not enabled!');
76 return;
77 }
78 if (!is_dir($this->currentPath)) {
79 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
80 }
81 if (!is_dir($this->symlinkPath)) {
82 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
83 return;
84 }
85 if (!is_file($this->bearsamppConf)) {
86 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
87 }
88 if (!is_file($this->exe)) {
89 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
90 }
91 }
92
101 public function setVersion($version) {
102 global $bearsamppConfig;
103 $this->version = $version;
104 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
105 $this->reload();
106 }
107
113 public function getExe() {
114 return $this->exe;
115 }
116}
global $bearsamppLang
const BRUNO
const ERROR_EXE_NOT_FOUND
const ERROR_CONF_NOT_FOUND
const ERROR_FILE_NOT_FOUND
setVersion($version)
reload($id=null, $type=null)
const ROOT_CFG_VERSION
__construct($id, $type)
static logError($data, $file=null)
static logInitClass($classInstance)
static logInfo($data, $file=null)
static logReloadClass($classInstance)
global $bearsamppConfig
Definition homepage.php:27