TwigCommand
extends CConsoleCommand
in package
This class will generate all the twig cache file from command line, even if LimeSurvey is not installed.
The current use case is to generate the translation files using Glot Press. In the future, it could be use to boost performance of first survey rendering (can be useful after a tmp cleanup, an update, etc).
To execute this command : php application/commands/console.php Twig generateTwigTmpFiles
It will execute all the functions
Table of Contents
Properties
- $aLogs : mixed
Methods
- actionGenerateAdminCache() : mixed
- Generate twig cache files for admin views.
- actionGenerateQuestionsCache() : mixed
- Generate twig cache files for each question type.
- actionGenerateQuestionThemesCache() : mixed
- Generate twig cache files for each core question theme
- actionGenerateSurveyThemesCache() : mixed
- Generate twig cache files for each core survey theme
- actionGenerateTwigTmpFiles() : mixed
- Generate twig cache files for each core Survey Theme and core questions views.
- actionIndex() : mixed
- init() : mixed
- Load the needed helpers, set default vaules, etc
- getQuestionThemePaths() : array<string|int, mixed>
- Finds all subfolders of $questionThemeDirectory containing XML files
- renderSurveyTheme() : mixed
- Generate the cache for a given survey theme
- renderSurveyThemeManifest() : mixed
- Generate the cache for the twig strings inside the manifest itself
Properties
$aLogs
public
mixed
$aLogs
Methods
actionGenerateAdminCache()
Generate twig cache files for admin views.
public
actionGenerateAdminCache([string $sAdminDir = null ]) : mixed
NOTE: It's a recursive function which build every twig file in admin area.
Parameters
- $sAdminDir : string = null
-
the directory to parse, where to find the twig files.
actionGenerateQuestionsCache()
Generate twig cache files for each question type.
public
actionGenerateQuestionsCache([string $sQuestionDir = null ]) : mixed
NOTE 1: It's a recursive function, since some directories are the question type itself (it has an answer.twig file) but other containes various question types as subdirectories. NOTE 2: Currenlty arrays are skipped. We need to set default data, so it will be done in LS4, at the same time than Question Theme Editor.
Parameters
- $sQuestionDir : string = null
-
the directory to parse, where to find the answer.twig file.
actionGenerateQuestionThemesCache()
Generate twig cache files for each core question theme
public
actionGenerateQuestionThemesCache([string $themesRootDir = null ]) : mixed
Parameters
- $themesRootDir : string = null
-
the directory to parse, where to find the manifests.
actionGenerateSurveyThemesCache()
Generate twig cache files for each core survey theme
public
actionGenerateSurveyThemesCache([string $sThemeDir = null ]) : mixed
Parameters
- $sThemeDir : string = null
-
the directory to parse, where to find the manifests.
actionGenerateTwigTmpFiles()
Generate twig cache files for each core Survey Theme and core questions views.
public
actionGenerateTwigTmpFiles([mixed $sThemeDir = null ][, mixed $bGenerateSurveyCache = true ][, mixed $bGenerateQuestionsCache = true ][, mixed $bGenerateAdminCache = true ][, mixed $bGenerateQuestionThemeCache = true ]) : mixed
Parameters
- $sThemeDir : mixed = null
- $bGenerateSurveyCache : mixed = true
- $bGenerateQuestionsCache : mixed = true
- $bGenerateAdminCache : mixed = true
- $bGenerateQuestionThemeCache : mixed = true
actionIndex()
public
actionIndex() : mixed
init()
Load the needed helpers, set default vaules, etc
public
init() : mixed
getQuestionThemePaths()
Finds all subfolders of $questionThemeDirectory containing XML files
private
getQuestionThemePaths(string $questionThemeDirectory) : array<string|int, mixed>
Parameters
- $questionThemeDirectory : string
Return values
array<string|int, mixed>renderSurveyTheme()
Generate the cache for a given survey theme
private
renderSurveyTheme(mixed $oTemplateForPreview) : mixed
Parameters
- $oTemplateForPreview : mixed
renderSurveyThemeManifest()
Generate the cache for the twig strings inside the manifest itself
private
renderSurveyThemeManifest(mixed $oTemplateForPreview) : mixed
Parameters
- $oTemplateForPreview : mixed