Skip to content

Commit

Permalink
Fixed issue #17121: Custom question preview image not shown (#1810)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieljenik committed Mar 25, 2021
1 parent 0ce1965 commit 8100d01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion application/helpers/update/updatedb_helper.php
Expand Up @@ -3757,7 +3757,21 @@ function ($v) {
$oTransaction->commit();
}

if ($iOldDBVersion < 442) {
if ($iOldDBVersion < 442) {
$oTransaction = $oDB->beginTransaction();
$questionTheme = new QuestionTheme();
$questionsMetaData = $questionTheme->getAllQuestionMetaData(false, false, true)['available_themes'];
foreach ($questionsMetaData as $questionMetaData) {
$oQuestionTheme = QuestionTheme::model()->findByAttributes([
"name" => $questionMetaData['name'],
"extends" => $questionMetaData['questionType'],
"theme_type" => $questionMetaData['type']
]);
if (!empty($oQuestionTheme) && $oQuestionTheme->image_path != $questionMetaData['image_path']) {
$oQuestionTheme->image_path = $questionMetaData['image_path'];
$oQuestionTheme->save();
}
}
$oTransaction = $oDB->beginTransaction();
$oDB->createCommand()->insert("{{plugins}}", [
'name' => 'TwoFactorAdminLogin',
Expand Down
2 changes: 1 addition & 1 deletion application/models/QuestionTheme.php
Expand Up @@ -714,7 +714,7 @@ public static function findAllQuestionMetaDataForSelector()
$baseQuestion['image_path'] = str_replace(
'//',
'/',
App()->getConfig('publicurl') . $baseQuestion['image_path']
Yii::app()->baseUrl . '/' . $baseQuestion['image_path']
);
$baseQuestionsModified[] = $baseQuestion;
}
Expand Down

0 comments on commit 8100d01

Please sign in to comment.