View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
17962Bug reportsImport/Exportpublic2022-05-19 17:18
Reportergabrieljenik Assigned Togabrieljenik  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version3.25.20 
Summary17962: Export fails when called from a Cron process or console application
Description

Error is "Property "ConsoleApplication.action" is not defined."

The bug is due to checing for action inside SurveyDao.php.

Solution: Check if action attribute exists as when running console applicatios, the action attribute is not there.
Long Term Solution: Review that IF statement. Not sure if action should be checked inside of that SurveyDao class.

Steps To Reproduce

Steps to reproduce

Run a plugin that exports survey results from a Cron process or console application

Expected result

Survey results are issued

Actual result

Code Dump

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)3.25.20
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMysql
Server OS (if known)
Webserver software & version (if known)
PHP Version7

Users monitoring this issue

User List There are no users monitoring this issue.

Activities

gabrieljenik

gabrieljenik

2022-03-15 16:17

manager  

image.png (58,873 bytes)   
image.png (58,873 bytes)   
DenisChenu

DenisChenu

2022-03-15 16:22

developer   ~68677

Same issue in 5.x ?
Not only by CLI/cron

My workaround : https://gitlab.com/SondagesPro/managament/responseListAndManage/-/blob/master/responseListAndManage.php#L1062

        /* Hack action id to set to remotecontrol */
        $action = new stdClass();
        $action->id ='remotecontrol';
        Yii::app()->controller->__set('action',$action);
        /* Export as display */
        if (version_compare(Yii::app()->getConfig('versionnumber'),"3.17.14",">=")) {
            $oExport->exportResponses($surveyId,$language, $exportType,$oFormattingOptions, $sFilter);
        } else {
            $oExport->exportSurvey($surveyId,$language, $exportType,$oFormattingOptions, $sFilter);
        }
        Yii::app()->end();
DenisChenu

DenisChenu

2022-03-15 16:22

developer   ~68678

Long Term Solution: Review that IF statement. Not sure if action should be checked inside of that SurveyDao class.

Clearly not !

ollehar

ollehar

2022-03-15 17:42

administrator   ~68682

Can we inject the action instead? Or is this too early in the stack for controller action to be set?

gabrieljenik

gabrieljenik

2022-03-15 17:52

manager   ~68683

When we tried Denis recipe we got we couldn't set properties that doesn't exist.
Will review a bit more.

image-2.png (94,813 bytes)   
image-2.png (94,813 bytes)   
gabrieljenik

gabrieljenik

2022-03-15 17:56

manager   ~68684

Nope, we would need to update application/core/ConsoleApplication.php

ollehar

ollehar

2022-03-15 17:59

administrator   ~68686

Does the LSYii controller have an action property?

DenisChenu

DenisChenu

2022-03-15 18:01

developer   ~68687

Sorry to hear it don't work for Cron.

Real solution : don't use App()->getController()->action

  1. Why this test was added ?
  2. This mean csv file export by remote control are not the same than GUI ?

I supspect a quick fix due to broken remote control export.

gabrieljenik

gabrieljenik

2022-03-15 18:09

manager   ~68688

Does the LSYii controller have an action property?

Actually is on CController.php
@property CAction $action The action currently being executed, null if no active action.

DenisChenu

DenisChenu

2022-03-16 17:29

developer   ~68699

Related : 17951: Direct request is not default in cron action anymore ? https://bugs.limesurvey.org/view.php?id=17951

gabrieljenik

gabrieljenik

2022-05-13 18:35

manager   ~69635

PR for LTS: https://github.com/LimeSurvey/LimeSurvey/pull/2417

gabrieljenik

gabrieljenik

2022-05-16 18:11

manager   ~69677

Master PR: https://github.com/LimeSurvey/LimeSurvey/pull/2419

gabrieljenik

gabrieljenik

2022-05-17 14:34

manager   ~69729

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=33487

gabrieljenik

gabrieljenik

2022-05-17 15:21

manager   ~69739

Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=33488

LimeBot

LimeBot

2022-05-19 17:18

administrator   ~69865

Fixed in Release 5.3.15+220519

Related Changesets

LimeSurvey: master 94ed2461

2022-05-17 14:34:27

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 17962: Export fails when called from a Cron process or console application (#2419) Affected Issues
17962
mod - application/helpers/admin/export/SurveyDao.php Diff File

LimeSurvey: 3.x-LTS 8bae825e

2022-05-17 14:34:39

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 17962: Export fails when called from a Cron process or console application (#2417) Affected Issues
17962
mod - application/helpers/admin/export/SurveyDao.php Diff File

Issue History

Date Modified Username Field Change
2022-03-15 16:17 gabrieljenik New Issue
2022-03-15 16:17 gabrieljenik File Added: image.png
2022-03-15 16:22 DenisChenu Note Added: 68677
2022-03-15 16:22 DenisChenu Bug heat 0 => 2
2022-03-15 16:22 DenisChenu Note Added: 68678
2022-03-15 17:42 ollehar Note Added: 68682
2022-03-15 17:42 ollehar Bug heat 2 => 4
2022-03-15 17:52 gabrieljenik Note Added: 68683
2022-03-15 17:52 gabrieljenik File Added: image-2.png
2022-03-15 17:52 gabrieljenik Bug heat 4 => 6
2022-03-15 17:56 gabrieljenik Note Added: 68684
2022-03-15 17:59 ollehar Note Added: 68686
2022-03-15 18:01 DenisChenu Note Added: 68687
2022-03-15 18:09 gabrieljenik Note Added: 68688
2022-03-16 17:25 galads Assigned To => galads
2022-03-16 17:25 galads Status new => acknowledged
2022-03-16 17:29 DenisChenu Note Added: 68699
2022-05-04 08:30 galads Assigned To galads => gabrieljenik
2022-05-04 08:30 galads Status acknowledged => assigned
2022-05-13 18:35 gabrieljenik Note Added: 69635
2022-05-13 18:36 gabrieljenik Status assigned => testing
2022-05-16 18:11 gabrieljenik Note Added: 69677
2022-05-17 14:34 gabrieljenik Changeset attached => LimeSurvey master 94ed2461
2022-05-17 14:34 gabrieljenik Note Added: 69729
2022-05-17 14:34 gabrieljenik Resolution open => fixed
2022-05-17 14:34 c_schmitz Status testing => resolved
2022-05-17 15:21 gabrieljenik Changeset attached => LimeSurvey 3.x-LTS 8bae825e
2022-05-17 15:21 gabrieljenik Note Added: 69739
2022-05-19 17:18 LimeBot Note Added: 69865
2022-05-19 17:18 LimeBot Status resolved => closed
2022-05-19 17:18 LimeBot Bug heat 6 => 8