2024.8.23
Loading...
Searching...
No Matches
ActionDebugMariadb Class Reference

Public Member Functions

 __construct ($args)
 

Detailed Description

Class ActionDebugMariadb

This class handles debugging actions for MariaDB within the Bearsampp application. It processes command-line arguments to determine the type of debugging action to perform, retrieves the corresponding output from MariaDB, and displays it using the appropriate method.

Definition at line 17 of file class.action.debugMariadb.php.

Constructor & Destructor Documentation

◆ __construct()

ActionDebugMariadb::__construct ( $args)

ActionDebugMariadb constructor.

Parameters
array$argsCommand-line arguments specifying the debugging action to perform.

This constructor initializes the debugging process for MariaDB based on the provided arguments. It supports three types of debugging actions: version check, variables display, and syntax check. The output of the debugging action is displayed either in an editor or a message box.

Definition at line 28 of file class.action.debugMariadb.php.

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 }
global $bearsamppBins
global $bearsamppLang
const DEBUG_MARIADB_SYNTAX_CHECK
const MARIADB
const DEBUG_MARIADB_VERSION
const DEBUG
const DEBUG_MARIADB_VARIABLES
static openFileContent($caption, $content)

References $bearsamppBins, $bearsamppLang, BinMariadb\CMD_SYNTAX_CHECK, BinMariadb\CMD_VARIABLES, BinMariadb\CMD_VERSION, Lang\DEBUG, Lang\DEBUG_MARIADB_SYNTAX_CHECK, Lang\DEBUG_MARIADB_VARIABLES, Lang\DEBUG_MARIADB_VERSION, Lang\MARIADB, and Util\openFileContent().


The documentation for this class was generated from the following file: