本文整理汇总了PHP中PearDatabase::escapeDbName方法的典型用法代码示例。如果您正苦于以下问题:PHP PearDatabase::escapeDbName方法的具体用法?PHP PearDatabase::escapeDbName怎么用?PHP PearDatabase::escapeDbName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PearDatabase
的用法示例。
在下文中一共展示了PearDatabase::escapeDbName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: migrate
function migrate($migrationInfo)
{
global $installationStrings;
$completed = false;
set_time_limit(0);
//ADDED TO AVOID UNEXPECTED TIME OUT WHILE MIGRATING
global $dbconfig;
require $migrationInfo['root_directory'] . '/config.inc.php';
$dbtype = $dbconfig['db_type'];
$host = $dbconfig['db_server'] . $dbconfig['db_port'];
$dbname = $dbconfig['db_name'];
$username = $dbconfig['db_username'];
$passwd = $dbconfig['db_password'];
global $adb, $migrationlog;
$adb = new PearDatabase($dbtype, $host, $dbname, $username, $passwd);
$query = " ALTER DATABASE " . $adb->escapeDbName($dbname) . " DEFAULT CHARACTER SET utf8";
$adb->query($query);
$source_directory = $migrationInfo['source_directory'];
if (file_exists($source_directory . 'user_privileges/CustomInvoiceNo.php')) {
require_once $source_directory . 'user_privileges/CustomInvoiceNo.php';
}
$migrationlog =& LoggerManager::getLogger('MIGRATION');
if (isset($migrationInfo['old_version'])) {
$source_version = $migrationInfo['old_version'];
}
if (!isset($source_version) || empty($source_version)) {
//If source version is not set then we cannot proceed
echo "<br> " . $installationStrings['LBL_SOURCE_VERSION_NOT_SET'];
exit;
}
$reach = 0;
include $migrationInfo['root_directory'] . "/modules/Migration/versions.php";
foreach ($versions as $version => $label) {
if ($version == $source_version || $reach == 1) {
$reach = 1;
$temp[] = $version;
}
}
$temp[] = $current_version;
global $adb, $dbname;
$_SESSION['adodb_current_object'] = $adb;
@ini_set('zlib.output_compression', 0);
@ini_set('output_buffering', 'off');
ob_implicit_flush(true);
echo '<table width="98%" border="1px" cellpadding="3" cellspacing="0" height="100%">';
if (is_array($_SESSION['migration_info']['user_messages'])) {
foreach ($_SESSION['migration_info']['user_messages'] as $infoMap) {
echo "<tr><td>" . $infoMap['status'] . "</td><td>" . $infoMap['msg'] . "</td></tr>";
}
}
echo "<tr><td colspan='2'><b>{$installationStrings['LBL_GOING_TO_APPLY_DB_CHANGES']}...</b></td></tr>";
for ($patch_count = 0; $patch_count < count($temp); $patch_count++) {
//Here we have to include all the files (all db differences for each release will be included)
$filename = "modules/Migration/DBChanges/" . $temp[$patch_count] . "_to_" . $temp[$patch_count + 1] . ".php";
$empty_tag = "<tr><td colspan='2'> </td></tr>";
$start_tag = "<tr><td colspan='2'><b><font color='red'> ";
$end_tag = "</font></b></td></tr>";
if (is_file($filename)) {
echo $empty_tag . $start_tag . $temp[$patch_count] . " ==> " . $temp[$patch_count + 1] . " " . $installationStrings['LBL_DATABASE_CHANGES'] . " -- " . $installationStrings['LBL_STARTS'] . "." . $end_tag;
include $filename;
//include the file which contains the corresponding db changes
echo $start_tag . $temp[$patch_count] . " ==> " . $temp[$patch_count + 1] . " " . $installationStrings['LBL_DATABASE_CHANGES'] . " -- " . $installationStrings['LBL_ENDS'] . "." . $end_tag;
}
}
/* Install Vtlib Compliant Modules */
Common_Install_Wizard_Utils::installMandatoryModules();
Migration_Utils::installOptionalModules($migrationInfo['selected_optional_modules'], $migrationInfo['source_directory'], $migrationInfo['root_directory']);
Migration_utils::copyLanguageFiles($migrationInfo['source_directory'], $migrationInfo['root_directory']);
//Here we have to update the version in table. so that when we do migration next time we will get the version
$res = $adb->query('SELECT * FROM vtiger_version');
global $vtiger_current_version;
require $migrationInfo['root_directory'] . '/vtigerversion.php';
if ($adb->num_rows($res)) {
$res = ExecuteQuery("UPDATE vtiger_version SET old_version='{$versions[$source_version]}',current_version='{$vtiger_current_version}'");
$completed = true;
} else {
ExecuteQuery("INSERT INTO vtiger_version (id, old_version, current_version) values (" . $adb->getUniqueID('vtiger_version') . ", '{$versions[$source_version]}', '{$vtiger_current_version}');");
$completed = true;
}
echo '</table><br><br>';
create_tab_data_file();
create_parenttab_data_file();
return $completed;
}