mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-23 05:40:30 +03:00
Added the ability to use persistent connections
This commit is contained in:
parent
11fa45cb19
commit
b54cd674e6
@ -344,12 +344,18 @@ function getgetparam($name, $default = '')
|
||||
|
||||
function connect()
|
||||
{
|
||||
global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding, $force_charset_in_connection;
|
||||
global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding, $force_charset_in_connection, $use_persistent_connection;
|
||||
if (!extension_loaded("mysql")) {
|
||||
die('Mysql extension is not loaded');
|
||||
}
|
||||
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass)
|
||||
or die('Could not connect: ' . mysql_error());
|
||||
if ($use_persistent_connection) {
|
||||
$link = @mysql_pconnect($mysqlhost, $mysqllogin, $mysqlpass);
|
||||
}else{
|
||||
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass);
|
||||
}
|
||||
if (! $link) {
|
||||
die('Could not connect: ' . mysql_error());
|
||||
}
|
||||
mysql_select_db($mysqldb, $link) or die('Could not select database');
|
||||
if ($force_charset_in_connection) {
|
||||
mysql_query("SET NAMES '$dbencoding'", $link);
|
||||
|
@ -41,6 +41,8 @@ $mysqlprefix = "";
|
||||
$dbencoding = "utf8";
|
||||
$force_charset_in_connection = true;
|
||||
|
||||
$use_persistent_connection = false;
|
||||
|
||||
/*
|
||||
* Mailbox
|
||||
*/
|
||||
@ -53,4 +55,4 @@ $mail_encoding = "utf-8";
|
||||
$home_locale = "en"; /* native name will be used in this locale */
|
||||
$default_locale = "en"; /* if user does not provide known lang */
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user