Add function for getting tags by base name, log base edits for tags in
NodaLogEdit
This commit is contained in:
parent
a4f24e5478
commit
bc3f2a94d6
|
@ -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.
|
* Returns tag ID by entry in tag translations table.
|
||||||
*
|
*
|
||||||
|
|
|
@ -87,6 +87,22 @@ final class NodaLogEdit {
|
||||||
$insertStmt->close();
|
$insertStmt->close();
|
||||||
$insertStmt = null;
|
$insertStmt = null;
|
||||||
|
|
||||||
|
// Update the main tag table, except for edits to the base,
|
||||||
|
// as these have built-in updating and updating in this case
|
||||||
|
// would be superfluous.
|
||||||
|
if ($section !== 'base') {
|
||||||
|
|
||||||
|
$updateStmt = $mysqli_noda->do_prepare("UPDATE `tag`
|
||||||
|
SET `tag_erfasst_am` = NOW(),
|
||||||
|
`tag_erfasst_von` = ?
|
||||||
|
WHERE `tag_id` = ?");
|
||||||
|
$updateStmt->bind_param("si", $user_name, $tag_id);
|
||||||
|
$updateStmt->execute();
|
||||||
|
$updateStmt->close();
|
||||||
|
$updateStmt = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user