Add function for getting tags by base name, log base edits for tags in
NodaLogEdit
This commit is contained in:
@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user