1 | <?php |
||
35 | class ReportsConfigurationStatus implements \TYPO3\CMS\Reports\StatusProviderInterface { |
||
36 | |||
37 | /** |
||
38 | * Determines the Install Tool's status, mainly concerning its protection. |
||
39 | * |
||
40 | * @return array List of statuses |
||
41 | * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus() |
||
42 | */ |
||
43 | public function getStatus() { |
||
44 | $statuses = array( |
||
45 | 'LangMode' => $this->getLangModes(), |
||
46 | ); |
||
47 | |||
48 | return $statuses; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Check all "root" sys_templates and try to find the value for config.sys_language_mode |
||
53 | */ |
||
54 | public function getLangModes() { |
||
55 | $message = ''; |
||
56 | $checked = array( |
||
57 | 'ok' => array(), |
||
58 | 'fail' => array(), |
||
59 | ); |
||
60 | $value = $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.ok.value'); |
||
61 | $severity = \TYPO3\CMS\Reports\Status::OK; |
||
62 | |||
63 | $rootTpls = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('sys_template', 'root', '1', ''); |
||
64 | |||
65 | foreach ($rootTpls as $tpl) { |
||
66 | /** |
||
67 | * @var \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService |
||
68 | */ |
||
69 | $tmpl = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService'); |
||
70 | $tmpl->tt_track = 0; |
||
71 | $tmpl->init(); |
||
72 | |||
73 | // Gets the rootLine |
||
74 | $sys_page = GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Page\PageRepository'); |
||
75 | $rootLine = $sys_page->getRootLine($tpl['pid']); |
||
76 | $tmpl->runThroughTemplates($rootLine, $tpl['uid']); |
||
77 | |||
78 | $tplRow = $tmpl->ext_getFirstTemplate($tpl['pid'], $tpl['uid']); |
||
79 | $tmpl->generateConfig(); |
||
80 | |||
81 | if (!isset($tmpl->setup['config.']['sys_language_mode']) || $tmpl->setup['config.']['sys_language_mode'] != 'ignore') { |
||
82 | $checked['fail'][] = array($tpl['pid'], $tpl['uid'], $tmpl->setup['config.']['sys_language_mode']); |
||
83 | } |
||
84 | } |
||
85 | |||
86 | if (count($checked['fail'])) { |
||
87 | $severity = \TYPO3\CMS\Reports\Status::WARNING; |
||
88 | $value = $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.value'); |
||
89 | $message .= $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.message') . '<br/>'; |
||
90 | foreach ($checked['fail'] as $fail) { |
||
91 | $message .= vsprintf($GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.message.detail'), $fail) . '<br />'; |
||
92 | } |
||
93 | } |
||
94 | |||
95 | return GeneralUtility::makeInstance('TYPO3\CMS\Reports\Status'', |
||
|
|||
96 | 'EXT:languagevisibility config.sys_language_mode', |
||
97 | $value, |
||
98 | $message, |
||
99 | $severity |
||
100 | ); |
||
101 | } |
||
102 | } |
||
103 | |||
107 |