bug 1648 fixed: add the pwg_db_check_version functions for pdo-sqlite, sqlite
and pgsql, also make the $pwg_db_link global in the install_db_connect function so that it can be used in SQLite functions. bug fixed: with pdo-sqlite, pwg_db_num_rows always returns 0, so when initializing user data, it tries to insert the same row twice. git-svn-id: http://piwigo.org/svn/trunk@6090 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
a56af865c5
commit
48ab333212
5 changed files with 49 additions and 2 deletions
|
@ -143,6 +143,8 @@ function activate_core_themes()
|
|||
|
||||
function install_db_connect(&$infos, &$errors)
|
||||
{
|
||||
global $pwg_db_link;
|
||||
|
||||
try
|
||||
{
|
||||
$pwg_db_link = pwg_db_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpasswd'], $_POST['dbname']);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
define('REQUIRED_PDO-SQLITE_VERSION', '3.0.0');
|
||||
define('REQUIRED_PDO_SQLITE_VERSION', '3.0.0');
|
||||
define('DB_ENGINE', 'SQLite');
|
||||
|
||||
define('DB_REGEX_OPERATOR', 'REGEXP');
|
||||
|
@ -55,6 +55,21 @@ function pwg_db_connect($host, $user, $password, $database)
|
|||
return $link;
|
||||
}
|
||||
|
||||
function pwg_db_check_version()
|
||||
{
|
||||
$current_version = pwg_get_db_version();
|
||||
if (version_compare($current_version, REQUIRED_PDO_SQLITE_VERSION, '<'))
|
||||
{
|
||||
fatal_error(
|
||||
sprintf(
|
||||
'your database version is too old, you have "%s" and you need at least "%s"',
|
||||
$current_version,
|
||||
REQUIRED_PDO_SQLITE_VERSION
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function pwg_db_check_charset()
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -60,6 +60,21 @@ function pwg_db_connect($host, $user, $password, $database)
|
|||
}
|
||||
}
|
||||
|
||||
function pwg_db_check_version()
|
||||
{
|
||||
$current_version = pwg_get_db_version();
|
||||
if (version_compare($current_version, REQUIRED_PGSQL_VERSION, '<'))
|
||||
{
|
||||
fatal_error(
|
||||
sprintf(
|
||||
'your database version is too old, you have "%s" and you need at least "%s"',
|
||||
$current_version,
|
||||
REQUIRED_PGSQL_VERSION
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function pwg_db_check_charset()
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -64,6 +64,21 @@ function pwg_db_connect($host, $user, $password, $database)
|
|||
return $link;
|
||||
}
|
||||
|
||||
function pwg_db_check_version()
|
||||
{
|
||||
$current_version = pwg_get_db_version();
|
||||
if (version_compare($current_version, REQUIRED_SQLITE_VERSION, '<'))
|
||||
{
|
||||
fatal_error(
|
||||
sprintf(
|
||||
'your database version is too old, you have "%s" and you need at least "%s"',
|
||||
$current_version,
|
||||
REQUIRED_SQLITE_VERSION
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function pwg_db_check_charset()
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -298,7 +298,7 @@ SELECT ui.*, uc.*, t.name AS theme_name
|
|||
LEFT JOIN '.THEMES_TABLE.' AS t ON t.id = ui.theme
|
||||
WHERE ui.user_id = \''.$user_id.'\'';
|
||||
$result = pwg_query($query);
|
||||
if (pwg_db_num_rows($result) > 0)
|
||||
if ($result)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue