2024.8.23
Loading...
Searching...
No Matches
class.action.debugPostgresql.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 ActionDebugPostgresql
12 *
13 * This class handles the debugging actions for PostgreSQL within the Bearsampp application.
14 * It retrieves and displays PostgreSQL command line output based on the provided arguments.
15 */
17{
18 /**
19 * Constructor for ActionDebugPostgresql.
20 *
21 * @param array $args An array of arguments where the first element is expected to be a PostgreSQL command.
22 *
23 * This constructor initializes the debugging process for PostgreSQL. It checks the provided arguments,
24 * retrieves the command line output for the specified PostgreSQL command, and displays it in a message box.
25 *
26 * Global variables used:
27 * - $bearsamppLang: Provides language-specific strings.
28 * - $bearsamppBins: Provides access to Bearsampp binaries, including PostgreSQL.
29 * - $bearsamppWinbinder: Handles the display of message boxes.
30 */
31 public function __construct($args)
32 {
33 global $bearsamppLang, $bearsamppBins, $bearsamppTools, $bearsamppWinbinder;
34
35 if (isset($args[0]) && !empty($args[0])) {
36 $editor = false;
37 $msgBoxError = false;
38 $caption = $bearsamppLang->getValue(Lang::DEBUG) . ' ' . $bearsamppLang->getValue(Lang::POSTGRESQL) . ' - ';
39 if ($args[0] == BinPostgresql::CMD_VERSION) {
41 }
42 $caption .= ' (' . $args[0] . ')';
43
44 $debugOutput = $bearsamppBins->getPostgresql()->getCmdLineOutput($args[0]);
45
46 if ($editor) {
47 Util::openFileContent($caption, $debugOutput);
48 } else {
49 if ($msgBoxError) {
50 $bearsamppWinbinder->messageBoxError(
51 $debugOutput,
52 $caption
53 );
54 } else {
55 $bearsamppWinbinder->messageBoxInfo(
56 $debugOutput,
57 $caption
58 );
59 }
60 }
61 }
62 }
63}
global $bearsamppBins
global $bearsamppLang
const DEBUG
const DEBUG_POSTGRESQL_VERSION
const POSTGRESQL
static openFileContent($caption, $content)