Add function for getting tags by base name, log base edits for tags in

NodaLogEdit
This commit is contained in:
2021-05-26 22:36:02 +02:00
parent a4f24e5478
commit bc3f2a94d6
2 changed files with 46 additions and 0 deletions

View File

@ -241,6 +241,36 @@ final class NodaIDGetter {
}
/**
* Returns tag ID by entry in tag translations table.
*
* @param MDMysqli $mysqli_noda Database connection.
* @param string $name Name of the tag to search for.
*
* @return integer
*/
public static function getTagIDByBaseName(MDMysqli $mysqli_noda, string $name):int {
if (empty($name)) return 0;
$tagByBaseNameResult = $mysqli_noda->query_by_stmt("
SELECT `tag_id`
FROM `tag_name`
WHERE `tag_name` = ?
LIMIT 2", "s", $name);
if ($tagByBaseData = $tagByBaseNameResult->fetch_row()) {
$output = $tagByBaseData[0];
}
else $output = 0;
$tagByBaseNameResult->close();
$tagByBaseNameResult = null;
return $output;
}
/**
* Returns tag ID by entry in tag translations table.
*