From d0ae8704a4907d6030b0250ee4f519898ccaeacf Mon Sep 17 00:00:00 2001 From: Carsten Schmitz Date: Wed, 18 Oct 2017 15:35:33 +0200 Subject: [PATCH] Fixed issue: Database not completely updated if updating from an earlier version than 2.6.x Dev Show info message and prevent update --- .../helpers/update/updatedb_helper.php | 21 +++++++-- .../views/admin/databaseupdate/verify.php | 46 ++++++++++++------- 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/application/helpers/update/updatedb_helper.php b/application/helpers/update/updatedb_helper.php index e100aeeabee..1eb219e097c 100644 --- a/application/helpers/update/updatedb_helper.php +++ b/application/helpers/update/updatedb_helper.php @@ -33,6 +33,11 @@ function db_upgrade_all($iOldDBVersion, $bSilent=false) { if ($bSilent && (count(array_intersect($aCriticalDBVersions,$aAllUpdates))>0)){ return false; } + // If DBVersion is older than 258 don't allow database update + If ($iOldDBVersion<258) + { + return false; + } /// This function does anything necessary to upgrade /// older versions to match current functionality @@ -1142,7 +1147,12 @@ function rollBackToTransactionBookmark($sBookmark='limesurvey') } } - +/** +* Drop a default value in MSSQL +* +* @param mixed $fieldname +* @param mixed $tablename +*/ function dropDefaultValueMSSQL($fieldname, $tablename) { // find out the name of the default constraint @@ -1161,7 +1171,7 @@ function dropDefaultValueMSSQL($fieldname, $tablename) } /** -* This function drops a unique Key of an MSSQL database field by using the name of the field it lies upon and the table name +* This function drops a unique Key of an MSSQL database field by using the field name and the table name * * @param string $sFieldName * @param string $sTableName @@ -1179,8 +1189,11 @@ function dropUniqueKeyMSSQL($sFieldName, $sTableName) } /** - * @param string $sFieldName - */ +* This function drops a secondary key of an MSSQL database field by using the field name and the table name +* +* @param mixed $sFieldName +* @param mixed $sTableName +*/ function dropSecondaryKeyMSSQL($sFieldName, $sTableName) { $oDB = Yii::app()->getDb(); diff --git a/application/views/admin/databaseupdate/verify.php b/application/views/admin/databaseupdate/verify.php index a43f01879d9..ce7c7a2389e 100644 --- a/application/views/admin/databaseupdate/verify.php +++ b/application/views/admin/databaseupdate/verify.php @@ -2,23 +2,37 @@

-
- - - - - - - - -
db->getDriverName(); ?>
db->tablePrefix; ?>
getConfig("sitename"); ?>
getController()->createUrl('/'); ?>
getConfig('dbversionnumber'); ?>
-
+
+ + + + + + + + +
db->getDriverName(); ?>
db->tablePrefix; ?>
getConfig("sitename"); ?>
getController()->createUrl('/'); ?>
getConfig('dbversionnumber'); ?>
+
-

- " role="button"> - - -

+ + + + + + + +

+ " role="button"> + + +

+