2024.8.23
Loading...
Searching...
No Matches
class.bin.mariadb.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
10/**
11 * Class BinMariadb
12 *
13 * This class represents the MariaDB module in the Bearsampp application.
14 * It handles the configuration, management, and operations related to MariaDB.
15 */
16class BinMariadb extends Module
17{
18 const SERVICE_NAME = 'bearsamppmariadb';
19
20 const ROOT_CFG_ENABLE = 'mariadbEnable';
21 const ROOT_CFG_VERSION = 'mariadbVersion';
22
23 const LOCAL_CFG_EXE = 'mariadbExe';
24 const LOCAL_CFG_CLI_EXE = 'mariadbCliExe';
25 const LOCAL_CFG_ADMIN = 'mariadbAdmin';
26 const LOCAL_CFG_CONF = 'mariadbConf';
27 const LOCAL_CFG_PORT = 'mariadbPort';
28 const LOCAL_CFG_ROOT_USER = 'mariadbRootUser';
29 const LOCAL_CFG_ROOT_PWD = 'mariadbRootPwd';
30
31 const CMD_VERSION = '--version';
32 const CMD_VARIABLES = 'variables';
33 const CMD_SYNTAX_CHECK = '--help --verbose 1>NUL';
34
35 private $service;
36 private $errorLog;
37
38 private $exe;
39 private $conf;
40 private $port;
41 private $rootUser;
42 private $rootPwd;
43 private $cliExe;
44 private $admin;
45
46 /**
47 * Constructs a BinMariadb object and initializes the module.
48 *
49 * @param string $id The ID of the module.
50 * @param string $type The type of the module.
51 */
52 public function __construct($id, $type)
53 {
54 Util::logInitClass( $this );
55 $this->reload( $id, $type );
56 }
57
58 /**
59 * Reloads the module configuration based on the provided ID and type.
60 *
61 * @param string|null $id The ID of the module. If null, the current ID is used.
62 * @param string|null $type The type of the module. If null, the current type is used.
63 */
64 public function reload($id = null, $type = null)
65 {
67 Util::logReloadClass( $this );
68
69 $this->name = $bearsamppLang->getValue( Lang::MARIADB );
70 $this->version = $bearsamppConfig->getRaw( self::ROOT_CFG_VERSION );
71 parent::reload( $id, $type );
72
73 $this->enable = $this->enable && $bearsamppConfig->getRaw( self::ROOT_CFG_ENABLE );
74 $this->service = new Win32Service( self::SERVICE_NAME );
75 $this->errorLog = $bearsamppRoot->getLogsPath() . '/mariadb.log';
76
77 if ( $this->bearsamppConfRaw !== false ) {
78 $this->exe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
79 $this->conf = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_CONF];
80 $this->port = $this->bearsamppConfRaw[self::LOCAL_CFG_PORT];
81 $this->rootUser = isset( $this->bearsamppConfRaw[self::LOCAL_CFG_ROOT_USER] ) ? $this->bearsamppConfRaw[self::LOCAL_CFG_ROOT_USER] : 'root';
82 $this->rootPwd = isset( $this->bearsamppConfRaw[self::LOCAL_CFG_ROOT_PWD] ) ? $this->bearsamppConfRaw[self::LOCAL_CFG_ROOT_PWD] : '';
83 $this->cliExe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_CLI_EXE];
84 $this->admin = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_ADMIN];
85 }
86
87 if ( !$this->enable ) {
88 Util::logInfo( $this->name . ' is not enabled!' );
89
90 return;
91 }
92 if ( !is_dir( $this->currentPath ) ) {
93 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_FILE_NOT_FOUND ), $this->name . ' ' . $this->version, $this->currentPath ) );
94
95 return;
96 }
97 if ( !is_dir( $this->symlinkPath ) ) {
98 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_FILE_NOT_FOUND ), $this->name . ' ' . $this->version, $this->symlinkPath ) );
99
100 return;
101 }
102 if ( !is_file( $this->bearsamppConf ) ) {
103 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_CONF_NOT_FOUND ), $this->name . ' ' . $this->version, $this->bearsamppConf ) );
104
105 return;
106 }
107 if ( !is_file( $this->exe ) ) {
108 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_EXE_NOT_FOUND ), $this->name . ' ' . $this->version, $this->exe ) );
109
110 return;
111 }
112 if ( !is_file( $this->conf ) ) {
113 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_CONF_NOT_FOUND ), $this->name . ' ' . $this->version, $this->conf ) );
114
115 return;
116 }
117 if ( !is_numeric( $this->port ) || $this->port <= 0 ) {
118 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_INVALID_PARAMETER ), self::LOCAL_CFG_PORT, $this->port ) );
119
120 return;
121 }
122 if ( empty( $this->rootUser ) ) {
123 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_INVALID_PARAMETER ), self::LOCAL_CFG_ROOT_USER, $this->rootUser ) );
124
125 return;
126 }
127 if ( !is_file( $this->cliExe ) ) {
128 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_EXE_NOT_FOUND ), $this->name . ' ' . $this->version, $this->cliExe ) );
129
130 return;
131 }
132 if ( !is_file( $this->admin ) ) {
133 Util::logError( sprintf( $bearsamppLang->getValue( Lang::ERROR_EXE_NOT_FOUND ), $this->name . ' ' . $this->version, $this->admin ) );
134
135 return;
136 }
137
138 $this->service->setDisplayName( APP_TITLE . ' ' . $this->getName() );
139 $this->service->setBinPath( $this->exe );
140 $this->service->setParams( self::SERVICE_NAME );
141 $this->service->setStartType( Win32Service::SERVICE_DEMAND_START );
142 $this->service->setErrorControl( Win32Service::SERVER_ERROR_NORMAL );
143 }
144
145 /**
146 * Replaces multiple key-value pairs in the configuration file.
147 *
148 * @param array $params An associative array of key-value pairs to replace.
149 */
150 protected function replaceAll($params)
151 {
152 $content = file_get_contents( $this->bearsamppConf );
153
154 foreach ( $params as $key => $value ) {
155 $content = preg_replace( '|' . $key . ' = .*|', $key . ' = ' . '"' . $value . '"', $content );
156 $this->bearsamppConfRaw[$key] = $value;
157 switch ( $key ) {
159 $this->port = $value;
160 break;
162 $this->rootUser = $value;
163 break;
165 $this->rootPwd = $value;
166 break;
167 }
168 }
169
170 file_put_contents( $this->bearsamppConf, $content );
171 }
172
173 /**
174 * Changes the port for MariaDB.
175 *
176 * @param int $port The new port number.
177 * @param bool $checkUsed Whether to check if the port is already in use.
178 * @param mixed $wbProgressBar The progress bar object for UI updates.
179 *
180 * @return bool|string True if the port was changed successfully, or the process using the port if it is in use.
181 */
182 public function changePort($port, $checkUsed = false, $wbProgressBar = null)
183 {
184 global $bearsamppWinbinder;
185
186 if ( !Util::isValidPort( $port ) ) {
187 Util::logError( $this->getName() . ' port not valid: ' . $port );
188
189 return false;
190 }
191
192 $port = intval( $port );
193 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
194
195 $isPortInUse = Util::isPortInUse( $port );
196 if ( !$checkUsed || $isPortInUse === false ) {
197 // bearsampp.conf
198 $this->setPort( $port );
199 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
200
201 // conf
202 $this->update();
203 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
204
205 return true;
206 }
207
208 Util::logDebug( $this->getName() . ' port in used: ' . $port . ' - ' . $isPortInUse );
209
210 return $isPortInUse;
211 }
212
213 /**
214 * Checks if the specified port is used by MariaDB.
215 *
216 * @param int $port The port number to check.
217 * @param bool $showWindow Whether to show a window with the result.
218 *
219 * @return bool True if the port is used by MariaDB, false otherwise.
220 */
221 public function checkPort($port, $showWindow = false)
222 {
223 global $bearsamppLang, $bearsamppWinbinder;
224 $boxTitle = sprintf( $bearsamppLang->getValue( Lang::CHECK_PORT_TITLE ), $this->getName(), $port );
225
226 if ( !Util::isValidPort( $port ) ) {
227 Util::logError( $this->getName() . ' port not valid: ' . $port );
228
229 return false;
230 }
231
232 $fp = @fsockopen( '127.0.0.1', $port, $errno, $errstr, 5 );
233 if ( $fp ) {
234 if ( version_compare( phpversion(), '5.3' ) === -1 ) {
235 $dbLink = mysqli_connect( '127.0.0.1', $this->rootUser, $this->rootPwd, '', $port );
236 }
237 else {
238 $dbLink = mysqli_connect( '127.0.0.1:' . $port, $this->rootUser, $this->rootPwd );
239 }
240 $isMariadb = false;
241 $version = false;
242
243 if ( $dbLink ) {
244 $result = mysqli_query( $dbLink, 'SHOW VARIABLES' );
245 if ( $result ) {
246 while ( false !== ($row = mysqli_fetch_array( $result, MYSQLI_NUM )) ) {
247 if ( $row[0] == 'version' ) {
248 $version = explode( '-', $row[1] );
249 $version = count( $version ) > 1 ? $version[0] : $row[1];
250 }
251 if ( $row[0] == 'version_comment' && Util::startWith( strtolower( $row[1] ), 'mariadb' ) ) {
252 $isMariadb = true;
253 }
254 if ( $isMariadb && $version !== false ) {
255 break;
256 }
257 }
258 if ( !$isMariadb ) {
259 Util::logDebug( $this->getName() . ' port used by another DBMS: ' . $port );
260 if ( $showWindow ) {
261 $bearsamppWinbinder->messageBoxWarning(
263 $boxTitle
264 );
265 }
266 }
267 else {
268 Util::logDebug( $this->getName() . ' port ' . $port . ' is used by: ' . $this->getName() . ' ' . $version );
269 if ( $showWindow ) {
270 $bearsamppWinbinder->messageBoxInfo(
271 sprintf( $bearsamppLang->getValue( Lang::PORT_USED_BY ), $port, $this->getName() . ' ' . $version ),
272 $boxTitle
273 );
274 }
275
276 return true;
277 }
278 }
279 mysqli_close( $dbLink );
280 }
281 else {
282 Util::logDebug( $this->getName() . ' port ' . $port . ' is used by another application' );
283 if ( $showWindow ) {
284 $bearsamppWinbinder->messageBoxWarning(
285 sprintf( $bearsamppLang->getValue( Lang::PORT_NOT_USED_BY ), $port ),
286 $boxTitle
287 );
288 }
289 }
290 }
291 else {
292 Util::logDebug( $this->getName() . ' port ' . $port . ' is not used' );
293 if ( $showWindow ) {
294 $bearsamppWinbinder->messageBoxError(
295 sprintf( $bearsamppLang->getValue( Lang::PORT_NOT_USED ), $port ),
296 $boxTitle
297 );
298 }
299 }
300
301 return false;
302 }
303
304 /**
305 * Changes the root password for MariaDB.
306 *
307 * @param string $currentPwd The current root password.
308 * @param string $newPwd The new root password.
309 * @param mixed $wbProgressBar The progress bar object for UI updates.
310 *
311 * @return bool|string True if the password was changed successfully, or an error message if it failed.
312 */
313 public function changeRootPassword($currentPwd, $newPwd, $wbProgressBar = null)
314 {
315 global $bearsamppWinbinder;
316 $error = null;
317
318 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
319 if ( version_compare( phpversion(), '5.3' ) === -1 ) {
320 $dbLink = @mysqli_connect( '127.0.0.1', $this->rootUser, $currentPwd, '', $this->port );
321 }
322 else {
323 $dbLink = @mysqli_connect( '127.0.0.1:' . $this->port, $this->rootUser, $currentPwd );
324 }
325 if ( !$dbLink ) {
326 $error = mysqli_connect_error();
327 }
328
329 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
330 $stmt = @mysqli_prepare( $dbLink, 'UPDATE mysql.user SET Password=PASSWORD(?) WHERE User=?' );
331 if ( empty( $error ) && $stmt === false ) {
332 $error = mysqli_error( $dbLink );
333 }
334
335 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
336 if ( empty( $error ) && !@mysqli_stmt_bind_param( $stmt, 'ss', $newPwd, $this->rootUser ) ) {
337 $error = mysqli_stmt_error( $stmt );
338 }
339
340 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
341 if ( empty( $error ) && !@mysqli_stmt_execute( $stmt ) ) {
342 $error = mysqli_stmt_error( $stmt );
343 }
344
345 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
346 if ( $stmt !== false ) {
347 mysqli_stmt_close( $stmt );
348 }
349
350 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
351 if ( empty( $error ) && @mysqli_query( $dbLink, 'FLUSH PRIVILEGES' ) === false ) {
352 $error = mysqli_error( $dbLink );
353 }
354
355 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
356 if ( $dbLink ) {
357 mysqli_close( $dbLink );
358 }
359
360 if ( !empty( $error ) ) {
361 return $error;
362 }
363
364 // bearsampp.conf
365 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
366 $this->setRootPwd( $newPwd );
367
368 // conf
369 $this->update();
370 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
371
372 return true;
373 }
374
375 /**
376 * Checks if the provided root password is correct.
377 *
378 * @param string|null $currentPwd The current root password. If null, the stored root password is used.
379 * @param mixed $wbProgressBar The progress bar object for UI updates.
380 *
381 * @return bool|string True if the password is correct, or an error message if it is incorrect.
382 */
383 public function checkRootPassword($currentPwd = null, $wbProgressBar = null)
384 {
385 global $bearsamppWinbinder;
386 $currentPwd = $currentPwd == null ? $this->rootPwd : $currentPwd;
387 $error = null;
388
389 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
390 if ( version_compare( phpversion(), '5.3' ) === -1 ) {
391 $dbLink = @mysqli_connect( '127.0.0.1', $this->rootUser, $currentPwd, '', $this->port );
392 }
393 else {
394 $dbLink = @mysqli_connect( '127.0.0.1:' . $this->port, $this->rootUser, $currentPwd );
395 }
396 if ( !$dbLink ) {
397 $error = mysqli_connect_error();
398 }
399
400 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
401 if ( $dbLink ) {
402 mysqli_close( $dbLink );
403 }
404
405 if ( !empty( $error ) ) {
406 return $error;
407 }
408
409 return true;
410 }
411
412 /**
413 * Switches the version of MariaDB.
414 *
415 * @param string $version The version to switch to.
416 * @param bool $showWindow Whether to show a window with the result.
417 *
418 * @return bool True if the version was switched successfully, false otherwise.
419 */
420 public function switchVersion($version, $showWindow = false)
421 {
422 Util::logDebug( 'Switch ' . $this->name . ' version to ' . $version );
423
424 return $this->updateConfig( $version, 0, $showWindow );
425 }
426
427 /**
428 * Updates the configuration for the specified version.
429 *
430 * @param string|null $version The version to update to. If null, the current version is used.
431 * @param int $sub The sub-level for logging indentation.
432 * @param bool $showWindow Whether to show a window with the result.
433 *
434 * @return bool True if the configuration was updated successfully, false otherwise.
435 */
436 protected function updateConfig($version = null, $sub = 0, $showWindow = false) {
437 global $bearsamppLang, $bearsamppApps, $bearsamppWinbinder;
438
439 if (!$this->enable) {
440 return true;
441 }
442
443 $version = $version == null ? $this->version : $version;
444 Util::logDebug(($sub > 0 ? str_repeat(' ', 2 * $sub) : '') . 'Update ' . $this->name . ' ' . $version . ' config');
445
446 $boxTitle = sprintf($bearsamppLang->getValue(Lang::SWITCH_VERSION_TITLE), $this->getName(), $version);
447
448 $conf = str_replace('mariadb' . $this->getVersion(), 'mariadb' . $version, $this->getConf());
449 $bearsamppConf = str_replace('mariadb' . $this->getVersion(), 'mariadb' . $version, $this->bearsamppConf);
450
451 if (!file_exists($conf) || !file_exists($bearsamppConf)) {
452 Util::logError('bearsampp config files not found for ' . $this->getName() . ' ' . $version);
453 if ($showWindow) {
454 $bearsamppWinbinder->messageBoxError(
455 sprintf($bearsamppLang->getValue(Lang::BEARSAMPP_CONF_NOT_FOUND_ERROR), $this->getName() . ' ' . $version),
456 $boxTitle
457 );
458 }
459 return false;
460 }
461
462 $bearsamppConfRaw = parse_ini_file($bearsamppConf);
463 if ($bearsamppConfRaw === false || !isset($bearsamppConfRaw[self::ROOT_CFG_VERSION]) || $bearsamppConfRaw[self::ROOT_CFG_VERSION] != $version) {
464 Util::logError('bearsampp config file malformed for ' . $this->getName() . ' ' . $version);
465 if ($showWindow) {
466 $bearsamppWinbinder->messageBoxError(
467 sprintf($bearsamppLang->getValue(Lang::BEARSAMPP_CONF_MALFORMED_ERROR), $this->getName() . ' ' . $version),
468 $boxTitle
469 );
470 }
471 return false;
472 }
473
474 // bearsampp.conf
475 $this->setVersion($version);
476
477 // conf
478 Util::replaceInFile($this->getConf(), array(
479 '/^port(.*?)=(.*?)(\d+)/' => 'port = ' . $this->port
480 ));
481
482 // phpmyadmin
483 $bearsamppApps->getPhpmyadmin()->update($sub + 1);
484
485 // adminer
486 $bearsamppApps->getAdminer()->update($sub + 1);
487
488 return true;
489 }
490/**
491 * Retrieves the command line output for a given command.
492 *
493 * @param string $cmd The command to execute.
494 * @return array An associative array containing:
495 * - 'syntaxOk' (bool): Whether the command executed without syntax errors.
496 * - 'content' (string|null): The output content of the command.
497 */
498public function getCmdLineOutput($cmd) {
499 $result = array(
500 'syntaxOk' => false,
501 'content' => null,
502 );
503
504 $bin = $this->getExe();
505 $removeLines = 0;
506 $outputFrom = '';
507 if ($cmd == self::CMD_SYNTAX_CHECK) {
508 $outputFrom = '2';
509 } elseif ($cmd == self::CMD_VARIABLES) {
510 $bin = $this->getAdmin();
511 $cmd .= ' --user=' . $this->getRootUser();
512 if ($this->getRootPwd()) {
513 $cmd .= ' --password=' . $this->getRootPwd();
514 }
515 $removeLines = 2;
516 }
517
518 if (file_exists($bin)) {
519 $tmpResult = Batch::exec('mariadbGetCmdLineOutput', '"' . $bin . '" ' . $cmd . ' ' . $outputFrom, 5);
520 if ($tmpResult !== false && is_array($tmpResult)) {
521 $result['syntaxOk'] = empty($tmpResult) || !Util::contains(trim($tmpResult[count($tmpResult) - 1]), '[ERROR]');
522 for ($i = 0; $i < $removeLines; $i++) {
523 unset($tmpResult[$i]);
524 }
525 $result['content'] = trim(str_replace($bin, '', implode(PHP_EOL, $tmpResult)));
526 }
527 }
528
529 return $result;
530}
531
532/**
533 * Sets the version of the module.
534 *
535 * @param string $version The version to set.
536 */
537public function setVersion($version) {
538 global $bearsamppConfig;
539 $this->version = $version;
540 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
541 $this->reload();
542}
543
544/**
545 * Retrieves the service associated with the module.
546 *
547 * @return Win32Service The service object.
548 */
549public function getService() {
550 return $this->service;
551}
552
553/**
554 * Enables or disables the module.
555 *
556 * @param bool $enabled Whether to enable or disable the module.
557 * @param bool $showWindow Whether to show a window with the result.
558 */
559public function setEnable($enabled, $showWindow = false) {
560 global $bearsamppConfig, $bearsamppLang, $bearsamppWinbinder;
561
562 if ($enabled == Config::ENABLED && !is_dir($this->currentPath)) {
563 Util::logDebug($this->getName() . ' cannot be enabled because bundle ' . $this->getVersion() . ' does not exist in ' . $this->currentPath);
564 if ($showWindow) {
565 $bearsamppWinbinder->messageBoxError(
566 sprintf($bearsamppLang->getValue(Lang::ENABLE_BUNDLE_NOT_EXIST), $this->getName(), $this->getVersion(), $this->currentPath),
567 sprintf($bearsamppLang->getValue(Lang::ENABLE_TITLE), $this->getName())
568 );
569 }
570 $enabled = Config::DISABLED;
571 }
572
573 Util::logInfo($this->getName() . ' switched to ' . ($enabled == Config::ENABLED ? 'enabled' : 'disabled'));
574 $this->enable = $enabled == Config::ENABLED;
575 $bearsamppConfig->replace(self::ROOT_CFG_ENABLE, $enabled);
576
577 $this->reload();
578 if ($this->enable) {
579 Util::installService($this, $this->port, self::CMD_SYNTAX_CHECK, $showWindow);
580 } else {
581 Util::removeService($this->service, $this->name);
582 }
583}
584
585/**
586 * Retrieves the error log path for the module.
587 *
588 * @return string The error log path.
589 */
590public function getErrorLog() {
591 return $this->errorLog;
592}
593
594/**
595 * Retrieves the executable path for the module.
596 *
597 * @return string The executable path.
598 */
599public function getExe() {
600 return $this->exe;
601}
602
603/**
604 * Retrieves the configuration file path for the module.
605 *
606 * @return string The configuration file path.
607 */
608public function getConf() {
609 return $this->conf;
610}
611
612/**
613 * Retrieves the port number for the module.
614 *
615 * @return int The port number.
616 */
617public function getPort() {
618 return $this->port;
619}
620
621/**
622 * Sets the port number for the module.
623 *
624 * @param int $port The port number to set.
625 */
626public function setPort($port) {
627 $this->replace(self::LOCAL_CFG_PORT, $port);
628}
629
630/**
631 * Retrieves the root user for the module.
632 *
633 * @return string The root user.
634 */
635public function getRootUser() {
636 return $this->rootUser;
637}
638
639/**
640 * Sets the root user for the module.
641 *
642 * @param string $rootUser The root user to set.
643 */
644public function setRootUser($rootUser) {
645 $this->replace(self::LOCAL_CFG_ROOT_USER, $rootUser);
646}
647
648/**
649 * Retrieves the root password for the module.
650 *
651 * @return string The root password.
652 */
653public function getRootPwd() {
654 return $this->rootPwd;
655}
656
657/**
658 * Sets the root password for the module.
659 *
660 * @param string $rootPwd The root password to set.
661 */
662public function setRootPwd($rootPwd) {
663 $this->replace(self::LOCAL_CFG_ROOT_PWD, $rootPwd);
664}
665
666/**
667 * Retrieves the CLI executable path for the module.
668 *
669 * @return string The CLI executable path.
670 */
671public function getCliExe() {
672 return $this->cliExe;
673}
674
675/**
676 * Retrieves the admin executable path for the module.
677 *
678 * @return string The admin executable path.
679 */
680public function getAdmin() {
681 return $this->admin;
682}}
$result
global $bearsamppLang
global $bearsamppRoot
static exec($basename, $content, $timeout=true, $catchOutput=true, $standalone=false, $silent=true, $rebuild=true)
checkPort($port, $showWindow=false)
setVersion($version)
checkRootPassword($currentPwd=null, $wbProgressBar=null)
setRootUser($rootUser)
__construct($id, $type)
updateConfig($version=null, $sub=0, $showWindow=false)
setEnable($enabled, $showWindow=false)
reload($id=null, $type=null)
setRootPwd($rootPwd)
switchVersion($version, $showWindow=false)
changeRootPassword($currentPwd, $newPwd, $wbProgressBar=null)
changePort($port, $checkUsed=false, $wbProgressBar=null)
const LOCAL_CFG_ROOT_USER
const DISABLED
const ENABLED
const ENABLE_TITLE
const PORT_NOT_USED_BY
const ERROR_FILE_NOT_FOUND
const PORT_USED_BY_ANOTHER_DBMS
const MARIADB
const ERROR_INVALID_PARAMETER
const BEARSAMPP_CONF_NOT_FOUND_ERROR
const CHECK_PORT_TITLE
const ENABLE_BUNDLE_NOT_EXIST
const ERROR_CONF_NOT_FOUND
const SWITCH_VERSION_TITLE
const ERROR_EXE_NOT_FOUND
const PORT_USED_BY
const PORT_NOT_USED
const BEARSAMPP_CONF_MALFORMED_ERROR
update($sub=0, $showWindow=false)
replace($key, $value)
static startWith($string, $search)
static logReloadClass($classInstance)
static replaceInFile($path, $replaceList)
static contains($string, $search)
static logError($data, $file=null)
static isValidPort($port)
static installService($bin, $port, $syntaxCheckCmd, $showWindow=false)
static removeService($service, $name)
static logDebug($data, $file=null)
static logInitClass($classInstance)
static isPortInUse($port)
static logInfo($data, $file=null)
global $bearsamppConfig
Definition homepage.php:26
const APP_TITLE
Definition root.php:12