From bd5fd6328912da9ad306029335ac5ff52be2075a Mon Sep 17 00:00:00 2001 From: wyd621 Date: Fri, 21 Mar 2014 09:26:13 +0000 Subject: [PATCH] * adjust win2unix.php. --- bin/php/win2unix.php | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/bin/php/win2unix.php b/bin/php/win2unix.php index 90223f2c1b..360f2cc0bd 100755 --- a/bin/php/win2unix.php +++ b/bin/php/win2unix.php @@ -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"; }