From 0a162d1dbd9b10ac5d572e6e3a8dfaa42a5a8414 Mon Sep 17 00:00:00 2001 From: lacrioque Date: Tue, 28 Jan 2020 14:30:13 +0100 Subject: [PATCH] Dev: updated demomode command and flush command to be compatible with l10n --- application/commands/DemomodeCommand.php | 4 +++- application/commands/WipeCommand.php | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/application/commands/DemomodeCommand.php b/application/commands/DemomodeCommand.php index ca9fa33819f..aa559fbd20b 100644 --- a/application/commands/DemomodeCommand.php +++ b/application/commands/DemomodeCommand.php @@ -37,7 +37,9 @@ private function _resetDatabase() Yii::import('application.helpers.database_helper', true); //Truncate most of the tables - $truncatableTables = ['{{assessments}}', '{{answers}}','{{boxes}}', '{{conditions}}', '{{defaultvalues}}', '{{labels}}', '{{labelsets}}', '{{groups}}', '{{questions}}', '{{surveys}}', '{{surveys_languagesettings}}', '{{quota}}', '{{quota_members}}', '{{quota_languagesettings}}', '{{question_attributes}}', '{{quota}}', '{{quota_members}}', '{{quota_languagesettings}}', '{{question_attributes}}', '{{user_groups}}', '{{user_in_groups}}', '{{templates}}', '{{template_configuration}}', '{{participants}}', '{{participant_attribute_names}}', '{{participant_attribute_names_lang}}', '{{participant_attribute_values}}', '{{participant_shares}}', '{{settings_user}}', '{{failed_login_attempts}}', '{{saved_control}}', '{{survey_links}}']; + $truncatableTables = [ + '{{assessments}}', '{{answers}}', '{{answer_l10ns}}', '{{boxes}}', '{{conditions}}', '{{defaultvalues}}', '{{defaultvalue_l10ns}}', '{{labels}}', '{{label_l10ns}}', '{{labelsets}}', '{{groups}}', '{{questions}}', '{{question_l10ns}}', '{{surveys}}', '{{surveys_languagesettings}}', '{{quota}}', '{{quota_members}}', '{{quota_languagesettings}}', '{{question_attributes}}', '{{quota}}', '{{quota_members}}', '{{quota_languagesettings}}', '{{question_attributes}}', '{{user_groups}}', '{{user_in_groups}}', '{{templates}}', '{{template_configuration}}', '{{participants}}', '{{participant_attribute_names}}', '{{participant_attribute_names_lang}}', '{{participant_attribute_values}}', '{{participant_shares}}', '{{settings_user}}', '{{failed_login_attempts}}', '{{saved_control}}', '{{survey_links}}' + ]; foreach ($truncatableTables as $table) { $actquery = "truncate table ".$table; Yii::app()->db->createCommand($actquery)->execute(); diff --git a/application/commands/WipeCommand.php b/application/commands/WipeCommand.php index 48d4e74edf6..7ed5f2137b6 100644 --- a/application/commands/WipeCommand.php +++ b/application/commands/WipeCommand.php @@ -24,18 +24,26 @@ public function run($sArgument) Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{answers}}"; Yii::app()->db->createCommand($actquery)->execute(); + $actquery = "truncate table {{answer_l10ns}}"; + Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{conditions}}"; Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{defaultvalues}}"; Yii::app()->db->createCommand($actquery)->execute(); + $actquery = "truncate table {{defaultvalue_l10ns}}"; + Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{labels}}"; Yii::app()->db->createCommand($actquery)->execute(); + $actquery = "truncate table {{label_l10ns}}"; + Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{labelsets}}"; Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{groups}}"; Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{questions}}"; Yii::app()->db->createCommand($actquery)->execute(); + $actquery = "truncate table {{question_l10ns}}"; + Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{surveys}}"; Yii::app()->db->createCommand($actquery)->execute(); $actquery = "delete from {{surveys_groups}} where gsid<>1"; @@ -44,6 +52,8 @@ public function run($sArgument) Yii::app()->db->createCommand($actquery)->execute(); $actquery = "delete from {{permissions}} where uid<>1"; Yii::app()->db->createCommand($actquery)->execute(); + $actquery = "truncate table {{permissiontemplates}}"; + Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{quota}}"; Yii::app()->db->createCommand($actquery)->execute(); $actquery = "truncate table {{quota_members}}";