Skip to content

Commit

Permalink
support XOOPS_DB_TYPE 'mysqli'
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Feb 12, 2014
1 parent 54b8272 commit 48b2214
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Expand Up @@ -2,7 +2,7 @@
// $Id$

// Keep Block option values when update (by nobunobu) for XOOPS 2.0.x
$db =& Database::getInstance() ;
$db = XoopsDatabaseFactory::getDatabaseConnection() ;
$query = "SELECT mid FROM ".$db->prefix('modules')." WHERE dirname='".$modversion['dirname']."' ";
$result = $db->query($query);
$record= $db->fetcharray($result);
Expand Down Expand Up @@ -62,7 +62,7 @@
}

for ($i = 1 ; $i <= $count ; $i++) {
$sql = "SELECT name,options FROM ".$db->prefix('newblocks')." WHERE mid=".$mid." AND func_num=".$i." AND show_func='".mysql_real_escape_string($modversion['blocks'][$i]['show_func'])."' AND func_file='".mysql_real_escape_string($modversion['blocks'][$i]['file'])."'";
$sql = "SELECT name,options FROM ".$db->prefix('newblocks')." WHERE mid=".$mid." AND func_num=".$i." AND show_func=".$db->quoteString($modversion['blocks'][$i]['show_func'])." AND func_file='".mysql_real_escape_string($modversion['blocks'][$i]['file'])."'";
$fresult = $db->query($sql);
$fblock = $db->fetchArray($fresult);
if ( isset( $fblock['options'] ) ) {
Expand Down
5 changes: 3 additions & 2 deletions xoops_trust_path/modules/xsns/oninstall.php
Expand Up @@ -25,11 +25,12 @@ function xsns_oninstall($module, $mydirname)
$ret[] = constant($constpref.'_INSTERR').'<br />';
}

$db =& Database::getInstance() ;
$db = XoopsDatabaseFactory::getDatabaseConnection() ;
$mid = $module->getVar('mid') ;

// Tables
$sql_ver = floatval(substr(mysql_get_server_info(), 0, 3));
$get_server_info = (is_object($db->conn) && get_class($db->conn) === 'mysqli')? 'mysqli_get_server_info' : 'mysql_get_server_info';
$sql_ver = floatval(substr($get_server_info($db->conn), 0, 3));
if($sql_ver < 4){
$sql_file = 'mysql3.sql';
}
Expand Down
5 changes: 3 additions & 2 deletions xoops_trust_path/modules/xsns/onuninstall.php
Expand Up @@ -26,11 +26,12 @@ function xsns_onuninstall($module, $mydirname)
}
}

$db =& Database::getInstance() ;
$db = XoopsDatabaseFactory::getDatabaseConnection();
$mid = $module->getVar('mid') ;

// Tables
$sql_ver = floatval(substr(mysql_get_server_info(), 0, 3));
$get_server_info = (is_object($db->conn) && get_class($db->conn) === 'mysqli')? 'mysqli_get_server_info' : 'mysql_get_server_info';
$sql_ver = floatval(substr($get_server_info($db->conn), 0, 3));
if($sql_ver < 4){
$sql_file = 'mysql3.sql';
}
Expand Down

0 comments on commit 48b2214

Please sign in to comment.