-
Notifications
You must be signed in to change notification settings - Fork 988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed issue #CT-652: system slowness when saving survey settings #3740
base: master
Are you sure you want to change the base?
Changes from 5 commits
7faa12b
5291b55
613983c
6477d12
5d81b58
153c3b7
074e810
c5c093e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -835,8 +835,16 @@ public static function getAnswerColumnDefinition($name, $type) | |
*/ | ||
public static function getQuestionXMLPathForBaseType($type) | ||
{ | ||
/** @var QuestionTheme|null */ | ||
$questionTheme = QuestionTheme::model()->findByAttributes([], 'question_type = :question_type AND extends = :extends', ['question_type' => $type, 'extends' => '']); | ||
static $questionThemeCache = []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dislike to use Cache for Static var … Static is not caching ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah makes sense, cant use it everywhere php will run out of memory eventually when we use it to much. Will look at yii's caching There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently : it's a static var :). I don't ask to put it in cache (maybe in future), just more clear name :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also propose the creation of a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (!array_key_exists($type, $questionThemeCache)) { | ||
$questionThemeCache[$type] = self::model()->findByAttributes( | ||
[], | ||
'question_type = :question_type AND extends = :extends', | ||
['question_type' => $type, 'extends' => ''] | ||
); | ||
} | ||
$questionTheme = $questionThemeCache[$type]; | ||
|
||
if (empty($questionTheme)) { | ||
throw new \CException("The Database definition for Questiontype: " . $type . " is missing"); | ||
} | ||
|
@@ -1017,6 +1025,7 @@ public static function getAdditionalAttrFromExtendedTheme($sQuestionThemeName, $ | |
if (\PHP_VERSION_ID < 80000) { | ||
libxml_disable_entity_loader(false); | ||
} | ||
|
||
$questionTheme = QuestionTheme::model()->findByAttributes([], 'name = :name AND extends = :extends', ['name' => $sQuestionThemeName, 'extends' => $type]); | ||
if ($questionTheme !== null) { | ||
$xml_config = simplexml_load_file($questionTheme->getXmlPath() . '/config.xml'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
namespace LimeSurvey\Models\Services; | ||
|
||
use QuestionTheme; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you use QuestionTheme here? |
||
|
||
/** | ||
* Provides question attribute definitions from question themes | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be sure (if survey is set) LimeExpressionManager::getLEMsurveyId() == $surveyid