Change of tableExists function, by instructions deprecated in PHP 5.3
This commit is contained in:
@@ -717,14 +717,29 @@ class database extends database_base {
|
|||||||
/**
|
/**
|
||||||
* Determining the existence of a table
|
* Determining the existence of a table
|
||||||
*/
|
*/
|
||||||
function tableExists ($table, $db) {
|
function tableExists($tableName, $database)
|
||||||
$tables = mysql_list_tables ($db);
|
{
|
||||||
while (list ($temp) = @mysql_fetch_array ($tables)) {
|
@mysql_select_db($database);
|
||||||
if ($temp == $table) {
|
$tables = array();
|
||||||
|
$tablesResult = mysql_query("SHOW TABLES FROM $database;");
|
||||||
|
while ($row = @mysql_fetch_row($tablesResult)) $tables[] = $row[0];
|
||||||
|
if(in_array($tableName, $tables)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Determining the existence of a table (Depricated)
|
||||||
|
*/
|
||||||
|
// function tableExists ($table, $db) {
|
||||||
|
// $tables = mysql_list_tables ($db);
|
||||||
|
// while (list ($temp) = @mysql_fetch_array ($tables)) {
|
||||||
|
// if ($temp == $table) {
|
||||||
|
// return TRUE;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return FALSE;
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,10 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
|
|||||||
if(G::LoadSystemExist($sDataBase)){
|
if(G::LoadSystemExist($sDataBase)){
|
||||||
G::LoadSystem($sDataBase);
|
G::LoadSystem($sDataBase);
|
||||||
$oDataBase = new database();
|
$oDataBase = new database();
|
||||||
$tableExists = $oDataBase->tableExists('USERS', $Fields['PME_SQLCONNECTION']);
|
$dataBase = $Fields['PME_SQLCONNECTION'];
|
||||||
|
if($Fields['PME_SQLCONNECTION']=='workflow')
|
||||||
|
$dataBase = DB_NAME;
|
||||||
|
$tableExists = $oDataBase->tableExists('USERS', $dataBase);
|
||||||
}
|
}
|
||||||
if($tableExists) {
|
if($tableExists) {
|
||||||
$con = Propel::getConnection($Fields['PME_SQLCONNECTION']);
|
$con = Propel::getConnection($Fields['PME_SQLCONNECTION']);
|
||||||
|
|||||||
Reference in New Issue
Block a user