Hi there,
I am trying to write a plugin to poll Surveys and Responses in a 'direct' event plugin. In it, I have no problem getting Survey and Question Properties. However, when I try to get the Responses, I run into some errors on Session.
First of all, I added the import for common helper:
Code:
Yii::import('application.helpers.common_helper', true);
But still, when I tried to run the command, I got an error with the stack trace as:
Code:
CException: Property "ConsoleHttpSession.connectionID" is not defined. in /var/www/html/framework/base/CComponent.php:173
Stack trace:
#0 /var/www/html/framework/YiiBase.php(227): CComponent->__set('connectionID', 'db')
#1 /var/www/html/framework/base/CModule.php(393): YiiBase::createComponent(Array)
#2 /var/www/html/framework/base/CModule.php(118): CModule->getComponent('session')
#3 /var/www/html/application/helpers/common_helper.php(1429): CModule->__isset('session')
#4 /var/www/html/plugins/CDCEvents/CDCEvents.php(488): createFieldMap(Object(Survey), 'full', true, false, 'en')
#5 /var/www/html/plugins/CDCEvents/CDCEvents.php(370): CDCEvents->exportResponses(35523, 1, 'short')
#6 /var/www/html/plugins/CDCEvents/CDCEvents.php(358): CDCEvents->extractQR('35523', '1')
#7 /var/www/html/plugins/CDCEvents/CDCEvents.php(155): CDCEvents->processQR('35523', '1')
#8 /var/www/html/plugins/CDCEvents/CDCEvents.php(124): CDCEvents->processAllResponsesFor('35523', false)
#9 [internal function]: CDCEvents->direct()
#10 /var/www/html/application/libraries/PluginManager/PluginManager.php(185): call_user_func(Array)
#11 /var/www/html/application/commands/PluginCommand.php(45): LimeSurvey\PluginManager\PluginManager->dispatchEvent(Object(PluginEvent))
#12 [internal function]: PluginCommand->actionIndex('CDCEvents', 'responses', '[{"survey": "35...')
#13 /var/www/html/framework/console/CConsoleCommand.php(172): ReflectionMethod->invokeArgs(Object(PluginCommand), Array)
#14 /var/www/html/framework/console/CConsoleCommandRunner.php(71): CConsoleCommand->run(Array)
#15 /var/www/html/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run(Array)
#16 /var/www/html/framework/base/CApplication.php(185): CConsoleApplication->processRequest()
#17 /var/www/html/application/commands/console.php(76): CApplication->run()
#18 {main}
It seems that the ConsoleApplication is using "ConsoleHttpSession", but the system is still thinking it is "application.core.web.DbHttpSession" and try to set "connectionID" to 'db'.
I tried to make some change to ./application/commands/console.php to replace the "ConsoleHttpSession" with "application.core.web.DbHttpSession" using:
Code:
$config['components']['session']['class'] = 'application.core.web.DbHttpSession';
$config['components']['session']['connectionID'] = 'db';
$config['components']['session']['sessionTableName'] = '{{sessions}}';
Now I got an errror with the stack trace as:
Code:
PHP Error[2]: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent
in file /var/www/html/framework/web/CHttpSession.php at line 267
#0 /var/www/html/framework/web/CHttpSession.php(267): session_set_cookie_params()
#1 /var/www/html/framework/base/CComponent.php(152): DbHttpSession->setCookieParams()
#2 /var/www/html/framework/YiiBase.php(227): DbHttpSession->__set()
#3 /var/www/html/framework/base/CModule.php(393): createComponent()
#4 /var/www/html/framework/base/CModule.php(118): ConsoleApplication->getComponent()
#5 /var/www/html/application/helpers/common_helper.php(1429): ConsoleApplication->__isset()
#6 /var/www/html/plugins/CDCEvents/CDCEvents.php(488): createFieldMap()
#7 /var/www/html/plugins/CDCEvents/CDCEvents.php(370): CDCEvents->exportResponses()
#8 /var/www/html/plugins/CDCEvents/CDCEvents.php(358): CDCEvents->extractQR()
#9 /var/www/html/plugins/CDCEvents/CDCEvents.php(155): CDCEvents->processQR()
#10 /var/www/html/plugins/CDCEvents/CDCEvents.php(124): CDCEvents->processAllResponsesFor()
#11 unknown(0): CDCEvents->direct()
#12 /var/www/html/application/libraries/PluginManager/PluginManager.php(185): call_user_func()
#13 /var/www/html/application/commands/PluginCommand.php(45): LimeSurvey\PluginManager\PluginManager->dispatchEvent()
#14 unknown(0): PluginCommand->actionIndex()
#15 /var/www/html/framework/console/CConsoleCommand.php(172): ReflectionMethod->invokeArgs()
#16 /var/www/html/framework/console/CConsoleCommandRunner.php(71): PluginCommand->run()
#17 /var/www/html/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run()
#18 /var/www/html/framework/base/CApplication.php(185): ConsoleApplication->processRequest()
#19 /var/www/html/application/commands/console.php(76): ConsoleApplication->run()
We are stuck now and would really appreciate any help on the issue.