Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorvipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-11-17 07:02:30 +0300
committervipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-11-17 07:02:30 +0300
commitb500fde62017a0badd6331c87f598d14a9ce96a8 (patch)
tree2eb5171d5f20f6b074bb0d827e0f44e65a4c39b2 /libs
parent4cd890da84aa5a6877084e75f06334670fbc001e (diff)
compat function if mysqli_set_charset doesn't exist
Diffstat (limited to 'libs')
-rw-r--r--libs/upgradephp/upgrade.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/upgradephp/upgrade.php b/libs/upgradephp/upgrade.php
index b4833d648b..e935e3946c 100644
--- a/libs/upgradephp/upgrade.php
+++ b/libs/upgradephp/upgrade.php
@@ -427,3 +427,24 @@ if (!function_exists("ctype_alnum")) {
}
}
+
+/**
+ * Sets the default client character set.
+ *
+ * @compat
+ * Procedural style
+ * @bugs
+ * PHP documentation says this function exists in PHP 5 >= 5.0.5,
+ * but it also depends on the versions of external libraries, e.g.,
+ * php_mysqli.dll and libmysql.dll.
+ *
+ * @param $link mysqli MySQLi connection resource
+ * @param $charset string Character set
+ * @return bool TRUE on success, FALSE on failure
+ */
+if (in_array('mysqli', @get_loaded_extensions()) && !function_exists('mysqli_set_charset')) {
+ function mysqli_set_charset($link, $charset)
+ {
+ return mysqli_query($link, "SET NAMES '$charset'");
+ }
+}