Merge pull request #434 from DakuTree/patch-tagfix
Fix for tags exceeding char limit returning error + Bumped tag char limit to 255.
This commit is contained in:
commit
b1d634a8de
@ -534,6 +534,11 @@ class Image {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mb_strlen($tag, 'UTF-8') > 255){
|
||||||
|
flash_message("The tag below is longer than 255 characters, please use a shorter tag.\n$tag\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$id = $database->get_one(
|
$id = $database->get_one(
|
||||||
$database->scoreql_to_sql(
|
$database->scoreql_to_sql(
|
||||||
"SELECT id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)"
|
"SELECT id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)"
|
||||||
@ -562,7 +567,7 @@ class Image {
|
|||||||
array("tag"=>$tag));
|
array("tag"=>$tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info("core_image", "Tags for Image #{$this->id} set to: ".implode(" ", $tags), false, array("image_id" => $this->id));
|
log_info("core_image", "Tags for Image #{$this->id} set to: ".implode(" ", $tags), null, array("image_id" => $this->id));
|
||||||
$database->cache->delete("image-{$this->id}-tags");
|
$database->cache->delete("image-{$this->id}-tags");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,26 @@ class Upgrade extends Extension {
|
|||||||
log_info("upgrade", "Database at version 13");
|
log_info("upgrade", "Database at version 13");
|
||||||
$config->set_bool("in_upgrade", false);
|
$config->set_bool("in_upgrade", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($config->get_int("db_version") < 14) {
|
||||||
|
$config->set_bool("in_upgrade", true);
|
||||||
|
$config->set_int("db_version", 14);
|
||||||
|
|
||||||
|
log_info("upgrade", "Changing tag column to VARCHAR(255)");
|
||||||
|
if($database->get_driver_name() == 'pgsql') {
|
||||||
|
$database->execute('ALTER TABLE tags ALTER COLUMN tag SET DATA TYPE VARCHAR(255)');
|
||||||
|
$database->execute('ALTER TABLE aliases ALTER COLUMN oldtag SET DATA TYPE VARCHAR(255)');
|
||||||
|
$database->execute('ALTER TABLE aliases ALTER COLUMN newtag SET DATA TYPE VARCHAR(255)');
|
||||||
|
}
|
||||||
|
else if($database->get_driver_name() == 'mysql') {
|
||||||
|
$database->execute('ALTER TABLE tags MODIFY COLUMN tag VARCHAR(255) NOT NULL');
|
||||||
|
$database->execute('ALTER TABLE aliases MODIFY COLUMN oldtag VARCHAR(255) NOT NULL');
|
||||||
|
$database->execute('ALTER TABLE aliases MODIFY COLUMN newtag VARCHAR(255) NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
log_info("upgrade", "Database at version 14");
|
||||||
|
$config->set_bool("in_upgrade", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_priority() {return 5;}
|
public function get_priority() {return 5;}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user