add getConfig function

This commit is contained in:
Beu 2024-06-21 11:56:21 +02:00
parent 748ebb20ae
commit 01be9cc45f

View File

@ -42,7 +42,7 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
* Constants
*/
const PLUGIN_ID = 171;
const PLUGIN_VERSION = 1.3;
const PLUGIN_VERSION = 1.4;
const PLUGIN_NAME = 'MatchManager Multiple Config Manager';
const PLUGIN_AUTHOR = 'Beu';
@ -366,6 +366,21 @@ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener,
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SAVECONFIG, $configname);
}
/**
* getConfig
* @param string $name
* @return object|null config
*/
public function getConfig(string $name) {
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
$stmt = $mysqli->prepare('SELECT id FROM `' . self::DB_MATCHCONFIG . '` WHERE `name` = ? LIMIT 1;');
$stmt->bind_param('s', $name);
if (!$stmt->execute()) {
trigger_error('Error executing MySQL query: ' . $stmt->error);
}
return $stmt->get_result()->fetch_object();
}
/**
* Shows a ManiaLink list with the local records.
*