* adjust win2unix.

This commit is contained in:
wyd621
2014-01-02 03:22:11 +00:00
parent 07892750be
commit f3c2af5a1e
3 changed files with 38 additions and 56 deletions

View File

@@ -8,22 +8,3 @@ $config->url->faq = 'http://www.zentao.net/ask-faq.html';
$config->url->extension = 'http://www.zentao.net/extension-browse.html';
$config->url->donation = 'http://www.zentao.net/help-donation.html';
$config->url->service = 'http://www.cnezsoft.com/article-browse-1078.html';
$config->win2Unix = new stdclass();
$config->win2Unix->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'
);

View File

@@ -121,39 +121,6 @@ class admin extends control
}
}
/**
* Rename table for from windows to linux.
*
* @access public
* @return void
*/
public function win2Unix()
{
$renameTables = $this->config->win2Unix->renameTables;
$existTables = $this->dbh->query('SHOW TABLES')->fetchAll();
foreach($existTables as $key => $table) $existTables[$key] = current((array)$table);
$existTables = array_flip($existTables);
foreach($renameTables as $oldTable => $newTable)
{
if(isset($existTables[$newTable]))
{
echo "Has existed table '$newTable'\n";
}
elseif(!isset($existTables[$oldTable]))
{
echo "No found table '$oldTable'\n";
}
else
{
$this->dbh->query("RENAME TABLE `$oldTable` TO `$newTable`");
echo "RENAME TABLE `$oldTable` TO `$newTable`\n";
}
}
echo "Finish!\n";
}
/**
* Confirm clear data.
*