Skip to content

Commit

Permalink
Fixed issue #11995: Removing language from global settings produces f…
Browse files Browse the repository at this point in the history
…atal error
  • Loading branch information
c-schmitz committed Jun 13, 2017
1 parent 7f5296d commit 2eaef45
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -13,7 +13,7 @@
*/

$config['versionnumber'] = '2.65.4';
$config['dbversionnumber'] = 261;
$config['dbversionnumber'] = 262;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '2654';
Expand Down
20 changes: 13 additions & 7 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -1576,19 +1576,25 @@ function db_upgrade_all($iOldDBVersion, $bSilent=false) {
$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>260),"stg_name='DBVersion'");
$oTransaction->commit();
}

/*
* The hash value of a notification is used to calculate uniqueness.
* @since 2016-08-10
* @author Olle Haerstedt
*/
if ($iOldDBVersion < 261) {
$oTransaction = $oDB->beginTransaction();
/*
* The hash value of a notification is used to calculate uniqueness.
* @since 2016-08-10
* @author Olle Haerstedt
*/
addColumn('{{notifications}}', 'hash', 'string(64)');
$oDB->createCommand()->createIndex('notif_hash_index', '{{notifications}}', 'hash', false);
$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>261),"stg_name='DBVersion'");
$oTransaction->commit();
}

if ($iOldDBVersion < 262) {
$oTransaction = $oDB->beginTransaction();
alterColumn('{{settings_global}}','stg_value',"text",false);
$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>262),"stg_name='DBVersion'");
$oTransaction->commit();
}
}
catch(Exception $e)
{
Expand Down Expand Up @@ -1616,7 +1622,7 @@ function db_upgrade_all($iOldDBVersion, $bSilent=false) {
$superadmins = User::model()->getSuperAdmins();
Notification::broadcast(array(
'title' => gT('Database update'),
'message' => sprintf(gT('The database has been updated from version %s to version %s.'), $iOldDBVersion, '261')
'message' => sprintf(gT('The database has been updated from version %s to version %s.'), $iOldDBVersion, '262')
), $superadmins);
fixLanguageConsistencyAllSurveys();
Yii::app()->setConfig('Updating',false);
Expand Down
4 changes: 2 additions & 2 deletions installer/sql/create-mssql.sql
Expand Up @@ -365,7 +365,7 @@ PRIMARY KEY ( [id] )
--
CREATE TABLE [prefix_settings_global] (
[stg_name] varchar(50) NOT NULL default '',
[stg_value] nvarchar(255) NOT NULL default '',
[stg_value] varchar(max) NOT NULL,
PRIMARY KEY ([stg_name])
);

Expand Down Expand Up @@ -610,4 +610,4 @@ CREATE INDEX [notif_index] ON [prefix_notifications] ([entity_id],[entity],[stat
--
-- Version Info
--
INSERT INTO [prefix_settings_global] VALUES ('DBVersion', '260');
INSERT INTO [prefix_settings_global] VALUES ('DBVersion', '262');
4 changes: 2 additions & 2 deletions installer/sql/create-mysql.sql
Expand Up @@ -368,7 +368,7 @@ CREATE TABLE `prefix_sessions`(
--
CREATE TABLE `prefix_settings_global` (
`stg_name` varchar(50) NOT NULL default '',
`stg_value` varchar(255) NOT NULL default '',
`stg_value` text NOT NULL,
PRIMARY KEY (`stg_name`)
) ENGINE=MYISAM CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Expand Down Expand Up @@ -616,4 +616,4 @@ CREATE TABLE IF NOT EXISTS `prefix_notifications` (
--
-- Version Info
--
INSERT INTO `prefix_settings_global` VALUES ('DBVersion', '260');
INSERT INTO `prefix_settings_global` VALUES ('DBVersion', '262');
4 changes: 2 additions & 2 deletions installer/sql/create-pgsql.sql
Expand Up @@ -373,7 +373,7 @@ CREATE TABLE prefix_sessions(
--
CREATE TABLE prefix_settings_global (
"stg_name" character varying(50) DEFAULT '' NOT NULL,
"stg_value" character varying(255) DEFAULT '' NOT NULL,
"stg_value" text NOT NULL,
CONSTRAINT prefix_settings_global_pkey PRIMARY KEY (stg_name)
);

Expand Down Expand Up @@ -619,4 +619,4 @@ CREATE INDEX prefix_index ON prefix_notifications USING btree (entity, entity_id
--
-- Version Info
--
INSERT INTO prefix_settings_global VALUES ('DBVersion', '260');
INSERT INTO prefix_settings_global VALUES ('DBVersion', '262');

0 comments on commit 2eaef45

Please sign in to comment.