resolve negative aliases
This commit is contained in:
parent
2b628a395f
commit
8b22652aa0
@ -1011,15 +1011,20 @@ class Tag {
|
|||||||
public static function resolve_alias($tag) {
|
public static function resolve_alias($tag) {
|
||||||
assert(is_string($tag));
|
assert(is_string($tag));
|
||||||
|
|
||||||
|
$negative = false;
|
||||||
|
if(!empty($tag) && ($tag[0] == '-')) {
|
||||||
|
$negative = true;
|
||||||
|
$tag = substr($tag, 1);
|
||||||
|
}
|
||||||
|
|
||||||
global $database;
|
global $database;
|
||||||
$newtag = $database->get_one(
|
$newtag = $database->get_one(
|
||||||
$database->scoreql_to_sql("SELECT newtag FROM aliases WHERE SCORE_STRNORM(oldtag)=SCORE_STRNORM(:tag)"),
|
$database->scoreql_to_sql("SELECT newtag FROM aliases WHERE SCORE_STRNORM(oldtag)=SCORE_STRNORM(:tag)"),
|
||||||
array("tag"=>$tag));
|
array("tag"=>$tag));
|
||||||
if(!empty($newtag)) {
|
if(empty($newtag)) {
|
||||||
return $newtag;
|
$newtag = $tag;
|
||||||
} else {
|
|
||||||
return $tag;
|
|
||||||
}
|
}
|
||||||
|
return $negative ? "-$newtag" : $newtag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function resolve_wildcard($tag) {
|
public static function resolve_wildcard($tag) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user