* adjust win2unix.php.

This commit is contained in:
wyd621
2014-03-21 09:26:13 +00:00
parent cd349cf78a
commit bd5fd63289

View File

@@ -2,13 +2,26 @@
error_reporting(E_ALL);
include dirname(dirname(dirname(__FILE__))) . "/config/config.php";
$renameTables = array('zt_casestep' => 'zt_caseStep', 'zt_doclib' => 'zt_docLib', 'zt_grouppriv' => 'zt_groupPriv',
'zt_productplan' => 'zt_productPlan', 'zt_projectproduct' => 'zt_projectProduct', 'zt_projectstory' => 'zt_projectStory',
'zt_storyspec' => 'zt_storySpec', 'zt_taskestimate' => 'zt_taskEstimate', 'zt_testresult' => 'zt_testResult',
'zt_testrun' => 'zt_testRun', 'zt_testtask' => 'zt_testTask', 'zt_usercontact' => 'zt_userContact', 'zt_usergroup' => 'zt_userGroup',
'zt_userquery' => 'zt_userQuery', 'zt_usertpl' => 'zt_userTPL');
$tables2Rename = array();
$tables2Rename['zt_casestep'] = 'zt_caseStep';
$tables2Rename['zt_doclib'] = 'zt_docLib';
$tables2Rename['zt_grouppriv'] = 'zt_groupPriv';
$tables2Rename['zt_productplan'] = 'zt_productPlan';
$tables2Rename['zt_projectproduct'] = 'zt_projectProduct';
$tables2Rename['zt_projectstory'] = 'zt_projectStory';
$tables2Rename['zt_storyspec'] = 'zt_storySpec';
$tables2Rename['zt_taskestimate'] = 'zt_taskEstimate';
$tables2Rename['zt_testresult'] = 'zt_testResult';
$tables2Rename['zt_testrun'] = 'zt_testRun';
$tables2Rename['zt_testtask'] = 'zt_testTask';
$tables2Rename['zt_usercontact'] = 'zt_userContact';
$tables2Rename['zt_usergroup'] = 'zt_userGroup';
$tables2Rename['zt_userquery'] = 'zt_userQuery';
$tables2Rename['zt_usertpl'] = 'zt_userTPL';
$renameTables += array('zt_relationoftasks' => 'zt_relationOfTasks', 'zt_repohistory' => 'zt_repoHistory');
/* Zentao Pro table. */
$tables2Rename['zt_relationoftasks'] = 'zt_relationOfTasks';
$tables2Rename['zt_repohistory'] = 'zt_repoHistory';
try
{
@@ -24,17 +37,17 @@ catch(PDOException $e)
die("connect to db failed.\n");
}
$existTables = $dbh->query('SHOW TABLES')->fetchAll();
foreach($existTables as $key => $table) $existTables[$key] = current((array)$table);
$existTables = array_flip($existTables);
$tablesExists = $dbh->query('SHOW TABLES')->fetchAll();
foreach($tablesExists as $key => $table) $tablesExists[$key] = current((array)$table);
$tablesExists = array_flip($tablesExists);
foreach($renameTables as $oldTable => $newTable)
foreach($tables2Rename as $oldTable => $newTable)
{
if(isset($existTables[$newTable]))
if(isset($tablesExists[$newTable]))
{
echo "Has existed table '$newTable'\n";
}
elseif(!isset($existTables[$oldTable]))
elseif(!isset($tablesExists[$oldTable]))
{
echo "No found table '$oldTable'\n";
}