Bearsampp 2025.8.29
Loading...
Searching...
No Matches
class.action.debugMariadb.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{
28 public function __construct($args)
29 {
30 global $bearsamppLang, $bearsamppBins, $bearsamppTools, $bearsamppWinbinder;
31
32 if (isset($args[0]) && !empty($args[0])) {
33 $editor = false;
34 $msgBoxError = false;
35 $caption = $bearsamppLang->getValue(Lang::DEBUG) . ' ' . $bearsamppLang->getValue(Lang::MARIADB) . ' - ';
36
37 // Determine the type of debugging action based on the first argument
38 if ($args[0] == BinMariadb::CMD_VERSION) {
39 $caption .= $bearsamppLang->getValue(Lang::DEBUG_MARIADB_VERSION);
40 } elseif ($args[0] == BinMariadb::CMD_VARIABLES) {
41 $editor = true;
42 $caption .= $bearsamppLang->getValue(Lang::DEBUG_MARIADB_VARIABLES);
43 } elseif ($args[0] == BinMariadb::CMD_SYNTAX_CHECK) {
45 }
46 $caption .= ' (' . $args[0] . ')';
47
48 // Retrieve the command line output for the specified debugging action
49 $debugOutput = $bearsamppBins->getMariadb()->getCmdLineOutput($args[0]);
50
51 // Handle syntax check results
52 if ($args[0] == BinMariadb::CMD_SYNTAX_CHECK) {
53 $msgBoxError = !$debugOutput['syntaxOk'];
54 $debugOutput['content'] = $debugOutput['syntaxOk'] ? 'Syntax OK !' : $debugOutput['content'];
55 }
56
57 // Display the debugging output
58 if ($editor) {
59 Util::openFileContent($caption, $debugOutput['content']);
60 } else {
61 if ($msgBoxError) {
62 $bearsamppWinbinder->messageBoxError(
63 $debugOutput['content'],
64 $caption
65 );
66 } else {
67 $bearsamppWinbinder->messageBoxInfo(
68 $debugOutput['content'],
69 $caption
70 );
71 }
72 }
73 }
74 }
75}
global $bearsamppBins
global $bearsamppLang
const MARIADB
const DEBUG_MARIADB_VARIABLES
const DEBUG_MARIADB_SYNTAX_CHECK
const DEBUG
const DEBUG_MARIADB_VERSION
static openFileContent($caption, $content)