Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #17992: Unable to reimport tokens from old table (#3219)
Co-authored-by: lapiudevgit <devgit@lapiu.biz> Co-authored-by: Olle Härstedt <olle.haerstedt@limesurvey.org>
- Loading branch information
1 parent
ad62e13
commit 88f79bb
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']]); | ||
} | ||
} | ||
} | ||
} | ||
} |