Skip to content

Commit

Permalink
Fixed issue #17992: Unable to reimport tokens from old table (#3219)
Browse files Browse the repository at this point in the history
Co-authored-by: lapiudevgit <devgit@lapiu.biz>
Co-authored-by: Olle Härstedt <olle.haerstedt@limesurvey.org>
  • Loading branch information
3 people committed Jul 19, 2023
1 parent ad62e13 commit 88f79bb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -12,7 +12,7 @@
*/

$config['versionnumber'] = '5.6.31';
$config['dbversionnumber'] = 497;
$config['dbversionnumber'] = 498;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['templateapiversion'] = 3;
Expand Down
23 changes: 23 additions & 0 deletions application/helpers/update/updates/Update_498.php
@@ -0,0 +1,23 @@
<?php

namespace LimeSurvey\Helpers\Update;

/**
* Some of it is a copy of update 453 which has been skipped on some installations
*/
class Update_498 extends DatabaseUpdateBase
{
public function up()
{
$columnSchema = $this->db->getSchema()->getTable('{{archived_table_settings}}')->getColumn('attributes');
if ($columnSchema === null) {
$this->db->createCommand()->addColumn('{{archived_table_settings}}', 'attributes', 'text NULL');
$archivedTableSettings = \Yii::app()->db->createCommand("SELECT * FROM {{archived_table_settings}}")->queryAll();
foreach ($archivedTableSettings as $archivedTableSetting) {
if ($archivedTableSetting['tbl_type'] === 'token') {
$this->db->createCommand()->update('{{archived_table_settings}}', ['attributes' => json_encode(['unknown'])], 'id = :id', ['id' => $archivedTableSetting['id']]);
}
}
}
}
}

0 comments on commit 88f79bb

Please sign in to comment.