/** Logic: If config array is passed to this method then definitely the new handle is required. Else, If DBMgrHandle already exists then return the existing handle. Else, get the default DB config, and instantiate a new DBMgr Handle. */ function DBMgr_Handle($config = '') { global $perform_Database_Operation; $className = 'DBMgr'; if (is_array($config)) { $config = getDBConfig($config); if (strcasecmp($config['dbType'], 'mssql') == 0) { $className = 'SSRV'; } $perform_Database_Operation = new $className($config); return $perform_Database_Operation; } if (isset($perform_Database_Operation)) { return $perform_Database_Operation; } $config = getDBConfig($config); if (strcasecmp($config['dbType'], 'mssql') == 0) { $className = 'SSRV'; } if (function_exists('getclassObject')) { $perform_Database_Operation = getclassObject($className, $config); } else { $perform_Database_Operation = new $className($config); } return $perform_Database_Operation; }
} if (isset($_GET['download'])) { if (!$result) { $dumpSql = backupDB($con, $dbname, $dbprefix); $compressSql = gzencode($dumpSql, 9); header('Content-type:application/text'); header('Content-Disposition:attachment;filename=bugfree.sql.gz'); echo $compressSql; break; } } renderFile($viewFile, array('version' => $version)); @mysql_close($con); break; case UPGRADE: list($dbhost, $dbname, $port, $dbuser, $dbpwd, $dbprefix) = getDBConfig(CONFIG_FILE); list($result, $info, $target, $con) = getDBCon($dbhost, $port, $dbuser, $dbpwd); if (!$result) { $dbVersion = isset($_GET['dbversion']) ? $_GET['dbversion'] : null; $step = isset($_GET['step']) ? $_GET['step'] : 1; list($result, $info, $dbVersion, $step) = upgrade($con, $dbname, $dbprefix, $dbVersion, $step); } @mysql_close($con); echo json_encode(array('result' => $result, 'info' => $info, 'dbversion' => $dbVersion, 'step' => $step)); break; case UPGRADED: $viewFile = $viewDir . 'upgraded.php'; file_put_contents('install.lock', ''); renderFile($viewFile); break; case CONFIG: