Skip to content

Commit

Permalink
Fixed issue #7144: Checking data integrity does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jan 9, 2013
1 parent baa3639 commit c2bf35f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions application/controllers/admin/checkintegrity.php
Expand Up @@ -366,15 +366,18 @@ protected function _checkintegrity()
$sTableName = substr(reset($aRow), strlen($sDBPrefix));
if ($sTableName == 'survey_permissions' || $sTableName == 'survey_links' || $sTableName == 'survey_url_parameters') continue;
$aTableName=explode('_',$sTableName);
$iSurveyID = $aTableName[1];
if (!in_array($iSurveyID, $sids)) {
$sDate = date('YmdHis') . rand(1, 1000);
$sOldTable = "survey_{$iSurveyID}";
$sNewTable = "old_survey_{$iSurveyID}_{$sDate}";
try {
$deactivateresult = Yii::app()->db->createCommand()->renameTable("{{{$sOldTable}}}", "{{{$sNewTable}}}");
} catch (CDbException $e) {
die ('Couldn\'t make backup of the survey table. Please try again. The database reported the following error:<br />' . htmlspecialchars($e) . '<br />');
if (isset($aTableName[1]) && ctype_digit($aTableName[1]))
{
$iSurveyID = $aTableName[1];
if (!in_array($iSurveyID, $sids)) {
$sDate = date('YmdHis') . rand(1, 1000);
$sOldTable = "survey_{$iSurveyID}";
$sNewTable = "old_survey_{$iSurveyID}_{$sDate}";
try {
$deactivateresult = Yii::app()->db->createCommand()->renameTable("{{{$sOldTable}}}", "{{{$sNewTable}}}");
} catch (CDbException $e) {
die ('Couldn\'t make backup of the survey table. Please try again. The database reported the following error:<br />' . htmlspecialchars($e) . '<br />');
}
}
}
}
Expand Down

0 comments on commit c2bf35f

Please sign in to comment.