1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 07:30:10 +01:00

remove outdated code for unsupported mysql version

This commit is contained in:
Lorenzo Yario 2024-04-07 06:00:43 -07:00 committed by GitHub
parent 3c49645af0
commit 4c99f81e40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,33 +39,6 @@ function md5_hash_of_file($config, $path) {
}
}
/**
* Strip the symbols incompatible with the current database version.
*
* @param string @input The input string.
* @return string The value stripped of incompatible symbols.
*/
function strip_symbols($input) {
if (mysql_version() >= 50503) {
return $input; // Assume we're using the utf8mb4 charset
} else {
// MySQL's `utf8` charset only supports up to 3-byte symbols
// Remove anything >= 0x010000
$chars = preg_split('//u', $input, -1, PREG_SPLIT_NO_EMPTY);
$ret = '';
foreach ($chars as $char) {
$o = 0;
$ord = ordutf8($char, $o);
if ($ord >= 0x010000) {
continue;
}
$ret .= $char;
}
return $ret;
}
}
/**
* Download a remote file from the given url.
* The file is deleted at shutdown.