We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -10,49 +10,49 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | return array ( |
13 | - 'ctrl' => array ( |
|
14 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores', |
|
15 | - 'label' => 'label', |
|
16 | - 'tstamp' => 'tstamp', |
|
17 | - 'crdate' => 'crdate', |
|
18 | - 'cruser_id' => 'cruser_id', |
|
19 | - 'default_sortby' => 'ORDER BY label', |
|
20 | - 'delete' => 'deleted', |
|
21 | - 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfsolrcores.png', |
|
22 | - 'rootLevel' => -1, |
|
23 | - 'dividers2tabs' => 2, |
|
24 | - 'searchFields' => 'label,index_name', |
|
25 | - ), |
|
26 | - 'feInterface' => array ( |
|
27 | - 'fe_admin_fieldList' => '', |
|
28 | - ), |
|
29 | - 'interface' => array ( |
|
30 | - 'showRecordFieldList' => 'label,index_name', |
|
31 | - ), |
|
32 | - 'columns' => array ( |
|
33 | - 'label' => array ( |
|
34 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.label', |
|
35 | - 'config' => array ( |
|
36 | - 'type' => 'input', |
|
37 | - 'size' => 30, |
|
38 | - 'max' => 255, |
|
39 | - 'eval' => 'required,trim', |
|
40 | - ), |
|
41 | - ), |
|
42 | - 'index_name' => array ( |
|
43 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.index_name', |
|
44 | - 'config' => array ( |
|
45 | - 'type' => 'none', |
|
46 | - 'size' => 30, |
|
47 | - 'max' => 255, |
|
48 | - 'eval' => 'alphanum,unique', |
|
49 | - ), |
|
50 | - ), |
|
51 | - ), |
|
52 | - 'types' => array ( |
|
53 | - '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.tab1, label;;;;1-1-1, index_name;;;;2-2-2'), |
|
54 | - ), |
|
55 | - 'palettes' => array ( |
|
56 | - '1' => array ('showitem' => ''), |
|
57 | - ), |
|
13 | + 'ctrl' => array ( |
|
14 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores', |
|
15 | + 'label' => 'label', |
|
16 | + 'tstamp' => 'tstamp', |
|
17 | + 'crdate' => 'crdate', |
|
18 | + 'cruser_id' => 'cruser_id', |
|
19 | + 'default_sortby' => 'ORDER BY label', |
|
20 | + 'delete' => 'deleted', |
|
21 | + 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfsolrcores.png', |
|
22 | + 'rootLevel' => -1, |
|
23 | + 'dividers2tabs' => 2, |
|
24 | + 'searchFields' => 'label,index_name', |
|
25 | + ), |
|
26 | + 'feInterface' => array ( |
|
27 | + 'fe_admin_fieldList' => '', |
|
28 | + ), |
|
29 | + 'interface' => array ( |
|
30 | + 'showRecordFieldList' => 'label,index_name', |
|
31 | + ), |
|
32 | + 'columns' => array ( |
|
33 | + 'label' => array ( |
|
34 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.label', |
|
35 | + 'config' => array ( |
|
36 | + 'type' => 'input', |
|
37 | + 'size' => 30, |
|
38 | + 'max' => 255, |
|
39 | + 'eval' => 'required,trim', |
|
40 | + ), |
|
41 | + ), |
|
42 | + 'index_name' => array ( |
|
43 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.index_name', |
|
44 | + 'config' => array ( |
|
45 | + 'type' => 'none', |
|
46 | + 'size' => 30, |
|
47 | + 'max' => 255, |
|
48 | + 'eval' => 'alphanum,unique', |
|
49 | + ), |
|
50 | + ), |
|
51 | + ), |
|
52 | + 'types' => array ( |
|
53 | + '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.tab1, label;;;;1-1-1, index_name;;;;2-2-2'), |
|
54 | + ), |
|
55 | + 'palettes' => array ( |
|
56 | + '1' => array ('showitem' => ''), |
|
57 | + ), |
|
58 | 58 | ); |
@@ -10,249 +10,249 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | return array ( |
13 | - 'ctrl' => array ( |
|
14 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections', |
|
15 | - 'label' => 'label', |
|
16 | - 'tstamp' => 'tstamp', |
|
17 | - 'crdate' => 'crdate', |
|
18 | - 'cruser_id' => 'cruser_id', |
|
19 | - 'fe_cruser_id' => 'fe_cruser_id', |
|
20 | - 'fe_admin_lock' => 'fe_admin_lock', |
|
21 | - 'languageField' => 'sys_language_uid', |
|
22 | - 'transOrigPointerField' => 'l18n_parent', |
|
23 | - 'transOrigDiffSourceField' => 'l18n_diffsource', |
|
24 | - 'default_sortby' => 'ORDER BY label', |
|
25 | - 'delete' => 'deleted', |
|
26 | - 'enablecolumns' => array ( |
|
27 | - 'disabled' => 'hidden', |
|
28 | - 'fe_group' => 'fe_group', |
|
29 | - ), |
|
30 | - 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfcollections.png', |
|
31 | - 'rootLevel' => 0, |
|
32 | - 'dividers2tabs' => 2, |
|
33 | - 'searchFields' => 'label,index_name,oai_name,fe_cruser_id', |
|
34 | - ), |
|
35 | - 'feInterface' => array ( |
|
36 | - 'fe_admin_fieldList' => 'label,description,thumbnail,documents', |
|
37 | - ), |
|
38 | - 'interface' => array ( |
|
39 | - 'showRecordFieldList' => 'label,index_name,oai_name,fe_cruser_id', |
|
40 | - ), |
|
41 | - 'columns' => array ( |
|
42 | - 'sys_language_uid' => array ( |
|
43 | - 'exclude' => 1, |
|
44 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', |
|
45 | - 'config' => array ( |
|
46 | - 'type' => 'select', |
|
47 | - 'renderType' => 'selectSingle', |
|
48 | - 'foreign_table' => 'sys_language', |
|
49 | - 'foreign_table_where' => 'ORDER BY sys_language.title', |
|
50 | - 'items' => array ( |
|
51 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), |
|
52 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0), |
|
53 | - ), |
|
54 | - 'default' => 0, |
|
55 | - ), |
|
56 | - ), |
|
57 | - 'l18n_parent' => array ( |
|
58 | - 'displayCond' => 'FIELD:sys_language_uid:>:0', |
|
59 | - 'exclude' => 1, |
|
60 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', |
|
61 | - 'config' => array ( |
|
62 | - 'type' => 'select', |
|
63 | - 'renderType' => 'selectSingle', |
|
64 | - 'items' => array ( |
|
65 | - array ('', 0), |
|
66 | - ), |
|
67 | - 'foreign_table' => 'tx_dlf_collections', |
|
68 | - 'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0)', |
|
69 | - ), |
|
70 | - ), |
|
71 | - 'l18n_diffsource' => array ( |
|
72 | - 'config' => array ( |
|
73 | - 'type' => 'passthrough' |
|
74 | - ), |
|
75 | - ), |
|
76 | - 'hidden' => array ( |
|
77 | - 'exclude' => 1, |
|
78 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', |
|
79 | - 'config' => array ( |
|
80 | - 'type' => 'check', |
|
81 | - 'default' => 0, |
|
82 | - ), |
|
83 | - ), |
|
84 | - 'fe_group' => array ( |
|
85 | - 'exclude' => 1, |
|
86 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group', |
|
87 | - 'config' => array ( |
|
88 | - 'type' => 'select', |
|
89 | - 'renderType' => 'selectMultipleSideBySide', |
|
90 | - 'items' => array ( |
|
91 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1), |
|
92 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2), |
|
93 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--'), |
|
94 | - ), |
|
95 | - 'foreign_table' => 'fe_groups', |
|
96 | - 'size' => 5, |
|
97 | - 'autoSizeMax' => 15, |
|
98 | - 'minitems' => 0, |
|
99 | - 'maxitems' => 20, |
|
100 | - 'exclusiveKeys' => '-1,-2', |
|
101 | - ), |
|
102 | - ), |
|
103 | - 'label' => array ( |
|
104 | - 'exclude' => 1, |
|
105 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.label', |
|
106 | - 'config' => array ( |
|
107 | - 'type' => 'input', |
|
108 | - 'size' => 30, |
|
109 | - 'max' => 255, |
|
110 | - 'eval' => 'required,trim', |
|
111 | - ), |
|
112 | - ), |
|
113 | - 'index_name' => array ( |
|
114 | - 'exclude' => 1, |
|
115 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.index_name', |
|
116 | - 'config' => array ( |
|
117 | - 'type' => 'none', |
|
118 | - 'size' => 30, |
|
119 | - 'max' => 255, |
|
120 | - 'eval' => 'required,uniqueInPid', |
|
121 | - ), |
|
122 | - ), |
|
123 | - 'oai_name' => array ( |
|
124 | - 'exclude' => 1, |
|
125 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.oai_name', |
|
126 | - 'config' => array ( |
|
127 | - 'type' => 'input', |
|
128 | - 'size' => 30, |
|
129 | - 'max' => 255, |
|
130 | - 'eval' => 'nospace,alphanum_x,uniqueInPid', |
|
131 | - ), |
|
132 | - ), |
|
133 | - 'description' => array ( |
|
134 | - 'exclude' => 1, |
|
135 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.description', |
|
136 | - 'config' => array ( |
|
137 | - 'type' => 'text', |
|
138 | - 'cols' => 30, |
|
139 | - 'rows' => 10, |
|
140 | - 'wrap' => 'virtual', |
|
141 | - ), |
|
142 | - 'defaultExtras' => 'richtext[undo,redo,cut,copy,paste,link,image,line,acronym,chMode,blockstylelabel,formatblock,blockstyle,textstylelabel,textstyle,bold,italic,unorderedlist,orderedlist]:rte_transform[mode=ts_css]', |
|
143 | - ), |
|
144 | - 'thumbnail' => array ( |
|
145 | - 'exclude' => 1, |
|
146 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.thumbnail', |
|
147 | - 'config' => array ( |
|
148 | - 'type' => 'group', |
|
149 | - 'internal_type' => 'file_reference', |
|
150 | - 'allowed' => 'gif,jpg,png', |
|
151 | - 'size' => 1, |
|
152 | - 'minitems' => 0, |
|
153 | - 'maxitems' => 1, |
|
154 | - ), |
|
155 | - ), |
|
156 | - 'priority' => array ( |
|
157 | - 'exclude' => 1, |
|
158 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.priority', |
|
159 | - 'config' => array ( |
|
160 | - 'type' => 'select', |
|
161 | - 'renderType' => 'selectSingle', |
|
162 | - 'items' => array ( |
|
163 | - array ('1', 1), |
|
164 | - array ('2', 2), |
|
165 | - array ('3', 3), |
|
166 | - array ('4', 4), |
|
167 | - array ('5', 5), |
|
168 | - ), |
|
169 | - 'size' => 1, |
|
170 | - 'minitems' => 1, |
|
171 | - 'maxitems' => 1, |
|
172 | - 'default' => 3, |
|
173 | - ), |
|
174 | - ), |
|
175 | - 'documents' => array ( |
|
176 | - 'exclude' => 1, |
|
177 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.documents', |
|
178 | - 'config' => array ( |
|
179 | - 'type' => 'select', |
|
180 | - 'renderType' => 'selectSingleBox', |
|
181 | - 'foreign_table' => 'tx_dlf_documents', |
|
182 | - 'foreign_table_where' => 'AND tx_dlf_documents.pid=###CURRENT_PID### ORDER BY tx_dlf_documents.title_sorting', |
|
183 | - 'size' => 5, |
|
184 | - 'autoSizeMax' => 15, |
|
185 | - 'minitems' => 0, |
|
186 | - 'maxitems' => 1048576, |
|
187 | - 'MM' => 'tx_dlf_relations', |
|
188 | - 'MM_match_fields' => array ( |
|
189 | - 'ident' => 'docs_colls', |
|
190 | - ), |
|
191 | - 'MM_opposite_field' => 'collections', |
|
192 | - ), |
|
193 | - ), |
|
194 | - 'owner' => array ( |
|
195 | - 'exclude' => 1, |
|
196 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.owner', |
|
197 | - 'config' => array ( |
|
198 | - 'type' => 'select', |
|
199 | - 'renderType' => 'selectSingle', |
|
200 | - 'items' => array ( |
|
201 | - array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.owner.none', 0), |
|
202 | - ), |
|
203 | - 'foreign_table' => 'tx_dlf_libraries', |
|
204 | - 'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label', |
|
205 | - 'size' => 1, |
|
206 | - 'minitems' => 1, |
|
207 | - 'maxitems' => 1, |
|
208 | - ), |
|
209 | - ), |
|
210 | - 'fe_cruser_id' => array ( |
|
211 | - 'exclude' => 1, |
|
212 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_cruser_id', |
|
213 | - 'config' => array ( |
|
214 | - 'type' => 'select', |
|
215 | - 'renderType' => 'selectSingle', |
|
216 | - 'items' => array ( |
|
217 | - array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_cruser_id.none', 0), |
|
218 | - ), |
|
219 | - 'foreign_table' => 'fe_users', |
|
220 | - 'foreign_table_where' => 'ORDER BY fe_users.username', |
|
221 | - 'size' => 1, |
|
222 | - 'minitems' => 1, |
|
223 | - 'maxitems' => 1, |
|
224 | - ), |
|
225 | - ), |
|
226 | - 'fe_admin_lock' => array ( |
|
227 | - 'exclude' => 1, |
|
228 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_admin_lock', |
|
229 | - 'config' => array ( |
|
230 | - 'type' => 'check', |
|
231 | - 'default' => 0, |
|
232 | - ), |
|
233 | - ), |
|
234 | - 'status' => array ( |
|
235 | - 'exclude' => 1, |
|
236 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.status', |
|
237 | - 'config' => array ( |
|
238 | - 'type' => 'select', |
|
239 | - 'renderType' => 'selectSingle', |
|
240 | - 'items' => array ( |
|
241 | - array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.status.default', 0), |
|
242 | - ), |
|
243 | - 'size' => 1, |
|
244 | - 'minitems' => 1, |
|
245 | - 'maxitems' => 1, |
|
246 | - 'default' => 0, |
|
247 | - ), |
|
248 | - ), |
|
249 | - ), |
|
250 | - 'types' => array ( |
|
251 | - '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab1, label,--palette--;;1;;1-1-1, description,--palette--;;2;;2-2-2, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab3, hidden;;;;1-1-1, fe_group;;;;2-2-2, status;;;;3-3-3, owner;;;;4-4-4, fe_cruser_id,--palette--;;3'), |
|
252 | - ), |
|
253 | - 'palettes' => array ( |
|
254 | - '1' => array ('showitem' => 'index_name, --linebreak--, oai_name', 'canNotCollapse' => 1), |
|
255 | - '2' => array ('showitem' => 'thumbnail, priority', 'canNotCollapse' => 1), |
|
256 | - '3' => array ('showitem' => 'fe_admin_lock', 'canNotCollapse' => 1), |
|
257 | - ), |
|
13 | + 'ctrl' => array ( |
|
14 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections', |
|
15 | + 'label' => 'label', |
|
16 | + 'tstamp' => 'tstamp', |
|
17 | + 'crdate' => 'crdate', |
|
18 | + 'cruser_id' => 'cruser_id', |
|
19 | + 'fe_cruser_id' => 'fe_cruser_id', |
|
20 | + 'fe_admin_lock' => 'fe_admin_lock', |
|
21 | + 'languageField' => 'sys_language_uid', |
|
22 | + 'transOrigPointerField' => 'l18n_parent', |
|
23 | + 'transOrigDiffSourceField' => 'l18n_diffsource', |
|
24 | + 'default_sortby' => 'ORDER BY label', |
|
25 | + 'delete' => 'deleted', |
|
26 | + 'enablecolumns' => array ( |
|
27 | + 'disabled' => 'hidden', |
|
28 | + 'fe_group' => 'fe_group', |
|
29 | + ), |
|
30 | + 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfcollections.png', |
|
31 | + 'rootLevel' => 0, |
|
32 | + 'dividers2tabs' => 2, |
|
33 | + 'searchFields' => 'label,index_name,oai_name,fe_cruser_id', |
|
34 | + ), |
|
35 | + 'feInterface' => array ( |
|
36 | + 'fe_admin_fieldList' => 'label,description,thumbnail,documents', |
|
37 | + ), |
|
38 | + 'interface' => array ( |
|
39 | + 'showRecordFieldList' => 'label,index_name,oai_name,fe_cruser_id', |
|
40 | + ), |
|
41 | + 'columns' => array ( |
|
42 | + 'sys_language_uid' => array ( |
|
43 | + 'exclude' => 1, |
|
44 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', |
|
45 | + 'config' => array ( |
|
46 | + 'type' => 'select', |
|
47 | + 'renderType' => 'selectSingle', |
|
48 | + 'foreign_table' => 'sys_language', |
|
49 | + 'foreign_table_where' => 'ORDER BY sys_language.title', |
|
50 | + 'items' => array ( |
|
51 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), |
|
52 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0), |
|
53 | + ), |
|
54 | + 'default' => 0, |
|
55 | + ), |
|
56 | + ), |
|
57 | + 'l18n_parent' => array ( |
|
58 | + 'displayCond' => 'FIELD:sys_language_uid:>:0', |
|
59 | + 'exclude' => 1, |
|
60 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', |
|
61 | + 'config' => array ( |
|
62 | + 'type' => 'select', |
|
63 | + 'renderType' => 'selectSingle', |
|
64 | + 'items' => array ( |
|
65 | + array ('', 0), |
|
66 | + ), |
|
67 | + 'foreign_table' => 'tx_dlf_collections', |
|
68 | + 'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0)', |
|
69 | + ), |
|
70 | + ), |
|
71 | + 'l18n_diffsource' => array ( |
|
72 | + 'config' => array ( |
|
73 | + 'type' => 'passthrough' |
|
74 | + ), |
|
75 | + ), |
|
76 | + 'hidden' => array ( |
|
77 | + 'exclude' => 1, |
|
78 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', |
|
79 | + 'config' => array ( |
|
80 | + 'type' => 'check', |
|
81 | + 'default' => 0, |
|
82 | + ), |
|
83 | + ), |
|
84 | + 'fe_group' => array ( |
|
85 | + 'exclude' => 1, |
|
86 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group', |
|
87 | + 'config' => array ( |
|
88 | + 'type' => 'select', |
|
89 | + 'renderType' => 'selectMultipleSideBySide', |
|
90 | + 'items' => array ( |
|
91 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1), |
|
92 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2), |
|
93 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--'), |
|
94 | + ), |
|
95 | + 'foreign_table' => 'fe_groups', |
|
96 | + 'size' => 5, |
|
97 | + 'autoSizeMax' => 15, |
|
98 | + 'minitems' => 0, |
|
99 | + 'maxitems' => 20, |
|
100 | + 'exclusiveKeys' => '-1,-2', |
|
101 | + ), |
|
102 | + ), |
|
103 | + 'label' => array ( |
|
104 | + 'exclude' => 1, |
|
105 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.label', |
|
106 | + 'config' => array ( |
|
107 | + 'type' => 'input', |
|
108 | + 'size' => 30, |
|
109 | + 'max' => 255, |
|
110 | + 'eval' => 'required,trim', |
|
111 | + ), |
|
112 | + ), |
|
113 | + 'index_name' => array ( |
|
114 | + 'exclude' => 1, |
|
115 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.index_name', |
|
116 | + 'config' => array ( |
|
117 | + 'type' => 'none', |
|
118 | + 'size' => 30, |
|
119 | + 'max' => 255, |
|
120 | + 'eval' => 'required,uniqueInPid', |
|
121 | + ), |
|
122 | + ), |
|
123 | + 'oai_name' => array ( |
|
124 | + 'exclude' => 1, |
|
125 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.oai_name', |
|
126 | + 'config' => array ( |
|
127 | + 'type' => 'input', |
|
128 | + 'size' => 30, |
|
129 | + 'max' => 255, |
|
130 | + 'eval' => 'nospace,alphanum_x,uniqueInPid', |
|
131 | + ), |
|
132 | + ), |
|
133 | + 'description' => array ( |
|
134 | + 'exclude' => 1, |
|
135 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.description', |
|
136 | + 'config' => array ( |
|
137 | + 'type' => 'text', |
|
138 | + 'cols' => 30, |
|
139 | + 'rows' => 10, |
|
140 | + 'wrap' => 'virtual', |
|
141 | + ), |
|
142 | + 'defaultExtras' => 'richtext[undo,redo,cut,copy,paste,link,image,line,acronym,chMode,blockstylelabel,formatblock,blockstyle,textstylelabel,textstyle,bold,italic,unorderedlist,orderedlist]:rte_transform[mode=ts_css]', |
|
143 | + ), |
|
144 | + 'thumbnail' => array ( |
|
145 | + 'exclude' => 1, |
|
146 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.thumbnail', |
|
147 | + 'config' => array ( |
|
148 | + 'type' => 'group', |
|
149 | + 'internal_type' => 'file_reference', |
|
150 | + 'allowed' => 'gif,jpg,png', |
|
151 | + 'size' => 1, |
|
152 | + 'minitems' => 0, |
|
153 | + 'maxitems' => 1, |
|
154 | + ), |
|
155 | + ), |
|
156 | + 'priority' => array ( |
|
157 | + 'exclude' => 1, |
|
158 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.priority', |
|
159 | + 'config' => array ( |
|
160 | + 'type' => 'select', |
|
161 | + 'renderType' => 'selectSingle', |
|
162 | + 'items' => array ( |
|
163 | + array ('1', 1), |
|
164 | + array ('2', 2), |
|
165 | + array ('3', 3), |
|
166 | + array ('4', 4), |
|
167 | + array ('5', 5), |
|
168 | + ), |
|
169 | + 'size' => 1, |
|
170 | + 'minitems' => 1, |
|
171 | + 'maxitems' => 1, |
|
172 | + 'default' => 3, |
|
173 | + ), |
|
174 | + ), |
|
175 | + 'documents' => array ( |
|
176 | + 'exclude' => 1, |
|
177 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.documents', |
|
178 | + 'config' => array ( |
|
179 | + 'type' => 'select', |
|
180 | + 'renderType' => 'selectSingleBox', |
|
181 | + 'foreign_table' => 'tx_dlf_documents', |
|
182 | + 'foreign_table_where' => 'AND tx_dlf_documents.pid=###CURRENT_PID### ORDER BY tx_dlf_documents.title_sorting', |
|
183 | + 'size' => 5, |
|
184 | + 'autoSizeMax' => 15, |
|
185 | + 'minitems' => 0, |
|
186 | + 'maxitems' => 1048576, |
|
187 | + 'MM' => 'tx_dlf_relations', |
|
188 | + 'MM_match_fields' => array ( |
|
189 | + 'ident' => 'docs_colls', |
|
190 | + ), |
|
191 | + 'MM_opposite_field' => 'collections', |
|
192 | + ), |
|
193 | + ), |
|
194 | + 'owner' => array ( |
|
195 | + 'exclude' => 1, |
|
196 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.owner', |
|
197 | + 'config' => array ( |
|
198 | + 'type' => 'select', |
|
199 | + 'renderType' => 'selectSingle', |
|
200 | + 'items' => array ( |
|
201 | + array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.owner.none', 0), |
|
202 | + ), |
|
203 | + 'foreign_table' => 'tx_dlf_libraries', |
|
204 | + 'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label', |
|
205 | + 'size' => 1, |
|
206 | + 'minitems' => 1, |
|
207 | + 'maxitems' => 1, |
|
208 | + ), |
|
209 | + ), |
|
210 | + 'fe_cruser_id' => array ( |
|
211 | + 'exclude' => 1, |
|
212 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_cruser_id', |
|
213 | + 'config' => array ( |
|
214 | + 'type' => 'select', |
|
215 | + 'renderType' => 'selectSingle', |
|
216 | + 'items' => array ( |
|
217 | + array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_cruser_id.none', 0), |
|
218 | + ), |
|
219 | + 'foreign_table' => 'fe_users', |
|
220 | + 'foreign_table_where' => 'ORDER BY fe_users.username', |
|
221 | + 'size' => 1, |
|
222 | + 'minitems' => 1, |
|
223 | + 'maxitems' => 1, |
|
224 | + ), |
|
225 | + ), |
|
226 | + 'fe_admin_lock' => array ( |
|
227 | + 'exclude' => 1, |
|
228 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_admin_lock', |
|
229 | + 'config' => array ( |
|
230 | + 'type' => 'check', |
|
231 | + 'default' => 0, |
|
232 | + ), |
|
233 | + ), |
|
234 | + 'status' => array ( |
|
235 | + 'exclude' => 1, |
|
236 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.status', |
|
237 | + 'config' => array ( |
|
238 | + 'type' => 'select', |
|
239 | + 'renderType' => 'selectSingle', |
|
240 | + 'items' => array ( |
|
241 | + array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.status.default', 0), |
|
242 | + ), |
|
243 | + 'size' => 1, |
|
244 | + 'minitems' => 1, |
|
245 | + 'maxitems' => 1, |
|
246 | + 'default' => 0, |
|
247 | + ), |
|
248 | + ), |
|
249 | + ), |
|
250 | + 'types' => array ( |
|
251 | + '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab1, label,--palette--;;1;;1-1-1, description,--palette--;;2;;2-2-2, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab3, hidden;;;;1-1-1, fe_group;;;;2-2-2, status;;;;3-3-3, owner;;;;4-4-4, fe_cruser_id,--palette--;;3'), |
|
252 | + ), |
|
253 | + 'palettes' => array ( |
|
254 | + '1' => array ('showitem' => 'index_name, --linebreak--, oai_name', 'canNotCollapse' => 1), |
|
255 | + '2' => array ('showitem' => 'thumbnail, priority', 'canNotCollapse' => 1), |
|
256 | + '3' => array ('showitem' => 'fe_admin_lock', 'canNotCollapse' => 1), |
|
257 | + ), |
|
258 | 258 | ); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (!defined('TYPO3_cliMode')) { |
13 | 13 | |
14 | - die('You cannot run this script directly!'); |
|
14 | + die('You cannot run this script directly!'); |
|
15 | 15 | |
16 | 16 | } |
17 | 17 | |
@@ -25,208 +25,208 @@ discard block |
||
25 | 25 | */ |
26 | 26 | class tx_dlf_cli extends \TYPO3\CMS\Core\Controller\CommandLineController { |
27 | 27 | |
28 | - /** |
|
29 | - * This is the return code. |
|
30 | - * |
|
31 | - * @var integer |
|
32 | - * @access protected |
|
33 | - */ |
|
34 | - protected $return = 0; |
|
28 | + /** |
|
29 | + * This is the return code. |
|
30 | + * |
|
31 | + * @var integer |
|
32 | + * @access protected |
|
33 | + */ |
|
34 | + protected $return = 0; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Main function of the script. |
|
38 | - * |
|
39 | - * @access public |
|
40 | - * |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public function main() { |
|
36 | + /** |
|
37 | + * Main function of the script. |
|
38 | + * |
|
39 | + * @access public |
|
40 | + * |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public function main() { |
|
44 | 44 | |
45 | - switch ((string) $this->cli_args['_DEFAULT'][1]) { |
|
45 | + switch ((string) $this->cli_args['_DEFAULT'][1]) { |
|
46 | 46 | |
47 | - // (Re-)Index a single document. |
|
48 | - case 'index': |
|
47 | + // (Re-)Index a single document. |
|
48 | + case 'index': |
|
49 | 49 | |
50 | - // Add command line arguments. |
|
51 | - $this->cli_options[] = array ('-doc UID/URL', 'UID or (properly encoded) URL of the document.'); |
|
50 | + // Add command line arguments. |
|
51 | + $this->cli_options[] = array ('-doc UID/URL', 'UID or (properly encoded) URL of the document.'); |
|
52 | 52 | |
53 | - $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); |
|
53 | + $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); |
|
54 | 54 | |
55 | - $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); |
|
55 | + $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); |
|
56 | 56 | |
57 | - // Check the command line arguments. |
|
58 | - $this->cli_validateArgs(); |
|
57 | + // Check the command line arguments. |
|
58 | + $this->cli_validateArgs(); |
|
59 | 59 | |
60 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-doc'][0]) |
|
61 | - && !\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->cli_args['-doc'][0])) { |
|
60 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-doc'][0]) |
|
61 | + && !\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->cli_args['-doc'][0])) { |
|
62 | 62 | |
63 | - $this->cli_echo('ERROR: "'.$this->cli_args['-doc'][0].'" is not a valid document UID or URL.'.LF, TRUE); |
|
63 | + $this->cli_echo('ERROR: "'.$this->cli_args['-doc'][0].'" is not a valid document UID or URL.'.LF, TRUE); |
|
64 | 64 | |
65 | - $this->return = 1; |
|
65 | + $this->return = 1; |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { |
|
69 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { |
|
70 | 70 | |
71 | - $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); |
|
71 | + $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); |
|
72 | 72 | |
73 | - $this->return = 1; |
|
73 | + $this->return = 1; |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { |
|
77 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { |
|
78 | 78 | |
79 | - $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); |
|
79 | + $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); |
|
80 | 80 | |
81 | - $this->return = 1; |
|
81 | + $this->return = 1; |
|
82 | 82 | |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - if ($this->return > 0) { |
|
85 | + if ($this->return > 0) { |
|
86 | 86 | |
87 | - break; |
|
87 | + break; |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | - // Get the document... |
|
92 | - $doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); |
|
91 | + // Get the document... |
|
92 | + $doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); |
|
93 | 93 | |
94 | - if ($doc->ready) { |
|
94 | + if ($doc->ready) { |
|
95 | 95 | |
96 | - // ...and save it to the database... |
|
97 | - if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { |
|
96 | + // ...and save it to the database... |
|
97 | + if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { |
|
98 | 98 | |
99 | - $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" not saved and indexed.'.LF, TRUE); |
|
99 | + $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" not saved and indexed.'.LF, TRUE); |
|
100 | 100 | |
101 | - $this->return = 1; |
|
101 | + $this->return = 1; |
|
102 | 102 | |
103 | - } |
|
103 | + } |
|
104 | 104 | |
105 | - } else { |
|
105 | + } else { |
|
106 | 106 | |
107 | - $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" could not be loaded.'.LF, TRUE); |
|
107 | + $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" could not be loaded.'.LF, TRUE); |
|
108 | 108 | |
109 | - $this->return = 1; |
|
109 | + $this->return = 1; |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - break; |
|
113 | + break; |
|
114 | 114 | |
115 | - // Re-index all documents of a collection. |
|
116 | - case 'reindex': |
|
115 | + // Re-index all documents of a collection. |
|
116 | + case 'reindex': |
|
117 | 117 | |
118 | - // Add command line arguments. |
|
119 | - $this->cli_options[] = array ('-coll UID', 'UID of the collection.'); |
|
118 | + // Add command line arguments. |
|
119 | + $this->cli_options[] = array ('-coll UID', 'UID of the collection.'); |
|
120 | 120 | |
121 | - $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); |
|
121 | + $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); |
|
122 | 122 | |
123 | - $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); |
|
123 | + $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); |
|
124 | 124 | |
125 | - // Check the command line arguments. |
|
126 | - $this->cli_validateArgs(); |
|
125 | + // Check the command line arguments. |
|
126 | + $this->cli_validateArgs(); |
|
127 | 127 | |
128 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-coll'][0])) { |
|
128 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-coll'][0])) { |
|
129 | 129 | |
130 | - $this->cli_echo('ERROR: "'.$this->cli_args['-coll'][0].'" is not a valid collection UID.'.LF, TRUE); |
|
130 | + $this->cli_echo('ERROR: "'.$this->cli_args['-coll'][0].'" is not a valid collection UID.'.LF, TRUE); |
|
131 | 131 | |
132 | - $this->return = 1; |
|
132 | + $this->return = 1; |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { |
|
136 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { |
|
137 | 137 | |
138 | - $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); |
|
138 | + $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); |
|
139 | 139 | |
140 | - $this->return = 1; |
|
140 | + $this->return = 1; |
|
141 | 141 | |
142 | - } |
|
142 | + } |
|
143 | 143 | |
144 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { |
|
144 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { |
|
145 | 145 | |
146 | - $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); |
|
146 | + $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); |
|
147 | 147 | |
148 | - $this->return = 1; |
|
148 | + $this->return = 1; |
|
149 | 149 | |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | - if ($this->return > 0) { |
|
152 | + if ($this->return > 0) { |
|
153 | 153 | |
154 | - break; |
|
154 | + break; |
|
155 | 155 | |
156 | - } |
|
156 | + } |
|
157 | 157 | |
158 | - // Get the collection. |
|
159 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
160 | - 'tx_dlf_documents.uid AS uid', |
|
161 | - 'tx_dlf_documents', |
|
162 | - 'tx_dlf_relations', |
|
163 | - 'tx_dlf_collections', |
|
164 | - 'AND tx_dlf_collections.uid='.intval($this->cli_args['-coll'][0]).' AND tx_dlf_collections.pid='.intval($this->cli_args['-pid'][0]).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
165 | - '', |
|
166 | - '', |
|
167 | - '' |
|
168 | - ); |
|
158 | + // Get the collection. |
|
159 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
160 | + 'tx_dlf_documents.uid AS uid', |
|
161 | + 'tx_dlf_documents', |
|
162 | + 'tx_dlf_relations', |
|
163 | + 'tx_dlf_collections', |
|
164 | + 'AND tx_dlf_collections.uid='.intval($this->cli_args['-coll'][0]).' AND tx_dlf_collections.pid='.intval($this->cli_args['-pid'][0]).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
165 | + '', |
|
166 | + '', |
|
167 | + '' |
|
168 | + ); |
|
169 | 169 | |
170 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
170 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
171 | 171 | |
172 | - // Get the document... |
|
173 | - $doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); |
|
172 | + // Get the document... |
|
173 | + $doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); |
|
174 | 174 | |
175 | - if ($doc->ready) { |
|
175 | + if ($doc->ready) { |
|
176 | 176 | |
177 | - // ...and save it to the database... |
|
178 | - if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { |
|
177 | + // ...and save it to the database... |
|
178 | + if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { |
|
179 | 179 | |
180 | - $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" not saved and indexed.'.LF, TRUE); |
|
180 | + $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" not saved and indexed.'.LF, TRUE); |
|
181 | 181 | |
182 | - $this->return = 1; |
|
182 | + $this->return = 1; |
|
183 | 183 | |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | - } else { |
|
186 | + } else { |
|
187 | 187 | |
188 | - $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" could not be loaded.'.LF, TRUE); |
|
188 | + $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" could not be loaded.'.LF, TRUE); |
|
189 | 189 | |
190 | - $this->return = 1; |
|
190 | + $this->return = 1; |
|
191 | 191 | |
192 | - } |
|
192 | + } |
|
193 | 193 | |
194 | - // Clear document registry to prevent memory exhaustion. |
|
195 | - tx_dlf_document::clearRegistry(); |
|
194 | + // Clear document registry to prevent memory exhaustion. |
|
195 | + tx_dlf_document::clearRegistry(); |
|
196 | 196 | |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - break; |
|
199 | + break; |
|
200 | 200 | |
201 | - default: |
|
201 | + default: |
|
202 | 202 | |
203 | - $this->cli_help(); |
|
203 | + $this->cli_help(); |
|
204 | 204 | |
205 | - break; |
|
205 | + break; |
|
206 | 206 | |
207 | - } |
|
207 | + } |
|
208 | 208 | |
209 | - exit ($this->return); |
|
209 | + exit ($this->return); |
|
210 | 210 | |
211 | - } |
|
211 | + } |
|
212 | 212 | |
213 | - public function __construct() { |
|
213 | + public function __construct() { |
|
214 | 214 | |
215 | - // Set basic information about the script. |
|
216 | - $this->cli_help = array ( |
|
217 | - 'name' => 'Command Line Interface for Kitodo.Presentation', |
|
218 | - 'synopsis' => '###OPTIONS###', |
|
219 | - 'description' => 'Currently the only tasks available are "index" and "reindex".'.LF.'Try "/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK" for more options.', |
|
220 | - 'examples' => '/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK -ARG1=VALUE1 -ARG2=VALUE2', |
|
221 | - 'options' => '', |
|
222 | - 'license' => 'GNU GPL - free software!', |
|
223 | - 'author' => 'Kitodo. Key to digital objects e.V. <[email protected]>', |
|
224 | - ); |
|
215 | + // Set basic information about the script. |
|
216 | + $this->cli_help = array ( |
|
217 | + 'name' => 'Command Line Interface for Kitodo.Presentation', |
|
218 | + 'synopsis' => '###OPTIONS###', |
|
219 | + 'description' => 'Currently the only tasks available are "index" and "reindex".'.LF.'Try "/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK" for more options.', |
|
220 | + 'examples' => '/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK -ARG1=VALUE1 -ARG2=VALUE2', |
|
221 | + 'options' => '', |
|
222 | + 'license' => 'GNU GPL - free software!', |
|
223 | + 'author' => 'Kitodo. Key to digital objects e.V. <[email protected]>', |
|
224 | + ); |
|
225 | 225 | |
226 | - // Run parent constructor. |
|
227 | - parent::__construct(); |
|
226 | + // Run parent constructor. |
|
227 | + parent::__construct(); |
|
228 | 228 | |
229 | - } |
|
229 | + } |
|
230 | 230 | |
231 | 231 | } |
232 | 232 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | // Get the document... |
92 | - $doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); |
|
92 | + $doc = & tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); |
|
93 | 93 | |
94 | 94 | if ($doc->ready) { |
95 | 95 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
171 | 171 | |
172 | 172 | // Get the document... |
173 | - $doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); |
|
173 | + $doc = & tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); |
|
174 | 174 | |
175 | 175 | if ($doc->ready) { |
176 | 176 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | if (TYPO3_MODE === 'FE') { |
76 | 76 | |
77 | - /* |
|
77 | + /* |
|
78 | 78 | * docTypeCheck user function to use in Typoscript |
79 | 79 | * |
80 | 80 | * @access public |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return boolean TRUE if document type matches, FALSE if not |
90 | 90 | **/ |
91 | - function user_dlf_docTypeCheck($type) { |
|
91 | + function user_dlf_docTypeCheck($type) { |
|
92 | 92 | |
93 | - $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype'); |
|
93 | + $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype'); |
|
94 | 94 | |
95 | - return ($hook->getDocType() === $type); |
|
95 | + return ($hook->getDocType() === $type); |
|
96 | 96 | |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | 99 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * LICENSE.txt file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -if (!defined ('TYPO3_MODE')) die ('Access denied.'); |
|
12 | +if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
13 | 13 | |
14 | 14 | // Register plugins. |
15 | 15 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'plugins/audioplayer/class.tx_dlf_audioplayer.php', '_audioplayer', 'list_type', TRUE); |
@@ -9,7 +9,9 @@ |
||
9 | 9 | * LICENSE.txt file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -if (!defined ('TYPO3_MODE')) die ('Access denied.'); |
|
12 | +if (!defined ('TYPO3_MODE')) { |
|
13 | + die ('Access denied.'); |
|
14 | +} |
|
13 | 15 | |
14 | 16 | // Register plugins. |
15 | 17 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'plugins/audioplayer/class.tx_dlf_audioplayer.php', '_audioplayer', 'list_type', TRUE); |
@@ -20,61 +20,61 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_doctype { |
22 | 22 | |
23 | - /** |
|
24 | - * This holds the current document |
|
25 | - * |
|
26 | - * @var tx_dlf_document |
|
27 | - * @access protected |
|
28 | - */ |
|
29 | - protected $doc; |
|
30 | - |
|
31 | - /** |
|
32 | - * This holds the extension key |
|
33 | - * |
|
34 | - * @var string |
|
35 | - * @access protected |
|
36 | - */ |
|
37 | - protected $extKey = 'dlf'; |
|
38 | - |
|
39 | - /** |
|
40 | - * This holds the current DLF plugin parameters |
|
41 | - * @see __contruct() |
|
42 | - * |
|
43 | - * @var array |
|
44 | - * @access protected |
|
45 | - */ |
|
46 | - protected $piVars = array (); |
|
47 | - |
|
48 | - /** |
|
49 | - * This holds the DLF parameter prefix |
|
50 | - * |
|
51 | - * @var string |
|
52 | - * @access protected |
|
53 | - */ |
|
54 | - protected $prefixId = 'tx_dlf'; |
|
55 | - |
|
56 | - /** |
|
57 | - * Check the current document's type. |
|
58 | - * |
|
59 | - * @access public |
|
60 | - * |
|
61 | - * @return string The type of the current document |
|
62 | - */ |
|
63 | - public function getDocType() { |
|
64 | - |
|
65 | - // Load current document. |
|
66 | - $this->loadDocument(); |
|
67 | - |
|
68 | - if ($this->doc === NULL) { |
|
69 | - |
|
70 | - // Quit without doing anything if document not available. |
|
71 | - return ''; |
|
72 | - |
|
73 | - } |
|
74 | - |
|
75 | - $toc = $this->doc->tableOfContents; |
|
76 | - |
|
77 | - /* |
|
23 | + /** |
|
24 | + * This holds the current document |
|
25 | + * |
|
26 | + * @var tx_dlf_document |
|
27 | + * @access protected |
|
28 | + */ |
|
29 | + protected $doc; |
|
30 | + |
|
31 | + /** |
|
32 | + * This holds the extension key |
|
33 | + * |
|
34 | + * @var string |
|
35 | + * @access protected |
|
36 | + */ |
|
37 | + protected $extKey = 'dlf'; |
|
38 | + |
|
39 | + /** |
|
40 | + * This holds the current DLF plugin parameters |
|
41 | + * @see __contruct() |
|
42 | + * |
|
43 | + * @var array |
|
44 | + * @access protected |
|
45 | + */ |
|
46 | + protected $piVars = array (); |
|
47 | + |
|
48 | + /** |
|
49 | + * This holds the DLF parameter prefix |
|
50 | + * |
|
51 | + * @var string |
|
52 | + * @access protected |
|
53 | + */ |
|
54 | + protected $prefixId = 'tx_dlf'; |
|
55 | + |
|
56 | + /** |
|
57 | + * Check the current document's type. |
|
58 | + * |
|
59 | + * @access public |
|
60 | + * |
|
61 | + * @return string The type of the current document |
|
62 | + */ |
|
63 | + public function getDocType() { |
|
64 | + |
|
65 | + // Load current document. |
|
66 | + $this->loadDocument(); |
|
67 | + |
|
68 | + if ($this->doc === NULL) { |
|
69 | + |
|
70 | + // Quit without doing anything if document not available. |
|
71 | + return ''; |
|
72 | + |
|
73 | + } |
|
74 | + |
|
75 | + $toc = $this->doc->tableOfContents; |
|
76 | + |
|
77 | + /* |
|
78 | 78 | * Get the document type |
79 | 79 | * |
80 | 80 | * 1. newspaper |
@@ -88,145 +88,145 @@ discard block |
||
88 | 88 | * - children array([0]) --> type = month |
89 | 89 | * - children array([0], [1], [2], ...) --> type = day --> Issue |
90 | 90 | */ |
91 | - switch ($toc[0]['type']) { |
|
91 | + switch ($toc[0]['type']) { |
|
92 | 92 | |
93 | - case 'newspaper': |
|
93 | + case 'newspaper': |
|
94 | 94 | |
95 | - $nodes_year = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]'); |
|
95 | + $nodes_year = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]'); |
|
96 | 96 | |
97 | - if (count($nodes_year) > 1) { |
|
97 | + if (count($nodes_year) > 1) { |
|
98 | 98 | |
99 | - // Multiple years means this is a newspaper's anchor file. |
|
100 | - return 'newspaper'; |
|
99 | + // Multiple years means this is a newspaper's anchor file. |
|
100 | + return 'newspaper'; |
|
101 | 101 | |
102 | - } else { |
|
102 | + } else { |
|
103 | 103 | |
104 | - $nodes_month = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]'); |
|
104 | + $nodes_month = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]'); |
|
105 | 105 | |
106 | - $nodes_day = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]/mets:div[@TYPE="day"]'); |
|
106 | + $nodes_day = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]/mets:div[@TYPE="day"]'); |
|
107 | 107 | |
108 | - $nodes_issue = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]'); |
|
108 | + $nodes_issue = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]'); |
|
109 | 109 | |
110 | - $nodes_issue_current = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]/@DMDID'); |
|
110 | + $nodes_issue_current = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]/@DMDID'); |
|
111 | 111 | |
112 | - if (count($nodes_year) == 1 && count($nodes_issue) == 0) { |
|
112 | + if (count($nodes_year) == 1 && count($nodes_issue) == 0) { |
|
113 | 113 | |
114 | - // It's possible to have only one year in the newspaper's anchor file. |
|
115 | - return 'newspaper'; |
|
114 | + // It's possible to have only one year in the newspaper's anchor file. |
|
115 | + return 'newspaper'; |
|
116 | 116 | |
117 | - } elseif (count($nodes_year) == 1 && count($nodes_month) > 1) { |
|
117 | + } elseif (count($nodes_year) == 1 && count($nodes_month) > 1) { |
|
118 | 118 | |
119 | - // One year, multiple months means this is a year's anchor file. |
|
120 | - return 'year'; |
|
119 | + // One year, multiple months means this is a year's anchor file. |
|
120 | + return 'year'; |
|
121 | 121 | |
122 | - } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) > 1) { |
|
122 | + } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) > 1) { |
|
123 | 123 | |
124 | - // One year, one month, one or more days means this is a year's anchor file. |
|
125 | - return 'year'; |
|
124 | + // One year, one month, one or more days means this is a year's anchor file. |
|
125 | + return 'year'; |
|
126 | 126 | |
127 | - } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) == 1 && count($nodes_issue_current) == 0) { |
|
127 | + } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) == 1 && count($nodes_issue_current) == 0) { |
|
128 | 128 | |
129 | - // One year, one month, a single day, one or more issues (but not the current one) means this is a year's anchor file. |
|
130 | - return 'year'; |
|
129 | + // One year, one month, a single day, one or more issues (but not the current one) means this is a year's anchor file. |
|
130 | + return 'year'; |
|
131 | 131 | |
132 | - } else { |
|
132 | + } else { |
|
133 | 133 | |
134 | - // In all other cases we assume it's newspaper's issue. |
|
135 | - return 'issue'; |
|
134 | + // In all other cases we assume it's newspaper's issue. |
|
135 | + return 'issue'; |
|
136 | 136 | |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | - break; |
|
141 | + break; |
|
142 | 142 | |
143 | - default: |
|
143 | + default: |
|
144 | 144 | |
145 | - return $toc[0]['type']; |
|
145 | + return $toc[0]['type']; |
|
146 | 146 | |
147 | - } |
|
147 | + } |
|
148 | 148 | |
149 | - } |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * Loads the current document into $this->doc |
|
153 | - * |
|
154 | - * @access protected |
|
155 | - * |
|
156 | - * @return void |
|
157 | - */ |
|
158 | - protected function loadDocument() { |
|
151 | + /** |
|
152 | + * Loads the current document into $this->doc |
|
153 | + * |
|
154 | + * @access protected |
|
155 | + * |
|
156 | + * @return void |
|
157 | + */ |
|
158 | + protected function loadDocument() { |
|
159 | 159 | |
160 | - // Check for required variable. |
|
161 | - if (!empty($this->piVars['id'])) { |
|
160 | + // Check for required variable. |
|
161 | + if (!empty($this->piVars['id'])) { |
|
162 | 162 | |
163 | - // Get instance of tx_dlf_document. |
|
164 | - $this->doc =& tx_dlf_document::getInstance($this->piVars['id']); |
|
163 | + // Get instance of tx_dlf_document. |
|
164 | + $this->doc =& tx_dlf_document::getInstance($this->piVars['id']); |
|
165 | 165 | |
166 | - if (!$this->doc->ready) { |
|
166 | + if (!$this->doc->ready) { |
|
167 | 167 | |
168 | - // Destroy the incomplete object. |
|
169 | - $this->doc = NULL; |
|
168 | + // Destroy the incomplete object. |
|
169 | + $this->doc = NULL; |
|
170 | 170 | |
171 | - if (TYPO3_DLOG) { |
|
171 | + if (TYPO3_DLOG) { |
|
172 | 172 | |
173 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
173 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
174 | 174 | |
175 | - } |
|
175 | + } |
|
176 | 176 | |
177 | - } |
|
177 | + } |
|
178 | 178 | |
179 | - } elseif (!empty($this->piVars['recordId'])) { |
|
179 | + } elseif (!empty($this->piVars['recordId'])) { |
|
180 | 180 | |
181 | - // Get UID of document with given record identifier. |
|
182 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
183 | - 'tx_dlf_documents.uid', |
|
184 | - 'tx_dlf_documents', |
|
185 | - 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
186 | - '', |
|
187 | - '', |
|
188 | - '1' |
|
189 | - ); |
|
181 | + // Get UID of document with given record identifier. |
|
182 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
183 | + 'tx_dlf_documents.uid', |
|
184 | + 'tx_dlf_documents', |
|
185 | + 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
186 | + '', |
|
187 | + '', |
|
188 | + '1' |
|
189 | + ); |
|
190 | 190 | |
191 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { |
|
191 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { |
|
192 | 192 | |
193 | - list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
193 | + list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
194 | 194 | |
195 | - // Set superglobal $_GET array. |
|
196 | - $_GET[$this->prefixId]['id'] = $this->piVars['id']; |
|
195 | + // Set superglobal $_GET array. |
|
196 | + $_GET[$this->prefixId]['id'] = $this->piVars['id']; |
|
197 | 197 | |
198 | - // Unset variable to avoid infinite looping. |
|
199 | - unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']); |
|
198 | + // Unset variable to avoid infinite looping. |
|
199 | + unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']); |
|
200 | 200 | |
201 | - // Try to load document. |
|
202 | - $this->loadDocument(); |
|
201 | + // Try to load document. |
|
202 | + $this->loadDocument(); |
|
203 | 203 | |
204 | - } else { |
|
204 | + } else { |
|
205 | 205 | |
206 | - if (TYPO3_DLOG) { |
|
206 | + if (TYPO3_DLOG) { |
|
207 | 207 | |
208 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
208 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
209 | 209 | |
210 | - } |
|
210 | + } |
|
211 | 211 | |
212 | - } |
|
212 | + } |
|
213 | 213 | |
214 | - } |
|
214 | + } |
|
215 | 215 | |
216 | - } |
|
216 | + } |
|
217 | 217 | |
218 | - /** |
|
219 | - * Initializes the hook by setting initial variables. |
|
220 | - * |
|
221 | - * @access public |
|
222 | - * |
|
223 | - * @return void |
|
224 | - */ |
|
225 | - public function __construct() { |
|
218 | + /** |
|
219 | + * Initializes the hook by setting initial variables. |
|
220 | + * |
|
221 | + * @access public |
|
222 | + * |
|
223 | + * @return void |
|
224 | + */ |
|
225 | + public function __construct() { |
|
226 | 226 | |
227 | - // Load current plugin parameters. |
|
228 | - $this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId); |
|
227 | + // Load current plugin parameters. |
|
228 | + $this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId); |
|
229 | 229 | |
230 | - } |
|
230 | + } |
|
231 | 231 | |
232 | 232 | } |
@@ -161,7 +161,7 @@ |
||
161 | 161 | if (!empty($this->piVars['id'])) { |
162 | 162 | |
163 | 163 | // Get instance of tx_dlf_document. |
164 | - $this->doc =& tx_dlf_document::getInstance($this->piVars['id']); |
|
164 | + $this->doc = & tx_dlf_document::getInstance($this->piVars['id']); |
|
165 | 165 | |
166 | 166 | if (!$this->doc->ready) { |
167 | 167 |
@@ -19,433 +19,433 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_tcemain { |
21 | 21 | |
22 | - /** |
|
23 | - * Field post-processing hook for the process_datamap() method. |
|
24 | - * |
|
25 | - * @access public |
|
26 | - * |
|
27 | - * @param string $status: 'new' or 'update' |
|
28 | - * @param string $table: The destination table |
|
29 | - * @param integer $id: The uid of the record |
|
30 | - * @param array &$fieldArray: Array of field values |
|
31 | - * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
32 | - * |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) { |
|
22 | + /** |
|
23 | + * Field post-processing hook for the process_datamap() method. |
|
24 | + * |
|
25 | + * @access public |
|
26 | + * |
|
27 | + * @param string $status: 'new' or 'update' |
|
28 | + * @param string $table: The destination table |
|
29 | + * @param integer $id: The uid of the record |
|
30 | + * @param array &$fieldArray: Array of field values |
|
31 | + * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
32 | + * |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) { |
|
36 | 36 | |
37 | - if ($status == 'new') { |
|
37 | + if ($status == 'new') { |
|
38 | 38 | |
39 | - switch ($table) { |
|
39 | + switch ($table) { |
|
40 | 40 | |
41 | - // Field post-processing for table "tx_dlf_documents". |
|
42 | - case 'tx_dlf_documents': |
|
41 | + // Field post-processing for table "tx_dlf_documents". |
|
42 | + case 'tx_dlf_documents': |
|
43 | 43 | |
44 | - // Set sorting field if empty. |
|
45 | - if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) { |
|
44 | + // Set sorting field if empty. |
|
45 | + if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) { |
|
46 | 46 | |
47 | - $fieldArray['title_sorting'] = $fieldArray['title']; |
|
47 | + $fieldArray['title_sorting'] = $fieldArray['title']; |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - break; |
|
51 | + break; |
|
52 | 52 | |
53 | - // Field post-processing for table "tx_dlf_metadata". |
|
54 | - case 'tx_dlf_metadata': |
|
53 | + // Field post-processing for table "tx_dlf_metadata". |
|
54 | + case 'tx_dlf_metadata': |
|
55 | 55 | |
56 | - // Store field in index if it should appear in lists. |
|
57 | - if (!empty($fieldArray['is_listed'])) { |
|
56 | + // Store field in index if it should appear in lists. |
|
57 | + if (!empty($fieldArray['is_listed'])) { |
|
58 | 58 | |
59 | - $fieldArray['index_stored'] = 1; |
|
59 | + $fieldArray['index_stored'] = 1; |
|
60 | 60 | |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - // Index field in index if it should be used for auto-completion. |
|
64 | - if (!empty($fieldArray['index_autocomplete'])) { |
|
63 | + // Index field in index if it should be used for auto-completion. |
|
64 | + if (!empty($fieldArray['index_autocomplete'])) { |
|
65 | 65 | |
66 | - $fieldArray['index_indexed'] = 1; |
|
66 | + $fieldArray['index_indexed'] = 1; |
|
67 | 67 | |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - // Field post-processing for tables "tx_dlf_metadata", "tx_dlf_collections", "tx_dlf_libraries" and "tx_dlf_structures". |
|
71 | - case 'tx_dlf_collections': |
|
72 | - case 'tx_dlf_libraries': |
|
73 | - case 'tx_dlf_structures': |
|
70 | + // Field post-processing for tables "tx_dlf_metadata", "tx_dlf_collections", "tx_dlf_libraries" and "tx_dlf_structures". |
|
71 | + case 'tx_dlf_collections': |
|
72 | + case 'tx_dlf_libraries': |
|
73 | + case 'tx_dlf_structures': |
|
74 | 74 | |
75 | - // Set label as index name if empty. |
|
76 | - if (empty($fieldArray['index_name']) && !empty($fieldArray['label'])) { |
|
75 | + // Set label as index name if empty. |
|
76 | + if (empty($fieldArray['index_name']) && !empty($fieldArray['label'])) { |
|
77 | 77 | |
78 | - $fieldArray['index_name'] = $fieldArray['label']; |
|
78 | + $fieldArray['index_name'] = $fieldArray['label']; |
|
79 | 79 | |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - // Set index name as label if empty. |
|
83 | - if (empty($fieldArray['label']) && !empty($fieldArray['index_name'])) { |
|
82 | + // Set index name as label if empty. |
|
83 | + if (empty($fieldArray['label']) && !empty($fieldArray['index_name'])) { |
|
84 | 84 | |
85 | - $fieldArray['label'] = $fieldArray['index_name']; |
|
85 | + $fieldArray['label'] = $fieldArray['index_name']; |
|
86 | 86 | |
87 | - } |
|
87 | + } |
|
88 | 88 | |
89 | - // Ensure that index names don't get mixed up with sorting values. |
|
90 | - if (substr($fieldArray['index_name'], -8) == '_sorting') { |
|
89 | + // Ensure that index names don't get mixed up with sorting values. |
|
90 | + if (substr($fieldArray['index_name'], -8) == '_sorting') { |
|
91 | 91 | |
92 | - $fieldArray['index_name'] .= '0'; |
|
92 | + $fieldArray['index_name'] .= '0'; |
|
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | - break; |
|
96 | + break; |
|
97 | 97 | |
98 | - // Field post-processing for table "tx_dlf_solrcores". |
|
99 | - case 'tx_dlf_solrcores': |
|
98 | + // Field post-processing for table "tx_dlf_solrcores". |
|
99 | + case 'tx_dlf_solrcores': |
|
100 | 100 | |
101 | - // Get number of existing cores. |
|
102 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
103 | - '*', |
|
104 | - 'tx_dlf_solrcores', |
|
105 | - '', |
|
106 | - '', |
|
107 | - '', |
|
108 | - '' |
|
109 | - ); |
|
101 | + // Get number of existing cores. |
|
102 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
103 | + '*', |
|
104 | + 'tx_dlf_solrcores', |
|
105 | + '', |
|
106 | + '', |
|
107 | + '', |
|
108 | + '' |
|
109 | + ); |
|
110 | 110 | |
111 | - // Get first unused core number. |
|
112 | - $coreNumber = tx_dlf_solr::solrGetCoreNumber($GLOBALS['TYPO3_DB']->sql_num_rows($result)); |
|
111 | + // Get first unused core number. |
|
112 | + $coreNumber = tx_dlf_solr::solrGetCoreNumber($GLOBALS['TYPO3_DB']->sql_num_rows($result)); |
|
113 | 113 | |
114 | - // Get Solr credentials. |
|
115 | - $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
|
114 | + // Get Solr credentials. |
|
115 | + $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
|
116 | 116 | |
117 | - // Prepend username and password to hostname. |
|
118 | - if ($conf['solrUser'] && $conf['solrPass']) { |
|
117 | + // Prepend username and password to hostname. |
|
118 | + if ($conf['solrUser'] && $conf['solrPass']) { |
|
119 | 119 | |
120 | - $host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
|
120 | + $host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
|
121 | 121 | |
122 | - } else { |
|
122 | + } else { |
|
123 | 123 | |
124 | - $host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
|
124 | + $host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
|
125 | 125 | |
126 | - } |
|
126 | + } |
|
127 | 127 | |
128 | - // Set port if not set. |
|
129 | - $port = (intval($conf['solrPort']) > 0 ? intval($conf['solrPort']) : 8180); |
|
128 | + // Set port if not set. |
|
129 | + $port = (intval($conf['solrPort']) > 0 ? intval($conf['solrPort']) : 8180); |
|
130 | 130 | |
131 | - // Trim path and append trailing slash. |
|
132 | - $path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : ''); |
|
131 | + // Trim path and append trailing slash. |
|
132 | + $path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : ''); |
|
133 | 133 | |
134 | - $context = stream_context_create(array ( |
|
135 | - 'http' => array ( |
|
136 | - 'method' => 'GET', |
|
137 | - 'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent')) |
|
138 | - ) |
|
139 | - )); |
|
134 | + $context = stream_context_create(array ( |
|
135 | + 'http' => array ( |
|
136 | + 'method' => 'GET', |
|
137 | + 'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent')) |
|
138 | + ) |
|
139 | + )); |
|
140 | 140 | |
141 | - // Build request for adding new Solr core. |
|
142 | - // @see http://wiki.apache.org/solr/CoreAdmin |
|
143 | - $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml&action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber; |
|
141 | + // Build request for adding new Solr core. |
|
142 | + // @see http://wiki.apache.org/solr/CoreAdmin |
|
143 | + $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml&action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber; |
|
144 | 144 | |
145 | - $response = @simplexml_load_string(file_get_contents($url, FALSE, $context)); |
|
145 | + $response = @simplexml_load_string(file_get_contents($url, FALSE, $context)); |
|
146 | 146 | |
147 | - // Process response. |
|
148 | - if ($response) { |
|
147 | + // Process response. |
|
148 | + if ($response) { |
|
149 | 149 | |
150 | - $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]'); |
|
150 | + $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]'); |
|
151 | 151 | |
152 | - if ($status && $status[0] == 0) { |
|
152 | + if ($status && $status[0] == 0) { |
|
153 | 153 | |
154 | - $fieldArray['index_name'] = 'dlfCore'.$coreNumber; |
|
154 | + $fieldArray['index_name'] = 'dlfCore'.$coreNumber; |
|
155 | 155 | |
156 | - return; |
|
156 | + return; |
|
157 | 157 | |
158 | - } |
|
158 | + } |
|
159 | 159 | |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | - if (TYPO3_DLOG) { |
|
162 | + if (TYPO3_DLOG) { |
|
163 | 163 | |
164 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
|
164 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
|
165 | 165 | |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - // Solr core could not be created, thus unset field array. |
|
169 | - $fieldArray = array (); |
|
168 | + // Solr core could not be created, thus unset field array. |
|
169 | + $fieldArray = array (); |
|
170 | 170 | |
171 | - break; |
|
171 | + break; |
|
172 | 172 | |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | - } elseif ($status == 'update') { |
|
175 | + } elseif ($status == 'update') { |
|
176 | 176 | |
177 | - switch ($table) { |
|
177 | + switch ($table) { |
|
178 | 178 | |
179 | - // Field post-processing for table "tx_dlf_metadata". |
|
180 | - case 'tx_dlf_metadata': |
|
179 | + // Field post-processing for table "tx_dlf_metadata". |
|
180 | + case 'tx_dlf_metadata': |
|
181 | 181 | |
182 | - // Store field in index if it should appear in lists. |
|
183 | - if (!empty($fieldArray['is_listed'])) { |
|
182 | + // Store field in index if it should appear in lists. |
|
183 | + if (!empty($fieldArray['is_listed'])) { |
|
184 | 184 | |
185 | - $fieldArray['index_stored'] = 1; |
|
185 | + $fieldArray['index_stored'] = 1; |
|
186 | 186 | |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - if (isset($fieldArray['index_stored']) && $fieldArray['index_stored'] == 0 && !isset($fieldArray['is_listed'])) { |
|
189 | + if (isset($fieldArray['index_stored']) && $fieldArray['index_stored'] == 0 && !isset($fieldArray['is_listed'])) { |
|
190 | 190 | |
191 | - // Get current configuration. |
|
192 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
193 | - $table.'.is_listed AS is_listed', |
|
194 | - $table, |
|
195 | - $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
196 | - '', |
|
197 | - '', |
|
198 | - '1' |
|
199 | - ); |
|
191 | + // Get current configuration. |
|
192 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
193 | + $table.'.is_listed AS is_listed', |
|
194 | + $table, |
|
195 | + $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
196 | + '', |
|
197 | + '', |
|
198 | + '1' |
|
199 | + ); |
|
200 | 200 | |
201 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
201 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
202 | 202 | |
203 | - // Reset storing to current. |
|
204 | - list ($fieldArray['index_stored']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
203 | + // Reset storing to current. |
|
204 | + list ($fieldArray['index_stored']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
205 | 205 | |
206 | - } |
|
206 | + } |
|
207 | 207 | |
208 | - } |
|
208 | + } |
|
209 | 209 | |
210 | - // Index field in index if it should be used for auto-completion. |
|
211 | - if (!empty($fieldArray['index_autocomplete'])) { |
|
210 | + // Index field in index if it should be used for auto-completion. |
|
211 | + if (!empty($fieldArray['index_autocomplete'])) { |
|
212 | 212 | |
213 | - $fieldArray['index_indexed'] = 1; |
|
213 | + $fieldArray['index_indexed'] = 1; |
|
214 | 214 | |
215 | - } |
|
215 | + } |
|
216 | 216 | |
217 | - if (isset($fieldArray['index_indexed']) && $fieldArray['index_indexed'] == 0 && !isset($fieldArray['index_autocomplete'])) { |
|
217 | + if (isset($fieldArray['index_indexed']) && $fieldArray['index_indexed'] == 0 && !isset($fieldArray['index_autocomplete'])) { |
|
218 | 218 | |
219 | - // Get current configuration. |
|
220 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
221 | - $table.'.index_autocomplete AS index_autocomplete', |
|
222 | - $table, |
|
223 | - $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
224 | - '', |
|
225 | - '', |
|
226 | - '1' |
|
227 | - ); |
|
219 | + // Get current configuration. |
|
220 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
221 | + $table.'.index_autocomplete AS index_autocomplete', |
|
222 | + $table, |
|
223 | + $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
224 | + '', |
|
225 | + '', |
|
226 | + '1' |
|
227 | + ); |
|
228 | 228 | |
229 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
229 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
230 | 230 | |
231 | - // Reset indexing to current. |
|
232 | - list ($fieldArray['index_indexed']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
231 | + // Reset indexing to current. |
|
232 | + list ($fieldArray['index_indexed']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
233 | 233 | |
234 | - } |
|
234 | + } |
|
235 | 235 | |
236 | - } |
|
236 | + } |
|
237 | 237 | |
238 | - // Field post-processing for tables "tx_dlf_metadata" and "tx_dlf_structures". |
|
239 | - case 'tx_dlf_structures': |
|
238 | + // Field post-processing for tables "tx_dlf_metadata" and "tx_dlf_structures". |
|
239 | + case 'tx_dlf_structures': |
|
240 | 240 | |
241 | - // The index name should not be changed in production. |
|
242 | - if (isset($fieldArray['index_name'])) { |
|
241 | + // The index name should not be changed in production. |
|
242 | + if (isset($fieldArray['index_name'])) { |
|
243 | 243 | |
244 | - if (count($fieldArray) < 2) { |
|
244 | + if (count($fieldArray) < 2) { |
|
245 | 245 | |
246 | - // Unset the whole field array. |
|
247 | - $fieldArray = array (); |
|
246 | + // Unset the whole field array. |
|
247 | + $fieldArray = array (); |
|
248 | 248 | |
249 | - } else { |
|
249 | + } else { |
|
250 | 250 | |
251 | - // Get current index name. |
|
252 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
253 | - $table.'.index_name AS index_name', |
|
254 | - $table, |
|
255 | - $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
256 | - '', |
|
257 | - '', |
|
258 | - '1' |
|
259 | - ); |
|
251 | + // Get current index name. |
|
252 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
253 | + $table.'.index_name AS index_name', |
|
254 | + $table, |
|
255 | + $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
256 | + '', |
|
257 | + '', |
|
258 | + '1' |
|
259 | + ); |
|
260 | 260 | |
261 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
261 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
262 | 262 | |
263 | - // Reset index name to current. |
|
264 | - list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
263 | + // Reset index name to current. |
|
264 | + list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
265 | 265 | |
266 | - } |
|
266 | + } |
|
267 | 267 | |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | - if (TYPO3_DLOG) { |
|
270 | + if (TYPO3_DLOG) { |
|
271 | 271 | |
272 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray); |
|
272 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray); |
|
273 | 273 | |
274 | - } |
|
274 | + } |
|
275 | 275 | |
276 | - } |
|
276 | + } |
|
277 | 277 | |
278 | - break; |
|
278 | + break; |
|
279 | 279 | |
280 | - } |
|
280 | + } |
|
281 | 281 | |
282 | - } |
|
282 | + } |
|
283 | 283 | |
284 | - } |
|
284 | + } |
|
285 | 285 | |
286 | - /** |
|
287 | - * After database operations hook for the process_datamap() method. |
|
288 | - * |
|
289 | - * @access public |
|
290 | - * |
|
291 | - * @param string $status: 'new' or 'update' |
|
292 | - * @param string $table: The destination table |
|
293 | - * @param integer $id: The uid of the record |
|
294 | - * @param array &$fieldArray: Array of field values |
|
295 | - * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
296 | - * |
|
297 | - * @return void |
|
298 | - */ |
|
299 | - public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) { |
|
286 | + /** |
|
287 | + * After database operations hook for the process_datamap() method. |
|
288 | + * |
|
289 | + * @access public |
|
290 | + * |
|
291 | + * @param string $status: 'new' or 'update' |
|
292 | + * @param string $table: The destination table |
|
293 | + * @param integer $id: The uid of the record |
|
294 | + * @param array &$fieldArray: Array of field values |
|
295 | + * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
296 | + * |
|
297 | + * @return void |
|
298 | + */ |
|
299 | + public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) { |
|
300 | 300 | |
301 | - if ($status == 'update') { |
|
301 | + if ($status == 'update') { |
|
302 | 302 | |
303 | - switch ($table) { |
|
303 | + switch ($table) { |
|
304 | 304 | |
305 | - // After database operations for table "tx_dlf_documents". |
|
306 | - case 'tx_dlf_documents': |
|
305 | + // After database operations for table "tx_dlf_documents". |
|
306 | + case 'tx_dlf_documents': |
|
307 | 307 | |
308 | - // Delete/reindex document in Solr according to "hidden" status in database. |
|
309 | - if (isset($fieldArray['hidden'])) { |
|
308 | + // Delete/reindex document in Solr according to "hidden" status in database. |
|
309 | + if (isset($fieldArray['hidden'])) { |
|
310 | 310 | |
311 | - // Get Solr core. |
|
312 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
313 | - 'tx_dlf_solrcores.uid', |
|
314 | - 'tx_dlf_solrcores,tx_dlf_documents', |
|
315 | - 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
316 | - '', |
|
317 | - '', |
|
318 | - '1' |
|
319 | - ); |
|
311 | + // Get Solr core. |
|
312 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
313 | + 'tx_dlf_solrcores.uid', |
|
314 | + 'tx_dlf_solrcores,tx_dlf_documents', |
|
315 | + 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
316 | + '', |
|
317 | + '', |
|
318 | + '1' |
|
319 | + ); |
|
320 | 320 | |
321 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
321 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
322 | 322 | |
323 | - list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
323 | + list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
324 | 324 | |
325 | - if ($fieldArray['hidden']) { |
|
325 | + if ($fieldArray['hidden']) { |
|
326 | 326 | |
327 | - // Establish Solr connection. |
|
328 | - if ($solr = tx_dlf_solr::getInstance($core)) { |
|
327 | + // Establish Solr connection. |
|
328 | + if ($solr = tx_dlf_solr::getInstance($core)) { |
|
329 | 329 | |
330 | - // Delete Solr document. |
|
331 | - $solr->service->deleteByQuery('uid:'.$id); |
|
330 | + // Delete Solr document. |
|
331 | + $solr->service->deleteByQuery('uid:'.$id); |
|
332 | 332 | |
333 | - $solr->service->commit(); |
|
333 | + $solr->service->commit(); |
|
334 | 334 | |
335 | - } |
|
335 | + } |
|
336 | 336 | |
337 | - } else { |
|
337 | + } else { |
|
338 | 338 | |
339 | - // Reindex document. |
|
340 | - $doc =& tx_dlf_document::getInstance($id); |
|
339 | + // Reindex document. |
|
340 | + $doc =& tx_dlf_document::getInstance($id); |
|
341 | 341 | |
342 | - if ($doc->ready) { |
|
342 | + if ($doc->ready) { |
|
343 | 343 | |
344 | - $doc->save($doc->pid, $core); |
|
344 | + $doc->save($doc->pid, $core); |
|
345 | 345 | |
346 | - } else { |
|
346 | + } else { |
|
347 | 347 | |
348 | - if (TYPO3_DLOG) { |
|
348 | + if (TYPO3_DLOG) { |
|
349 | 349 | |
350 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
|
350 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
|
351 | 351 | |
352 | - } |
|
352 | + } |
|
353 | 353 | |
354 | - } |
|
354 | + } |
|
355 | 355 | |
356 | - } |
|
356 | + } |
|
357 | 357 | |
358 | - } |
|
358 | + } |
|
359 | 359 | |
360 | - } |
|
360 | + } |
|
361 | 361 | |
362 | - break; |
|
362 | + break; |
|
363 | 363 | |
364 | - } |
|
364 | + } |
|
365 | 365 | |
366 | - } |
|
366 | + } |
|
367 | 367 | |
368 | - } |
|
368 | + } |
|
369 | 369 | |
370 | - /** |
|
371 | - * Post-processing hook for the process_cmdmap() method. |
|
372 | - * |
|
373 | - * @access public |
|
374 | - * |
|
375 | - * @param string $command: 'move', 'copy', 'localize', 'inlineLocalizeSynchronize', 'delete' or 'undelete' |
|
376 | - * @param string $table: The destination table |
|
377 | - * @param integer $id: The uid of the record |
|
378 | - * @param mixed $value: The value for the command |
|
379 | - * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
380 | - * |
|
381 | - * @return void |
|
382 | - */ |
|
383 | - public function processCmdmap_postProcess($command, $table, $id, $value, $pObj) { |
|
370 | + /** |
|
371 | + * Post-processing hook for the process_cmdmap() method. |
|
372 | + * |
|
373 | + * @access public |
|
374 | + * |
|
375 | + * @param string $command: 'move', 'copy', 'localize', 'inlineLocalizeSynchronize', 'delete' or 'undelete' |
|
376 | + * @param string $table: The destination table |
|
377 | + * @param integer $id: The uid of the record |
|
378 | + * @param mixed $value: The value for the command |
|
379 | + * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
380 | + * |
|
381 | + * @return void |
|
382 | + */ |
|
383 | + public function processCmdmap_postProcess($command, $table, $id, $value, $pObj) { |
|
384 | 384 | |
385 | - if (in_array($command, array ('move', 'delete', 'undelete')) && $table == 'tx_dlf_documents') { |
|
385 | + if (in_array($command, array ('move', 'delete', 'undelete')) && $table == 'tx_dlf_documents') { |
|
386 | 386 | |
387 | - // Get Solr core. |
|
388 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
389 | - 'tx_dlf_solrcores.uid', |
|
390 | - 'tx_dlf_solrcores,tx_dlf_documents', |
|
391 | - 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
392 | - '', |
|
393 | - '', |
|
394 | - '1' |
|
395 | - ); |
|
387 | + // Get Solr core. |
|
388 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
389 | + 'tx_dlf_solrcores.uid', |
|
390 | + 'tx_dlf_solrcores,tx_dlf_documents', |
|
391 | + 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
392 | + '', |
|
393 | + '', |
|
394 | + '1' |
|
395 | + ); |
|
396 | 396 | |
397 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
397 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
398 | 398 | |
399 | - list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
399 | + list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
400 | 400 | |
401 | - switch ($command) { |
|
401 | + switch ($command) { |
|
402 | 402 | |
403 | - case 'move': |
|
404 | - case 'delete': |
|
403 | + case 'move': |
|
404 | + case 'delete': |
|
405 | 405 | |
406 | - // Establish Solr connection. |
|
407 | - if ($solr = tx_dlf_solr::getInstance($core)) { |
|
406 | + // Establish Solr connection. |
|
407 | + if ($solr = tx_dlf_solr::getInstance($core)) { |
|
408 | 408 | |
409 | - // Delete Solr document. |
|
410 | - $solr->service->deleteByQuery('uid:'.$id); |
|
409 | + // Delete Solr document. |
|
410 | + $solr->service->deleteByQuery('uid:'.$id); |
|
411 | 411 | |
412 | - $solr->service->commit(); |
|
412 | + $solr->service->commit(); |
|
413 | 413 | |
414 | - if ($command == 'delete') { |
|
414 | + if ($command == 'delete') { |
|
415 | 415 | |
416 | - break; |
|
416 | + break; |
|
417 | 417 | |
418 | - } |
|
418 | + } |
|
419 | 419 | |
420 | - } |
|
420 | + } |
|
421 | 421 | |
422 | - case 'undelete': |
|
422 | + case 'undelete': |
|
423 | 423 | |
424 | - // Reindex document. |
|
425 | - $doc =& tx_dlf_document::getInstance($id); |
|
424 | + // Reindex document. |
|
425 | + $doc =& tx_dlf_document::getInstance($id); |
|
426 | 426 | |
427 | - if ($doc->ready) { |
|
427 | + if ($doc->ready) { |
|
428 | 428 | |
429 | - $doc->save($doc->pid, $core); |
|
429 | + $doc->save($doc->pid, $core); |
|
430 | 430 | |
431 | - } else { |
|
431 | + } else { |
|
432 | 432 | |
433 | - if (TYPO3_DLOG) { |
|
433 | + if (TYPO3_DLOG) { |
|
434 | 434 | |
435 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
435 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
436 | 436 | |
437 | - } |
|
437 | + } |
|
438 | 438 | |
439 | - } |
|
439 | + } |
|
440 | 440 | |
441 | - break; |
|
441 | + break; |
|
442 | 442 | |
443 | - } |
|
443 | + } |
|
444 | 444 | |
445 | - } |
|
445 | + } |
|
446 | 446 | |
447 | - } |
|
447 | + } |
|
448 | 448 | |
449 | - } |
|
449 | + } |
|
450 | 450 | |
451 | 451 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | } else { |
338 | 338 | |
339 | 339 | // Reindex document. |
340 | - $doc =& tx_dlf_document::getInstance($id); |
|
340 | + $doc = & tx_dlf_document::getInstance($id); |
|
341 | 341 | |
342 | 342 | if ($doc->ready) { |
343 | 343 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | case 'undelete': |
423 | 423 | |
424 | 424 | // Reindex document. |
425 | - $doc =& tx_dlf_document::getInstance($id); |
|
425 | + $doc = & tx_dlf_document::getInstance($id); |
|
426 | 426 | |
427 | 427 | if ($doc->ready) { |
428 | 428 |
@@ -19,660 +19,660 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_em { |
21 | 21 | |
22 | - /** |
|
23 | - * This holds the current configuration |
|
24 | - * |
|
25 | - * @var array |
|
26 | - * @access protected |
|
27 | - */ |
|
28 | - protected $conf = array (); |
|
29 | - |
|
30 | - /** |
|
31 | - * This holds the output ready to return |
|
32 | - * |
|
33 | - * @var string |
|
34 | - * @access protected |
|
35 | - */ |
|
36 | - protected $content = ''; |
|
37 | - |
|
38 | - /** |
|
39 | - * Check if a connection to a Solr server could be established with the given credentials. |
|
40 | - * |
|
41 | - * @access public |
|
42 | - * |
|
43 | - * @param array &$params: An array with parameters |
|
44 | - * @param \TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object |
|
45 | - * |
|
46 | - * @return string Message informing the user of success or failure |
|
47 | - */ |
|
48 | - public function checkSolrConnection(&$params, &$pObj) { |
|
49 | - |
|
50 | - // Prepend username and password to hostname. |
|
51 | - if (!empty($this->conf['solrUser']) && !empty($this->conf['solrPass'])) { |
|
22 | + /** |
|
23 | + * This holds the current configuration |
|
24 | + * |
|
25 | + * @var array |
|
26 | + * @access protected |
|
27 | + */ |
|
28 | + protected $conf = array (); |
|
29 | + |
|
30 | + /** |
|
31 | + * This holds the output ready to return |
|
32 | + * |
|
33 | + * @var string |
|
34 | + * @access protected |
|
35 | + */ |
|
36 | + protected $content = ''; |
|
37 | + |
|
38 | + /** |
|
39 | + * Check if a connection to a Solr server could be established with the given credentials. |
|
40 | + * |
|
41 | + * @access public |
|
42 | + * |
|
43 | + * @param array &$params: An array with parameters |
|
44 | + * @param \TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object |
|
45 | + * |
|
46 | + * @return string Message informing the user of success or failure |
|
47 | + */ |
|
48 | + public function checkSolrConnection(&$params, &$pObj) { |
|
49 | + |
|
50 | + // Prepend username and password to hostname. |
|
51 | + if (!empty($this->conf['solrUser']) && !empty($this->conf['solrPass'])) { |
|
52 | 52 | |
53 | - $host = $this->conf['solrUser'].':'.$this->conf['solrPass'].'@'.(!empty($this->conf['solrHost']) ? $this->conf['solrHost'] : 'localhost'); |
|
54 | - |
|
55 | - } else { |
|
56 | - |
|
57 | - $host = (!empty($this->conf['solrHost']) ? $this->conf['solrHost'] : 'localhost'); |
|
58 | - |
|
59 | - } |
|
53 | + $host = $this->conf['solrUser'].':'.$this->conf['solrPass'].'@'.(!empty($this->conf['solrHost']) ? $this->conf['solrHost'] : 'localhost'); |
|
54 | + |
|
55 | + } else { |
|
56 | + |
|
57 | + $host = (!empty($this->conf['solrHost']) ? $this->conf['solrHost'] : 'localhost'); |
|
58 | + |
|
59 | + } |
|
60 | 60 | |
61 | - // Set port if not set. |
|
62 | - $port = (!empty($this->conf['solrPort']) ? \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->conf['solrPort'], 0, 65535, 8180) : 8180); |
|
63 | - |
|
64 | - // Trim path and append trailing slash. |
|
65 | - $path = (!empty($this->conf['solrPath']) ? trim($this->conf['solrPath'], '/').'/' : ''); |
|
66 | - |
|
67 | - // Build request URI. |
|
68 | - $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml'; |
|
69 | - |
|
70 | - $context = stream_context_create(array ( |
|
71 | - 'http' => array ( |
|
72 | - 'method' => 'GET', |
|
73 | - 'user_agent' => (!empty($this->conf['useragent']) ? $this->conf['useragent'] : ini_get('user_agent')) |
|
74 | - ) |
|
75 | - )); |
|
61 | + // Set port if not set. |
|
62 | + $port = (!empty($this->conf['solrPort']) ? \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->conf['solrPort'], 0, 65535, 8180) : 8180); |
|
63 | + |
|
64 | + // Trim path and append trailing slash. |
|
65 | + $path = (!empty($this->conf['solrPath']) ? trim($this->conf['solrPath'], '/').'/' : ''); |
|
66 | + |
|
67 | + // Build request URI. |
|
68 | + $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml'; |
|
69 | + |
|
70 | + $context = stream_context_create(array ( |
|
71 | + 'http' => array ( |
|
72 | + 'method' => 'GET', |
|
73 | + 'user_agent' => (!empty($this->conf['useragent']) ? $this->conf['useragent'] : ini_get('user_agent')) |
|
74 | + ) |
|
75 | + )); |
|
76 | 76 | |
77 | - // Try to connect to Solr server. |
|
78 | - $response = @simplexml_load_string(file_get_contents($url, FALSE, $context)); |
|
79 | - |
|
80 | - // Check status code. |
|
81 | - if ($response) { |
|
82 | - |
|
83 | - $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]'); |
|
84 | - |
|
85 | - if (is_array($status)) { |
|
86 | - |
|
87 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
88 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
89 | - sprintf($GLOBALS['LANG']->getLL('solr.status'), (string) $status[0]), |
|
90 | - $GLOBALS['LANG']->getLL('solr.connected'), |
|
91 | - ($status[0] == 0 ? \TYPO3\CMS\Core\Messaging\FlashMessage::OK : \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING), |
|
92 | - FALSE |
|
93 | - ); |
|
94 | - |
|
95 | - $this->content .= $message->render(); |
|
96 | - |
|
97 | - return $this->content; |
|
98 | - |
|
99 | - } |
|
100 | - |
|
101 | - } |
|
102 | - |
|
103 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
104 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
105 | - sprintf($GLOBALS['LANG']->getLL('solr.error'), $url), |
|
106 | - $GLOBALS['LANG']->getLL('solr.notConnected'), |
|
107 | - \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
108 | - FALSE |
|
109 | - ); |
|
110 | - |
|
111 | - $this->content .= $message->render(); |
|
112 | - |
|
113 | - return $this->content; |
|
114 | - |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Make sure a backend user exists and is configured properly. |
|
119 | - * |
|
120 | - * @access protected |
|
121 | - * |
|
122 | - * @param boolean $checkOnly: Just check the user or change it, too? |
|
123 | - * @param integer $groupUid: UID of the corresponding usergroup |
|
124 | - * |
|
125 | - * @return integer UID of user or 0 if something is wrong |
|
126 | - */ |
|
127 | - protected function checkCliUser($checkOnly, $groupUid) { |
|
77 | + // Try to connect to Solr server. |
|
78 | + $response = @simplexml_load_string(file_get_contents($url, FALSE, $context)); |
|
79 | + |
|
80 | + // Check status code. |
|
81 | + if ($response) { |
|
82 | + |
|
83 | + $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]'); |
|
84 | + |
|
85 | + if (is_array($status)) { |
|
86 | + |
|
87 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
88 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
89 | + sprintf($GLOBALS['LANG']->getLL('solr.status'), (string) $status[0]), |
|
90 | + $GLOBALS['LANG']->getLL('solr.connected'), |
|
91 | + ($status[0] == 0 ? \TYPO3\CMS\Core\Messaging\FlashMessage::OK : \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING), |
|
92 | + FALSE |
|
93 | + ); |
|
94 | + |
|
95 | + $this->content .= $message->render(); |
|
96 | + |
|
97 | + return $this->content; |
|
98 | + |
|
99 | + } |
|
100 | + |
|
101 | + } |
|
102 | + |
|
103 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
104 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
105 | + sprintf($GLOBALS['LANG']->getLL('solr.error'), $url), |
|
106 | + $GLOBALS['LANG']->getLL('solr.notConnected'), |
|
107 | + \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
108 | + FALSE |
|
109 | + ); |
|
110 | + |
|
111 | + $this->content .= $message->render(); |
|
112 | + |
|
113 | + return $this->content; |
|
114 | + |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Make sure a backend user exists and is configured properly. |
|
119 | + * |
|
120 | + * @access protected |
|
121 | + * |
|
122 | + * @param boolean $checkOnly: Just check the user or change it, too? |
|
123 | + * @param integer $groupUid: UID of the corresponding usergroup |
|
124 | + * |
|
125 | + * @return integer UID of user or 0 if something is wrong |
|
126 | + */ |
|
127 | + protected function checkCliUser($checkOnly, $groupUid) { |
|
128 | 128 | |
129 | - // Set default return value. |
|
130 | - $usrUid = 0; |
|
129 | + // Set default return value. |
|
130 | + $usrUid = 0; |
|
131 | 131 | |
132 | - // Check if user "_cli_dlf" exists, is no admin and is not disabled. |
|
133 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
134 | - 'uid,admin,usergroup', |
|
135 | - 'be_users', |
|
136 | - 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users') |
|
137 | - ); |
|
132 | + // Check if user "_cli_dlf" exists, is no admin and is not disabled. |
|
133 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
134 | + 'uid,admin,usergroup', |
|
135 | + 'be_users', |
|
136 | + 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users') |
|
137 | + ); |
|
138 | 138 | |
139 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
139 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
140 | 140 | |
141 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
141 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
142 | 142 | |
143 | - // Explode comma-separated list. |
|
144 | - $resArray['usergroup'] = explode(',', $resArray['usergroup']); |
|
143 | + // Explode comma-separated list. |
|
144 | + $resArray['usergroup'] = explode(',', $resArray['usergroup']); |
|
145 | 145 | |
146 | - // Check if user is not disabled. |
|
147 | - $result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
148 | - '1', |
|
149 | - 'be_users', |
|
150 | - 'uid='.intval($resArray['uid']).\TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('be_users') |
|
151 | - ); |
|
146 | + // Check if user is not disabled. |
|
147 | + $result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
148 | + '1', |
|
149 | + 'be_users', |
|
150 | + 'uid='.intval($resArray['uid']).\TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('be_users') |
|
151 | + ); |
|
152 | 152 | |
153 | - // Check if user is configured properly. |
|
154 | - if (count(array_diff(array ($groupUid), $resArray['usergroup'])) == 0 |
|
155 | - && !$resArray['admin'] |
|
156 | - && $GLOBALS['TYPO3_DB']->sql_num_rows($result2) > 0) { |
|
153 | + // Check if user is configured properly. |
|
154 | + if (count(array_diff(array ($groupUid), $resArray['usergroup'])) == 0 |
|
155 | + && !$resArray['admin'] |
|
156 | + && $GLOBALS['TYPO3_DB']->sql_num_rows($result2) > 0) { |
|
157 | 157 | |
158 | - $usrUid = $resArray['uid']; |
|
158 | + $usrUid = $resArray['uid']; |
|
159 | 159 | |
160 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
161 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
162 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrOkayMsg'), |
|
163 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrOkay'), |
|
164 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
165 | - FALSE |
|
166 | - ); |
|
160 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
161 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
162 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrOkayMsg'), |
|
163 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrOkay'), |
|
164 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
165 | + FALSE |
|
166 | + ); |
|
167 | 167 | |
168 | - } else { |
|
168 | + } else { |
|
169 | 169 | |
170 | - if (!$checkOnly && $groupUid) { |
|
170 | + if (!$checkOnly && $groupUid) { |
|
171 | 171 | |
172 | - // Keep exisiting values and add the new ones. |
|
173 | - $usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup'])); |
|
172 | + // Keep exisiting values and add the new ones. |
|
173 | + $usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup'])); |
|
174 | 174 | |
175 | - // Try to configure user. |
|
176 | - $data = array(); |
|
177 | - $data['be_users'][$resArray['uid']] = array ( |
|
178 | - 'admin' => 0, |
|
179 | - 'usergroup' => implode(',', $usergroup), |
|
180 | - $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['disabled'] => 0, |
|
181 | - $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['starttime'] => 0, |
|
182 | - $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['endtime'] => 0 |
|
183 | - ); |
|
175 | + // Try to configure user. |
|
176 | + $data = array(); |
|
177 | + $data['be_users'][$resArray['uid']] = array ( |
|
178 | + 'admin' => 0, |
|
179 | + 'usergroup' => implode(',', $usergroup), |
|
180 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['disabled'] => 0, |
|
181 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['starttime'] => 0, |
|
182 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['endtime'] => 0 |
|
183 | + ); |
|
184 | 184 | |
185 | - tx_dlf_helper::processDBasAdmin($data); |
|
185 | + tx_dlf_helper::processDBasAdmin($data); |
|
186 | 186 | |
187 | - // Check if configuration was successful. |
|
188 | - if ($this->checkCliUser(TRUE, $groupUid)) { |
|
187 | + // Check if configuration was successful. |
|
188 | + if ($this->checkCliUser(TRUE, $groupUid)) { |
|
189 | 189 | |
190 | - $usrUid = $resArray['uid']; |
|
190 | + $usrUid = $resArray['uid']; |
|
191 | 191 | |
192 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
193 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
194 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrConfiguredMsg'), |
|
195 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrConfigured'), |
|
196 | - \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
197 | - FALSE |
|
198 | - ); |
|
199 | - |
|
200 | - } else { |
|
201 | - |
|
202 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
203 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
204 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
|
205 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
|
206 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
207 | - FALSE |
|
208 | - ); |
|
192 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
193 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
194 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrConfiguredMsg'), |
|
195 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrConfigured'), |
|
196 | + \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
197 | + FALSE |
|
198 | + ); |
|
199 | + |
|
200 | + } else { |
|
201 | + |
|
202 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
203 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
204 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
|
205 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
|
206 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
207 | + FALSE |
|
208 | + ); |
|
209 | 209 | |
210 | - } |
|
211 | - |
|
212 | - } else { |
|
213 | - |
|
214 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
215 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
216 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
|
217 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
|
218 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
219 | - FALSE |
|
220 | - ); |
|
221 | - |
|
222 | - } |
|
223 | - |
|
224 | - } |
|
225 | - |
|
226 | - } else { |
|
227 | - |
|
228 | - if (!$checkOnly && $groupUid) { |
|
229 | - |
|
230 | - // Try to create user. |
|
231 | - $tempUid = uniqid('NEW'); |
|
232 | - |
|
233 | - $data = array(); |
|
234 | - $data['be_users'][$tempUid] = array ( |
|
235 | - 'pid' => 0, |
|
236 | - 'username' => '_cli_dlf', |
|
237 | - 'password' => md5($tempUid), |
|
238 | - 'realName' => $GLOBALS['LANG']->getLL('cliUserGroup.usrRealName'), |
|
239 | - 'usergroup' => intval($groupUid) |
|
240 | - ); |
|
210 | + } |
|
211 | + |
|
212 | + } else { |
|
213 | + |
|
214 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
215 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
216 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
|
217 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
|
218 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
219 | + FALSE |
|
220 | + ); |
|
221 | + |
|
222 | + } |
|
223 | + |
|
224 | + } |
|
225 | + |
|
226 | + } else { |
|
227 | + |
|
228 | + if (!$checkOnly && $groupUid) { |
|
229 | + |
|
230 | + // Try to create user. |
|
231 | + $tempUid = uniqid('NEW'); |
|
232 | + |
|
233 | + $data = array(); |
|
234 | + $data['be_users'][$tempUid] = array ( |
|
235 | + 'pid' => 0, |
|
236 | + 'username' => '_cli_dlf', |
|
237 | + 'password' => md5($tempUid), |
|
238 | + 'realName' => $GLOBALS['LANG']->getLL('cliUserGroup.usrRealName'), |
|
239 | + 'usergroup' => intval($groupUid) |
|
240 | + ); |
|
241 | 241 | |
242 | - $substUid = tx_dlf_helper::processDBasAdmin($data); |
|
242 | + $substUid = tx_dlf_helper::processDBasAdmin($data); |
|
243 | 243 | |
244 | - // Check if creation was successful. |
|
245 | - if (!empty($substUid[$tempUid])) { |
|
246 | - |
|
247 | - $usrUid = $substUid[$tempUid]; |
|
248 | - |
|
249 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
250 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
251 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrCreatedMsg'), |
|
252 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrCreated'), |
|
253 | - \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
254 | - FALSE |
|
255 | - ); |
|
244 | + // Check if creation was successful. |
|
245 | + if (!empty($substUid[$tempUid])) { |
|
246 | + |
|
247 | + $usrUid = $substUid[$tempUid]; |
|
248 | + |
|
249 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
250 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
251 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrCreatedMsg'), |
|
252 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrCreated'), |
|
253 | + \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
254 | + FALSE |
|
255 | + ); |
|
256 | 256 | |
257 | - } else { |
|
257 | + } else { |
|
258 | 258 | |
259 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
260 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
261 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
|
262 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
|
263 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
264 | - FALSE |
|
265 | - ); |
|
259 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
260 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
261 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
|
262 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
|
263 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
264 | + FALSE |
|
265 | + ); |
|
266 | 266 | |
267 | - } |
|
267 | + } |
|
268 | 268 | |
269 | - } else { |
|
269 | + } else { |
|
270 | 270 | |
271 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
272 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
273 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
|
274 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
|
275 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
276 | - FALSE |
|
277 | - ); |
|
271 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
272 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
273 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
|
274 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
|
275 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
276 | + FALSE |
|
277 | + ); |
|
278 | 278 | |
279 | - } |
|
279 | + } |
|
280 | 280 | |
281 | - } |
|
281 | + } |
|
282 | 282 | |
283 | - $this->content = $message->render(); |
|
283 | + $this->content = $message->render(); |
|
284 | 284 | |
285 | - return $usrUid; |
|
285 | + return $usrUid; |
|
286 | 286 | |
287 | - } |
|
287 | + } |
|
288 | 288 | |
289 | - /** |
|
290 | - * Make sure a backend usergroup exists and is configured properly. |
|
291 | - * |
|
292 | - * @access protected |
|
293 | - * |
|
294 | - * @param boolean $checkOnly: Just check the usergroup or change it, too? |
|
295 | - * @param array $settings: Array with default settings |
|
296 | - * |
|
297 | - * @return integer UID of usergroup or 0 if something is wrong |
|
298 | - */ |
|
299 | - protected function checkCliGroup($checkOnly, $settings = array ()) { |
|
289 | + /** |
|
290 | + * Make sure a backend usergroup exists and is configured properly. |
|
291 | + * |
|
292 | + * @access protected |
|
293 | + * |
|
294 | + * @param boolean $checkOnly: Just check the usergroup or change it, too? |
|
295 | + * @param array $settings: Array with default settings |
|
296 | + * |
|
297 | + * @return integer UID of usergroup or 0 if something is wrong |
|
298 | + */ |
|
299 | + protected function checkCliGroup($checkOnly, $settings = array ()) { |
|
300 | 300 | |
301 | - // Set default return value. |
|
302 | - $grpUid = 0; |
|
301 | + // Set default return value. |
|
302 | + $grpUid = 0; |
|
303 | 303 | |
304 | - // Set default configuration for usergroup. |
|
305 | - if (empty($settings)) { |
|
304 | + // Set default configuration for usergroup. |
|
305 | + if (empty($settings)) { |
|
306 | 306 | |
307 | - $settings = array ( |
|
308 | - 'non_exclude_fields' => array (), |
|
309 | - 'tables_select' => array ( |
|
310 | - 'tx_dlf_documents', |
|
311 | - 'tx_dlf_collections', |
|
312 | - 'tx_dlf_libraries', |
|
313 | - 'tx_dlf_structures', |
|
314 | - 'tx_dlf_metadata', |
|
315 | - 'tx_dlf_metadataformat', |
|
316 | - 'tx_dlf_formats', |
|
317 | - 'tx_dlf_solrcores' |
|
318 | - ), |
|
319 | - 'tables_modify' => array ( |
|
320 | - 'tx_dlf_documents', |
|
321 | - 'tx_dlf_collections', |
|
322 | - 'tx_dlf_libraries' |
|
323 | - ) |
|
324 | - ); |
|
307 | + $settings = array ( |
|
308 | + 'non_exclude_fields' => array (), |
|
309 | + 'tables_select' => array ( |
|
310 | + 'tx_dlf_documents', |
|
311 | + 'tx_dlf_collections', |
|
312 | + 'tx_dlf_libraries', |
|
313 | + 'tx_dlf_structures', |
|
314 | + 'tx_dlf_metadata', |
|
315 | + 'tx_dlf_metadataformat', |
|
316 | + 'tx_dlf_formats', |
|
317 | + 'tx_dlf_solrcores' |
|
318 | + ), |
|
319 | + 'tables_modify' => array ( |
|
320 | + 'tx_dlf_documents', |
|
321 | + 'tx_dlf_collections', |
|
322 | + 'tx_dlf_libraries' |
|
323 | + ) |
|
324 | + ); |
|
325 | 325 | |
326 | - // Set allowed exclude fields. |
|
327 | - foreach ($settings['tables_modify'] as $table) { |
|
326 | + // Set allowed exclude fields. |
|
327 | + foreach ($settings['tables_modify'] as $table) { |
|
328 | 328 | |
329 | - foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $fieldConf) { |
|
329 | + foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $fieldConf) { |
|
330 | 330 | |
331 | - if (!empty($fieldConf['exclude'])) { |
|
331 | + if (!empty($fieldConf['exclude'])) { |
|
332 | 332 | |
333 | - $settings['non_exclude_fields'][] = $table.':'.$field; |
|
333 | + $settings['non_exclude_fields'][] = $table.':'.$field; |
|
334 | 334 | |
335 | - } |
|
335 | + } |
|
336 | 336 | |
337 | - } |
|
337 | + } |
|
338 | 338 | |
339 | - } |
|
339 | + } |
|
340 | 340 | |
341 | - } |
|
341 | + } |
|
342 | 342 | |
343 | - // Check if group "_cli_dlf" exists and is not disabled. |
|
344 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
345 | - 'uid,non_exclude_fields,tables_select,tables_modify,' . |
|
346 | - $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'], |
|
347 | - 'be_groups', |
|
348 | - 'title=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups') . |
|
349 | - \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') |
|
350 | - ); |
|
343 | + // Check if group "_cli_dlf" exists and is not disabled. |
|
344 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
345 | + 'uid,non_exclude_fields,tables_select,tables_modify,' . |
|
346 | + $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'], |
|
347 | + 'be_groups', |
|
348 | + 'title=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups') . |
|
349 | + \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') |
|
350 | + ); |
|
351 | 351 | |
352 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
352 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
353 | 353 | |
354 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
354 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
355 | 355 | |
356 | - // Explode comma-separated lists. |
|
357 | - $resArray['non_exclude_fields'] = explode(',', $resArray['non_exclude_fields']); |
|
356 | + // Explode comma-separated lists. |
|
357 | + $resArray['non_exclude_fields'] = explode(',', $resArray['non_exclude_fields']); |
|
358 | 358 | |
359 | - $resArray['tables_select'] = explode(',', $resArray['tables_select']); |
|
359 | + $resArray['tables_select'] = explode(',', $resArray['tables_select']); |
|
360 | 360 | |
361 | - $resArray['tables_modify'] = explode(',', $resArray['tables_modify']); |
|
361 | + $resArray['tables_modify'] = explode(',', $resArray['tables_modify']); |
|
362 | 362 | |
363 | - // Check if usergroup is configured properly. |
|
364 | - if (count(array_diff($settings['non_exclude_fields'], $resArray['non_exclude_fields'])) == 0 |
|
365 | - && count(array_diff($settings['tables_select'], $resArray['tables_select'])) == 0 |
|
366 | - && count(array_diff($settings['tables_modify'], $resArray['tables_modify'])) == 0 |
|
367 | - && $resArray[$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled']] == 0) { |
|
363 | + // Check if usergroup is configured properly. |
|
364 | + if (count(array_diff($settings['non_exclude_fields'], $resArray['non_exclude_fields'])) == 0 |
|
365 | + && count(array_diff($settings['tables_select'], $resArray['tables_select'])) == 0 |
|
366 | + && count(array_diff($settings['tables_modify'], $resArray['tables_modify'])) == 0 |
|
367 | + && $resArray[$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled']] == 0) { |
|
368 | 368 | |
369 | - $grpUid = $resArray['uid']; |
|
369 | + $grpUid = $resArray['uid']; |
|
370 | 370 | |
371 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
372 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
373 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpOkayMsg'), |
|
374 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpOkay'), |
|
375 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
376 | - FALSE |
|
377 | - ); |
|
371 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
372 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
373 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpOkayMsg'), |
|
374 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpOkay'), |
|
375 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
376 | + FALSE |
|
377 | + ); |
|
378 | 378 | |
379 | - } else { |
|
379 | + } else { |
|
380 | 380 | |
381 | - if (!$checkOnly) { |
|
381 | + if (!$checkOnly) { |
|
382 | 382 | |
383 | - // Keep exisiting values and add the new ones. |
|
384 | - $non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields'])); |
|
383 | + // Keep exisiting values and add the new ones. |
|
384 | + $non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields'])); |
|
385 | 385 | |
386 | - $tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select'])); |
|
386 | + $tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select'])); |
|
387 | 387 | |
388 | - $tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify'])); |
|
388 | + $tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify'])); |
|
389 | 389 | |
390 | - // Try to configure usergroup. |
|
391 | - $data = array(); |
|
392 | - $data['be_groups'][$resArray['uid']] = array( |
|
393 | - 'non_exclude_fields' => implode(',', $non_exclude_fields), |
|
394 | - 'tables_select' => implode(',', $tables_select), |
|
395 | - 'tables_modify' => implode(',', $tables_modify), |
|
396 | - $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] => 0 |
|
397 | - ); |
|
390 | + // Try to configure usergroup. |
|
391 | + $data = array(); |
|
392 | + $data['be_groups'][$resArray['uid']] = array( |
|
393 | + 'non_exclude_fields' => implode(',', $non_exclude_fields), |
|
394 | + 'tables_select' => implode(',', $tables_select), |
|
395 | + 'tables_modify' => implode(',', $tables_modify), |
|
396 | + $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] => 0 |
|
397 | + ); |
|
398 | 398 | |
399 | - tx_dlf_helper::processDBasAdmin($data); |
|
399 | + tx_dlf_helper::processDBasAdmin($data); |
|
400 | 400 | |
401 | - // Check if configuration was successful. |
|
402 | - if ($this->checkCliGroup(TRUE, $settings)) { |
|
401 | + // Check if configuration was successful. |
|
402 | + if ($this->checkCliGroup(TRUE, $settings)) { |
|
403 | 403 | |
404 | - $grpUid = $resArray['uid']; |
|
404 | + $grpUid = $resArray['uid']; |
|
405 | 405 | |
406 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
407 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
408 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpConfiguredMsg'), |
|
409 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpConfigured'), |
|
410 | - \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
411 | - FALSE |
|
412 | - ); |
|
406 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
407 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
408 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpConfiguredMsg'), |
|
409 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpConfigured'), |
|
410 | + \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
411 | + FALSE |
|
412 | + ); |
|
413 | 413 | |
414 | - } else { |
|
414 | + } else { |
|
415 | 415 | |
416 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
417 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
418 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
|
419 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
|
420 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
421 | - FALSE |
|
422 | - ); |
|
416 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
417 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
418 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
|
419 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
|
420 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
421 | + FALSE |
|
422 | + ); |
|
423 | 423 | |
424 | - } |
|
424 | + } |
|
425 | 425 | |
426 | - } else { |
|
426 | + } else { |
|
427 | 427 | |
428 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
429 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
430 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
|
431 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
|
432 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
433 | - FALSE |
|
434 | - ); |
|
428 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
429 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
430 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
|
431 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
|
432 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
433 | + FALSE |
|
434 | + ); |
|
435 | 435 | |
436 | - } |
|
436 | + } |
|
437 | 437 | |
438 | - } |
|
438 | + } |
|
439 | 439 | |
440 | - } else { |
|
440 | + } else { |
|
441 | 441 | |
442 | - if (!$checkOnly) { |
|
442 | + if (!$checkOnly) { |
|
443 | 443 | |
444 | - // Try to create usergroup. |
|
445 | - $tempUid = uniqid('NEW'); |
|
444 | + // Try to create usergroup. |
|
445 | + $tempUid = uniqid('NEW'); |
|
446 | 446 | |
447 | - $data = array(); |
|
448 | - $data['be_groups'][$tempUid] = array( |
|
449 | - 'pid' => 0, |
|
450 | - 'title' => '_cli_dlf', |
|
451 | - 'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'), |
|
452 | - 'non_exclude_fields' => implode(',', $settings['non_exclude_fields']), |
|
453 | - 'tables_select' => implode(',', $settings['tables_select']), |
|
454 | - 'tables_modify' => implode(',', $settings['tables_modify']) |
|
455 | - ); |
|
447 | + $data = array(); |
|
448 | + $data['be_groups'][$tempUid] = array( |
|
449 | + 'pid' => 0, |
|
450 | + 'title' => '_cli_dlf', |
|
451 | + 'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'), |
|
452 | + 'non_exclude_fields' => implode(',', $settings['non_exclude_fields']), |
|
453 | + 'tables_select' => implode(',', $settings['tables_select']), |
|
454 | + 'tables_modify' => implode(',', $settings['tables_modify']) |
|
455 | + ); |
|
456 | 456 | |
457 | - $substUid = tx_dlf_helper::processDBasAdmin($data); |
|
457 | + $substUid = tx_dlf_helper::processDBasAdmin($data); |
|
458 | 458 | |
459 | - // Check if creation was successful. |
|
460 | - if (!empty($substUid[$tempUid])) { |
|
459 | + // Check if creation was successful. |
|
460 | + if (!empty($substUid[$tempUid])) { |
|
461 | 461 | |
462 | - $grpUid = $substUid[$tempUid]; |
|
462 | + $grpUid = $substUid[$tempUid]; |
|
463 | 463 | |
464 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
465 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
466 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpCreatedMsg'), |
|
467 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpCreated'), |
|
468 | - \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
469 | - FALSE |
|
470 | - ); |
|
464 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
465 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
466 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpCreatedMsg'), |
|
467 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpCreated'), |
|
468 | + \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
469 | + FALSE |
|
470 | + ); |
|
471 | 471 | |
472 | - } else { |
|
472 | + } else { |
|
473 | 473 | |
474 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
475 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
476 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
|
477 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
|
478 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
479 | - FALSE |
|
480 | - ); |
|
474 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
475 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
476 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
|
477 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
|
478 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
479 | + FALSE |
|
480 | + ); |
|
481 | 481 | |
482 | - } |
|
482 | + } |
|
483 | 483 | |
484 | - } else { |
|
484 | + } else { |
|
485 | 485 | |
486 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
487 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
488 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
|
489 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
|
490 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
491 | - FALSE |
|
492 | - ); |
|
486 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
487 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
488 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
|
489 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
|
490 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
491 | + FALSE |
|
492 | + ); |
|
493 | 493 | |
494 | - } |
|
494 | + } |
|
495 | 495 | |
496 | - } |
|
496 | + } |
|
497 | 497 | |
498 | - $this->content = $message->render(); |
|
498 | + $this->content = $message->render(); |
|
499 | 499 | |
500 | - return $grpUid; |
|
500 | + return $grpUid; |
|
501 | 501 | |
502 | - } |
|
502 | + } |
|
503 | 503 | |
504 | - /** |
|
505 | - * Make sure a CLI user and group exist. |
|
506 | - * |
|
507 | - * @access public |
|
508 | - * |
|
509 | - * @param array &$params: An array with parameters |
|
510 | - * @param \TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object |
|
511 | - * |
|
512 | - * @return string Message informing the user of success or failure |
|
513 | - */ |
|
514 | - public function checkCliUserGroup(&$params, &$pObj) { |
|
504 | + /** |
|
505 | + * Make sure a CLI user and group exist. |
|
506 | + * |
|
507 | + * @access public |
|
508 | + * |
|
509 | + * @param array &$params: An array with parameters |
|
510 | + * @param \TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object |
|
511 | + * |
|
512 | + * @return string Message informing the user of success or failure |
|
513 | + */ |
|
514 | + public function checkCliUserGroup(&$params, &$pObj) { |
|
515 | 515 | |
516 | - // Check if usergroup "_cli_dlf" exists and is configured properly. |
|
517 | - $groupUid = $this->checkCliGroup(empty($this->conf['makeCliUserGroup'])); |
|
516 | + // Check if usergroup "_cli_dlf" exists and is configured properly. |
|
517 | + $groupUid = $this->checkCliGroup(empty($this->conf['makeCliUserGroup'])); |
|
518 | 518 | |
519 | - // Save output because it will be overwritten by the user check method. |
|
520 | - $content = $this->content; |
|
519 | + // Save output because it will be overwritten by the user check method. |
|
520 | + $content = $this->content; |
|
521 | 521 | |
522 | - // Check if user "_cli_dlf" exists and is configured properly. |
|
523 | - $userUid = $this->checkCliUser(empty($this->conf['makeCliUserGroup']), $groupUid); |
|
522 | + // Check if user "_cli_dlf" exists and is configured properly. |
|
523 | + $userUid = $this->checkCliUser(empty($this->conf['makeCliUserGroup']), $groupUid); |
|
524 | 524 | |
525 | - // Merge output from usergroup and user checks. |
|
526 | - $this->content .= $content; |
|
525 | + // Merge output from usergroup and user checks. |
|
526 | + $this->content .= $content; |
|
527 | 527 | |
528 | - // Check if CLI dispatcher is executable. |
|
529 | - if (is_executable(PATH_typo3.'cli_dispatch.phpsh')) { |
|
528 | + // Check if CLI dispatcher is executable. |
|
529 | + if (is_executable(PATH_typo3.'cli_dispatch.phpsh')) { |
|
530 | 530 | |
531 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
532 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
533 | - $GLOBALS['LANG']->getLL('cliUserGroup.cliOkayMsg'), |
|
534 | - $GLOBALS['LANG']->getLL('cliUserGroup.cliOkay'), |
|
535 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
536 | - FALSE |
|
537 | - ); |
|
531 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
532 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
533 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliOkayMsg'), |
|
534 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliOkay'), |
|
535 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
536 | + FALSE |
|
537 | + ); |
|
538 | 538 | |
539 | - } else { |
|
539 | + } else { |
|
540 | 540 | |
541 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
542 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
543 | - $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkayMsg'), |
|
544 | - $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkay'), |
|
545 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
546 | - FALSE |
|
547 | - ); |
|
548 | - |
|
549 | - } |
|
550 | - |
|
551 | - $this->content .= $message->render(); |
|
541 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
542 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
543 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkayMsg'), |
|
544 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkay'), |
|
545 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
546 | + FALSE |
|
547 | + ); |
|
548 | + |
|
549 | + } |
|
550 | + |
|
551 | + $this->content .= $message->render(); |
|
552 | 552 | |
553 | - return $this->content; |
|
553 | + return $this->content; |
|
554 | 554 | |
555 | - } |
|
555 | + } |
|
556 | 556 | |
557 | - /** |
|
558 | - * Make sure the essential namespaces are defined. |
|
559 | - * |
|
560 | - * @access public |
|
561 | - * |
|
562 | - * @param array &$params: An array with parameters |
|
563 | - * @param \TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object |
|
564 | - * |
|
565 | - * @return string Message informing the user of success or failure |
|
566 | - */ |
|
567 | - public function checkMetadataFormats(&$params, &$pObj) { |
|
557 | + /** |
|
558 | + * Make sure the essential namespaces are defined. |
|
559 | + * |
|
560 | + * @access public |
|
561 | + * |
|
562 | + * @param array &$params: An array with parameters |
|
563 | + * @param \TYPO3\CMS\Core\TypoScript\ConfigurationForm &$pObj: The parent object |
|
564 | + * |
|
565 | + * @return string Message informing the user of success or failure |
|
566 | + */ |
|
567 | + public function checkMetadataFormats(&$params, &$pObj) { |
|
568 | 568 | |
569 | - $nsDefined = array ( |
|
570 | - 'MODS' => FALSE, |
|
571 | - 'TEIHDR' => FALSE |
|
572 | - ); |
|
569 | + $nsDefined = array ( |
|
570 | + 'MODS' => FALSE, |
|
571 | + 'TEIHDR' => FALSE |
|
572 | + ); |
|
573 | 573 | |
574 | - // Check if formats "MODS" and "TEIHDR" exist. |
|
575 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
576 | - 'type', |
|
577 | - 'tx_dlf_formats', |
|
578 | - '(type='.$GLOBALS['TYPO3_DB']->fullQuoteStr('MODS', 'tx_dlf_formats').' OR type='.$GLOBALS['TYPO3_DB']->fullQuoteStr('TEIHDR', 'tx_dlf_formats').')'.tx_dlf_helper::whereClause('tx_dlf_formats') |
|
579 | - ); |
|
574 | + // Check if formats "MODS" and "TEIHDR" exist. |
|
575 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
576 | + 'type', |
|
577 | + 'tx_dlf_formats', |
|
578 | + '(type='.$GLOBALS['TYPO3_DB']->fullQuoteStr('MODS', 'tx_dlf_formats').' OR type='.$GLOBALS['TYPO3_DB']->fullQuoteStr('TEIHDR', 'tx_dlf_formats').')'.tx_dlf_helper::whereClause('tx_dlf_formats') |
|
579 | + ); |
|
580 | 580 | |
581 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
581 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
582 | 582 | |
583 | - $nsDefined[$resArray['type']] = TRUE; |
|
583 | + $nsDefined[$resArray['type']] = TRUE; |
|
584 | 584 | |
585 | - } |
|
585 | + } |
|
586 | 586 | |
587 | - // Build data array. |
|
588 | - $data = array (); |
|
587 | + // Build data array. |
|
588 | + $data = array (); |
|
589 | 589 | |
590 | - // Add MODS namespace. |
|
591 | - if (!$nsDefined['MODS']) { |
|
590 | + // Add MODS namespace. |
|
591 | + if (!$nsDefined['MODS']) { |
|
592 | 592 | |
593 | - $data['tx_dlf_formats'][uniqid('NEW')] = array ( |
|
594 | - 'pid' => 0, |
|
595 | - 'type' => 'MODS', |
|
596 | - 'root' => 'mods', |
|
597 | - 'namespace' => 'http://www.loc.gov/mods/v3', |
|
598 | - 'class' => 'tx_dlf_mods' |
|
599 | - ); |
|
593 | + $data['tx_dlf_formats'][uniqid('NEW')] = array ( |
|
594 | + 'pid' => 0, |
|
595 | + 'type' => 'MODS', |
|
596 | + 'root' => 'mods', |
|
597 | + 'namespace' => 'http://www.loc.gov/mods/v3', |
|
598 | + 'class' => 'tx_dlf_mods' |
|
599 | + ); |
|
600 | 600 | |
601 | - } |
|
601 | + } |
|
602 | 602 | |
603 | - // Add TEIHDR namespace. |
|
604 | - if (!$nsDefined['TEIHDR']) { |
|
605 | - |
|
606 | - $data['tx_dlf_formats'][uniqid('NEW')] = array ( |
|
607 | - 'pid' => 0, |
|
608 | - 'type' => 'TEIHDR', |
|
609 | - 'root' => 'teiHeader', |
|
610 | - 'namespace' => 'http://www.tei-c.org/ns/1.0', |
|
611 | - 'class' => 'tx_dlf_teihdr' |
|
612 | - ); |
|
603 | + // Add TEIHDR namespace. |
|
604 | + if (!$nsDefined['TEIHDR']) { |
|
605 | + |
|
606 | + $data['tx_dlf_formats'][uniqid('NEW')] = array ( |
|
607 | + 'pid' => 0, |
|
608 | + 'type' => 'TEIHDR', |
|
609 | + 'root' => 'teiHeader', |
|
610 | + 'namespace' => 'http://www.tei-c.org/ns/1.0', |
|
611 | + 'class' => 'tx_dlf_teihdr' |
|
612 | + ); |
|
613 | 613 | |
614 | - } |
|
614 | + } |
|
615 | 615 | |
616 | - if (!empty($data)) { |
|
616 | + if (!empty($data)) { |
|
617 | 617 | |
618 | - // Process changes. |
|
619 | - $substUid = tx_dlf_helper::processDBasAdmin($data); |
|
618 | + // Process changes. |
|
619 | + $substUid = tx_dlf_helper::processDBasAdmin($data); |
|
620 | 620 | |
621 | - if (!empty($substUid)) { |
|
621 | + if (!empty($substUid)) { |
|
622 | 622 | |
623 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
624 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
625 | - $GLOBALS['LANG']->getLL('metadataFormats.nsCreatedMsg'), |
|
626 | - $GLOBALS['LANG']->getLL('metadataFormats.nsCreated'), |
|
627 | - \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
628 | - FALSE |
|
629 | - ); |
|
623 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
624 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
625 | + $GLOBALS['LANG']->getLL('metadataFormats.nsCreatedMsg'), |
|
626 | + $GLOBALS['LANG']->getLL('metadataFormats.nsCreated'), |
|
627 | + \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
628 | + FALSE |
|
629 | + ); |
|
630 | 630 | |
631 | - } else { |
|
631 | + } else { |
|
632 | 632 | |
633 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
634 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
635 | - $GLOBALS['LANG']->getLL('metadataFormats.nsNotCreatedMsg'), |
|
636 | - $GLOBALS['LANG']->getLL('metadataFormats.nsNotCreated'), |
|
637 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
638 | - FALSE |
|
639 | - ); |
|
633 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
634 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
635 | + $GLOBALS['LANG']->getLL('metadataFormats.nsNotCreatedMsg'), |
|
636 | + $GLOBALS['LANG']->getLL('metadataFormats.nsNotCreated'), |
|
637 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
638 | + FALSE |
|
639 | + ); |
|
640 | 640 | |
641 | - } |
|
641 | + } |
|
642 | 642 | |
643 | - } else { |
|
643 | + } else { |
|
644 | 644 | |
645 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
646 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
647 | - $GLOBALS['LANG']->getLL('metadataFormats.nsOkayMsg'), |
|
648 | - $GLOBALS['LANG']->getLL('metadataFormats.nsOkay'), |
|
649 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
650 | - FALSE |
|
651 | - ); |
|
645 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
646 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
647 | + $GLOBALS['LANG']->getLL('metadataFormats.nsOkayMsg'), |
|
648 | + $GLOBALS['LANG']->getLL('metadataFormats.nsOkay'), |
|
649 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
650 | + FALSE |
|
651 | + ); |
|
652 | 652 | |
653 | - } |
|
653 | + } |
|
654 | 654 | |
655 | - $this->content .= $message->render(); |
|
655 | + $this->content .= $message->render(); |
|
656 | 656 | |
657 | - return $this->content; |
|
657 | + return $this->content; |
|
658 | 658 | |
659 | - } |
|
659 | + } |
|
660 | 660 | |
661 | - /** |
|
662 | - * This is the constructor. |
|
663 | - * |
|
664 | - * @access public |
|
665 | - * |
|
666 | - * @return void |
|
667 | - */ |
|
668 | - public function __construct() { |
|
661 | + /** |
|
662 | + * This is the constructor. |
|
663 | + * |
|
664 | + * @access public |
|
665 | + * |
|
666 | + * @return void |
|
667 | + */ |
|
668 | + public function __construct() { |
|
669 | 669 | |
670 | - // Load localization file. |
|
671 | - $GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml'); |
|
670 | + // Load localization file. |
|
671 | + $GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml'); |
|
672 | 672 | |
673 | - // Get current configuration. |
|
674 | - $this->conf = array_merge((array) unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']), (array) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('data')); |
|
673 | + // Get current configuration. |
|
674 | + $this->conf = array_merge((array) unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']), (array) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('data')); |
|
675 | 675 | |
676 | - } |
|
676 | + } |
|
677 | 677 | |
678 | 678 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup'])); |
174 | 174 | |
175 | 175 | // Try to configure user. |
176 | - $data = array(); |
|
176 | + $data = array (); |
|
177 | 177 | $data['be_users'][$resArray['uid']] = array ( |
178 | 178 | 'admin' => 0, |
179 | 179 | 'usergroup' => implode(',', $usergroup), |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | // Try to create user. |
231 | 231 | $tempUid = uniqid('NEW'); |
232 | 232 | |
233 | - $data = array(); |
|
233 | + $data = array (); |
|
234 | 234 | $data['be_users'][$tempUid] = array ( |
235 | 235 | 'pid' => 0, |
236 | 236 | 'username' => '_cli_dlf', |
@@ -342,10 +342,10 @@ discard block |
||
342 | 342 | |
343 | 343 | // Check if group "_cli_dlf" exists and is not disabled. |
344 | 344 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
345 | - 'uid,non_exclude_fields,tables_select,tables_modify,' . |
|
345 | + 'uid,non_exclude_fields,tables_select,tables_modify,'. |
|
346 | 346 | $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'], |
347 | 347 | 'be_groups', |
348 | - 'title=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups') . |
|
348 | + 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups'). |
|
349 | 349 | \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') |
350 | 350 | ); |
351 | 351 | |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | $tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify'])); |
389 | 389 | |
390 | 390 | // Try to configure usergroup. |
391 | - $data = array(); |
|
392 | - $data['be_groups'][$resArray['uid']] = array( |
|
391 | + $data = array (); |
|
392 | + $data['be_groups'][$resArray['uid']] = array ( |
|
393 | 393 | 'non_exclude_fields' => implode(',', $non_exclude_fields), |
394 | 394 | 'tables_select' => implode(',', $tables_select), |
395 | 395 | 'tables_modify' => implode(',', $tables_modify), |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | // Try to create usergroup. |
445 | 445 | $tempUid = uniqid('NEW'); |
446 | 446 | |
447 | - $data = array(); |
|
448 | - $data['be_groups'][$tempUid] = array( |
|
447 | + $data = array (); |
|
448 | + $data['be_groups'][$tempUid] = array ( |
|
449 | 449 | 'pid' => 0, |
450 | 450 | 'title' => '_cli_dlf', |
451 | 451 | 'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'), |
@@ -19,393 +19,393 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_tceforms { |
21 | 21 | |
22 | - /** |
|
23 | - * Helper to display document's thumbnail for table "tx_dlf_documents" |
|
24 | - * |
|
25 | - * @access public |
|
26 | - * |
|
27 | - * @param array &$params: An array with parameters |
|
28 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
29 | - * |
|
30 | - * @return string HTML <img> tag for thumbnail |
|
31 | - */ |
|
32 | - public function displayThumbnail(&$params, &$pObj) { |
|
22 | + /** |
|
23 | + * Helper to display document's thumbnail for table "tx_dlf_documents" |
|
24 | + * |
|
25 | + * @access public |
|
26 | + * |
|
27 | + * @param array &$params: An array with parameters |
|
28 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
29 | + * |
|
30 | + * @return string HTML <img> tag for thumbnail |
|
31 | + */ |
|
32 | + public function displayThumbnail(&$params, &$pObj) { |
|
33 | 33 | |
34 | - $output = '<div style="padding:5px; background-color:#000000;">'; |
|
34 | + $output = '<div style="padding:5px; background-color:#000000;">'; |
|
35 | 35 | |
36 | - // Simulate TCA field type "passthrough". |
|
37 | - $output .= '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />'; |
|
36 | + // Simulate TCA field type "passthrough". |
|
37 | + $output .= '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />'; |
|
38 | 38 | |
39 | - if (!empty($params['itemFormElValue'])) { |
|
39 | + if (!empty($params['itemFormElValue'])) { |
|
40 | 40 | |
41 | - $output .= '<img alt="" src="'.$params['itemFormElValue'].'" />'; |
|
41 | + $output .= '<img alt="" src="'.$params['itemFormElValue'].'" />'; |
|
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - $output .= '</div>'; |
|
45 | + $output .= '</div>'; |
|
46 | 46 | |
47 | - return $output; |
|
47 | + return $output; |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Helper to get flexform's items array for plugin "tx_dlf_collection" |
|
53 | - * |
|
54 | - * @access public |
|
55 | - * |
|
56 | - * @param array &$params: An array with parameters |
|
57 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
58 | - * |
|
59 | - * @return void |
|
60 | - */ |
|
61 | - public function itemsProcFunc_collectionList(&$params, &$pObj) { |
|
51 | + /** |
|
52 | + * Helper to get flexform's items array for plugin "tx_dlf_collection" |
|
53 | + * |
|
54 | + * @access public |
|
55 | + * |
|
56 | + * @param array &$params: An array with parameters |
|
57 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
58 | + * |
|
59 | + * @return void |
|
60 | + */ |
|
61 | + public function itemsProcFunc_collectionList(&$params, &$pObj) { |
|
62 | 62 | |
63 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
64 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
63 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
64 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
65 | 65 | |
66 | - if ($params['row']['pi_flexform']) { |
|
66 | + if ($params['row']['pi_flexform']) { |
|
67 | 67 | |
68 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
68 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
69 | 69 | |
70 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
70 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
71 | 71 | |
72 | - } |
|
72 | + } |
|
73 | 73 | |
74 | - } else { |
|
74 | + } else { |
|
75 | 75 | |
76 | - $pages = $params['row']['pages']; |
|
76 | + $pages = $params['row']['pages']; |
|
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | - if (!empty($pages)) { |
|
80 | + if (!empty($pages)) { |
|
81 | 81 | |
82 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
83 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
84 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
82 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
83 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
84 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
85 | 85 | |
86 | - $parts = explode('|', $pages); |
|
86 | + $parts = explode('|', $pages); |
|
87 | 87 | |
88 | - $pages = array_pop(explode('_', $parts[0])); |
|
88 | + $pages = array_pop(explode('_', $parts[0])); |
|
89 | 89 | |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | - if ($pages > 0) { |
|
92 | + if ($pages > 0) { |
|
93 | 93 | |
94 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
95 | - 'label,uid', |
|
96 | - 'tx_dlf_collections', |
|
97 | - 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
98 | - '', |
|
99 | - 'label', |
|
100 | - '' |
|
101 | - ); |
|
94 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
95 | + 'label,uid', |
|
96 | + 'tx_dlf_collections', |
|
97 | + 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
98 | + '', |
|
99 | + 'label', |
|
100 | + '' |
|
101 | + ); |
|
102 | 102 | |
103 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
103 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
104 | 104 | |
105 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
105 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
106 | 106 | |
107 | - $params['items'][] = $resArray; |
|
107 | + $params['items'][] = $resArray; |
|
108 | 108 | |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | - } |
|
115 | + } |
|
116 | 116 | |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
121 | - * |
|
122 | - * @access public |
|
123 | - * |
|
124 | - * @param array &$params: An array with parameters |
|
125 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
126 | - * |
|
127 | - * @return void |
|
128 | - */ |
|
129 | - public function itemsProcFunc_extendedSearchList(&$params, &$pObj) { |
|
119 | + /** |
|
120 | + * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
121 | + * |
|
122 | + * @access public |
|
123 | + * |
|
124 | + * @param array &$params: An array with parameters |
|
125 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
126 | + * |
|
127 | + * @return void |
|
128 | + */ |
|
129 | + public function itemsProcFunc_extendedSearchList(&$params, &$pObj) { |
|
130 | 130 | |
131 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
132 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
131 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
132 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
133 | 133 | |
134 | - if ($params['row']['pi_flexform']) { |
|
134 | + if ($params['row']['pi_flexform']) { |
|
135 | 135 | |
136 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
136 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
137 | 137 | |
138 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
138 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
139 | 139 | |
140 | - } |
|
140 | + } |
|
141 | 141 | |
142 | - } else { |
|
142 | + } else { |
|
143 | 143 | |
144 | - $pages = $params['row']['pages']; |
|
144 | + $pages = $params['row']['pages']; |
|
145 | 145 | |
146 | - } |
|
146 | + } |
|
147 | 147 | |
148 | - if (!empty($pages)) { |
|
148 | + if (!empty($pages)) { |
|
149 | 149 | |
150 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
151 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
152 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
150 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
151 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
152 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
153 | 153 | |
154 | - $_parts = explode('|', $pages); |
|
154 | + $_parts = explode('|', $pages); |
|
155 | 155 | |
156 | - $pages = array_pop(explode('_', $_parts[0])); |
|
156 | + $pages = array_pop(explode('_', $_parts[0])); |
|
157 | 157 | |
158 | - } |
|
158 | + } |
|
159 | 159 | |
160 | - if ($pages > 0) { |
|
160 | + if ($pages > 0) { |
|
161 | 161 | |
162 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
163 | - 'label,index_name', |
|
164 | - 'tx_dlf_metadata', |
|
165 | - 'index_indexed=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
166 | - '', |
|
167 | - 'sorting', |
|
168 | - '' |
|
169 | - ); |
|
162 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
163 | + 'label,index_name', |
|
164 | + 'tx_dlf_metadata', |
|
165 | + 'index_indexed=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
166 | + '', |
|
167 | + 'sorting', |
|
168 | + '' |
|
169 | + ); |
|
170 | 170 | |
171 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
171 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
172 | 172 | |
173 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
173 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
174 | 174 | |
175 | - $params['items'][] = $resArray; |
|
175 | + $params['items'][] = $resArray; |
|
176 | 176 | |
177 | - } |
|
177 | + } |
|
178 | 178 | |
179 | - } |
|
179 | + } |
|
180 | 180 | |
181 | - } |
|
181 | + } |
|
182 | 182 | |
183 | - } |
|
183 | + } |
|
184 | 184 | |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
189 | - * |
|
190 | - * @access public |
|
191 | - * |
|
192 | - * @param array &$params: An array with parameters |
|
193 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
194 | - * |
|
195 | - * @return void |
|
196 | - */ |
|
197 | - public function itemsProcFunc_facetsList(&$params, &$pObj) { |
|
187 | + /** |
|
188 | + * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
189 | + * |
|
190 | + * @access public |
|
191 | + * |
|
192 | + * @param array &$params: An array with parameters |
|
193 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
194 | + * |
|
195 | + * @return void |
|
196 | + */ |
|
197 | + public function itemsProcFunc_facetsList(&$params, &$pObj) { |
|
198 | 198 | |
199 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
200 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
199 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
200 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
201 | 201 | |
202 | - if ($params['row']['pi_flexform']) { |
|
202 | + if ($params['row']['pi_flexform']) { |
|
203 | 203 | |
204 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
204 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
205 | 205 | |
206 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
206 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
207 | 207 | |
208 | - } |
|
208 | + } |
|
209 | 209 | |
210 | - } else { |
|
210 | + } else { |
|
211 | 211 | |
212 | - $pages = $params['row']['pages']; |
|
212 | + $pages = $params['row']['pages']; |
|
213 | 213 | |
214 | - } |
|
214 | + } |
|
215 | 215 | |
216 | - if (!empty($pages)) { |
|
216 | + if (!empty($pages)) { |
|
217 | 217 | |
218 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
219 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
220 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
218 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
219 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
220 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
221 | 221 | |
222 | - $_parts = explode('|', $pages); |
|
222 | + $_parts = explode('|', $pages); |
|
223 | 223 | |
224 | - $pages = array_pop(explode('_', $_parts[0])); |
|
224 | + $pages = array_pop(explode('_', $_parts[0])); |
|
225 | 225 | |
226 | - } |
|
226 | + } |
|
227 | 227 | |
228 | - if ($pages > 0) { |
|
228 | + if ($pages > 0) { |
|
229 | 229 | |
230 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
231 | - 'label,index_name', |
|
232 | - 'tx_dlf_metadata', |
|
233 | - 'is_facet=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
234 | - '', |
|
235 | - 'sorting', |
|
236 | - '' |
|
237 | - ); |
|
230 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
231 | + 'label,index_name', |
|
232 | + 'tx_dlf_metadata', |
|
233 | + 'is_facet=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
234 | + '', |
|
235 | + 'sorting', |
|
236 | + '' |
|
237 | + ); |
|
238 | 238 | |
239 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
239 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
240 | 240 | |
241 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
241 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
242 | 242 | |
243 | - $params['items'][] = $resArray; |
|
243 | + $params['items'][] = $resArray; |
|
244 | 244 | |
245 | - } |
|
245 | + } |
|
246 | 246 | |
247 | - } |
|
247 | + } |
|
248 | 248 | |
249 | - } |
|
249 | + } |
|
250 | 250 | |
251 | - } |
|
251 | + } |
|
252 | 252 | |
253 | - } |
|
253 | + } |
|
254 | 254 | |
255 | - /** |
|
256 | - * Helper to get flexform's items array for plugin "tx_dlf_oai" |
|
257 | - * |
|
258 | - * @access public |
|
259 | - * |
|
260 | - * @param array &$params: An array with parameters |
|
261 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
262 | - * |
|
263 | - * @return void |
|
264 | - */ |
|
265 | - public function itemsProcFunc_libraryList(&$params, &$pObj) { |
|
255 | + /** |
|
256 | + * Helper to get flexform's items array for plugin "tx_dlf_oai" |
|
257 | + * |
|
258 | + * @access public |
|
259 | + * |
|
260 | + * @param array &$params: An array with parameters |
|
261 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
262 | + * |
|
263 | + * @return void |
|
264 | + */ |
|
265 | + public function itemsProcFunc_libraryList(&$params, &$pObj) { |
|
266 | 266 | |
267 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
268 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
267 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
268 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
269 | 269 | |
270 | - if ($params['row']['pi_flexform']) { |
|
270 | + if ($params['row']['pi_flexform']) { |
|
271 | 271 | |
272 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
272 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
273 | 273 | |
274 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
274 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
275 | 275 | |
276 | - } |
|
276 | + } |
|
277 | 277 | |
278 | - } else { |
|
278 | + } else { |
|
279 | 279 | |
280 | - $pages = $params['row']['pages']; |
|
280 | + $pages = $params['row']['pages']; |
|
281 | 281 | |
282 | - } |
|
282 | + } |
|
283 | 283 | |
284 | - if (!empty($pages)) { |
|
284 | + if (!empty($pages)) { |
|
285 | 285 | |
286 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
287 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
288 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
286 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
287 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
288 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
289 | 289 | |
290 | - $parts = explode('|', $pages); |
|
290 | + $parts = explode('|', $pages); |
|
291 | 291 | |
292 | - $pages = array_pop(explode('_', $parts[0])); |
|
292 | + $pages = array_pop(explode('_', $parts[0])); |
|
293 | 293 | |
294 | - } |
|
294 | + } |
|
295 | 295 | |
296 | - if ($pages > 0) { |
|
296 | + if ($pages > 0) { |
|
297 | 297 | |
298 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
299 | - 'label,uid', |
|
300 | - 'tx_dlf_libraries', |
|
301 | - 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'), |
|
302 | - '', |
|
303 | - 'label', |
|
304 | - '' |
|
305 | - ); |
|
298 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
299 | + 'label,uid', |
|
300 | + 'tx_dlf_libraries', |
|
301 | + 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'), |
|
302 | + '', |
|
303 | + 'label', |
|
304 | + '' |
|
305 | + ); |
|
306 | 306 | |
307 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
307 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
308 | 308 | |
309 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
309 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
310 | 310 | |
311 | - $params['items'][] = $resArray; |
|
311 | + $params['items'][] = $resArray; |
|
312 | 312 | |
313 | - } |
|
313 | + } |
|
314 | 314 | |
315 | - } |
|
315 | + } |
|
316 | 316 | |
317 | - } |
|
317 | + } |
|
318 | 318 | |
319 | - } |
|
319 | + } |
|
320 | 320 | |
321 | - } |
|
321 | + } |
|
322 | 322 | |
323 | - /** |
|
324 | - * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
325 | - * |
|
326 | - * @access public |
|
327 | - * |
|
328 | - * @param array &$params: An array with parameters |
|
329 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
330 | - * |
|
331 | - * @return void |
|
332 | - */ |
|
333 | - public function itemsProcFunc_solrList(&$params, &$pObj) { |
|
323 | + /** |
|
324 | + * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
325 | + * |
|
326 | + * @access public |
|
327 | + * |
|
328 | + * @param array &$params: An array with parameters |
|
329 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
330 | + * |
|
331 | + * @return void |
|
332 | + */ |
|
333 | + public function itemsProcFunc_solrList(&$params, &$pObj) { |
|
334 | 334 | |
335 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
336 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
335 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
336 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
337 | 337 | |
338 | - if ($params['row']['pi_flexform']) { |
|
338 | + if ($params['row']['pi_flexform']) { |
|
339 | 339 | |
340 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
340 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
341 | 341 | |
342 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
342 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
343 | 343 | |
344 | - } |
|
344 | + } |
|
345 | 345 | |
346 | - } else { |
|
346 | + } else { |
|
347 | 347 | |
348 | - $pages = $params['row']['pages']; |
|
348 | + $pages = $params['row']['pages']; |
|
349 | 349 | |
350 | - } |
|
350 | + } |
|
351 | 351 | |
352 | - if (!empty($pages)) { |
|
352 | + if (!empty($pages)) { |
|
353 | 353 | |
354 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
355 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
356 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
354 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
355 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
356 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
357 | 357 | |
358 | - $parts = explode('|', $pages); |
|
358 | + $parts = explode('|', $pages); |
|
359 | 359 | |
360 | - $pages = array_pop(explode('_', $parts[0])); |
|
360 | + $pages = array_pop(explode('_', $parts[0])); |
|
361 | 361 | |
362 | - } |
|
362 | + } |
|
363 | 363 | |
364 | - if ($pages > 0) { |
|
364 | + if ($pages > 0) { |
|
365 | 365 | |
366 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
367 | - 'label,uid', |
|
368 | - 'tx_dlf_solrcores', |
|
369 | - 'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
370 | - '', |
|
371 | - 'label', |
|
372 | - '' |
|
373 | - ); |
|
366 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
367 | + 'label,uid', |
|
368 | + 'tx_dlf_solrcores', |
|
369 | + 'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
370 | + '', |
|
371 | + 'label', |
|
372 | + '' |
|
373 | + ); |
|
374 | 374 | |
375 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
375 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
376 | 376 | |
377 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
377 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
378 | 378 | |
379 | - $params['items'][] = $resArray; |
|
379 | + $params['items'][] = $resArray; |
|
380 | 380 | |
381 | - } |
|
381 | + } |
|
382 | 382 | |
383 | - } |
|
383 | + } |
|
384 | 384 | |
385 | - } |
|
385 | + } |
|
386 | 386 | |
387 | - } |
|
387 | + } |
|
388 | 388 | |
389 | - } |
|
389 | + } |
|
390 | 390 | |
391 | - /** |
|
392 | - * Helper to get flexform's items array for plugin "tx_dlf_toolbox" |
|
393 | - * |
|
394 | - * @access public |
|
395 | - * |
|
396 | - * @param array &$params: An array with parameters |
|
397 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
398 | - * |
|
399 | - * @return void |
|
400 | - */ |
|
401 | - public function itemsProcFunc_toolList(&$params, &$pObj) { |
|
391 | + /** |
|
392 | + * Helper to get flexform's items array for plugin "tx_dlf_toolbox" |
|
393 | + * |
|
394 | + * @access public |
|
395 | + * |
|
396 | + * @param array &$params: An array with parameters |
|
397 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
398 | + * |
|
399 | + * @return void |
|
400 | + */ |
|
401 | + public function itemsProcFunc_toolList(&$params, &$pObj) { |
|
402 | 402 | |
403 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'] as $class => $label) { |
|
403 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'] as $class => $label) { |
|
404 | 404 | |
405 | - $params['items'][] = array ($GLOBALS['LANG']->sL($label), $class); |
|
405 | + $params['items'][] = array ($GLOBALS['LANG']->sL($label), $class); |
|
406 | 406 | |
407 | - } |
|
407 | + } |
|
408 | 408 | |
409 | - } |
|
409 | + } |
|
410 | 410 | |
411 | 411 | } |
@@ -19,69 +19,69 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_hacks { |
21 | 21 | |
22 | - /** |
|
23 | - * Hook for the __construct() method of dlf/common/class.tx_dlf_document.php |
|
24 | - * When using Kitodo.Production the record identifier is saved only in MODS, but not |
|
25 | - * in METS. To get it anyway, we have to do some magic. |
|
26 | - * |
|
27 | - * @access public |
|
28 | - * |
|
29 | - * @param SimpleXMLElement &$xml: The XML object |
|
30 | - * @param mixed $record_id: The record identifier |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) { |
|
22 | + /** |
|
23 | + * Hook for the __construct() method of dlf/common/class.tx_dlf_document.php |
|
24 | + * When using Kitodo.Production the record identifier is saved only in MODS, but not |
|
25 | + * in METS. To get it anyway, we have to do some magic. |
|
26 | + * |
|
27 | + * @access public |
|
28 | + * |
|
29 | + * @param SimpleXMLElement &$xml: The XML object |
|
30 | + * @param mixed $record_id: The record identifier |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) { |
|
35 | 35 | |
36 | - if (!$record_id) { |
|
36 | + if (!$record_id) { |
|
37 | 37 | |
38 | - $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
|
38 | + $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
|
39 | 39 | |
40 | - // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
|
41 | - if (($divs = $xml->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) { |
|
40 | + // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
|
41 | + if (($divs = $xml->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) { |
|
42 | 42 | |
43 | - $smLinks = $xml->xpath('//mets:structLink/mets:smLink'); |
|
43 | + $smLinks = $xml->xpath('//mets:structLink/mets:smLink'); |
|
44 | 44 | |
45 | - if ($smLinks) { |
|
45 | + if ($smLinks) { |
|
46 | 46 | |
47 | - foreach ($smLinks as $smLink) { |
|
47 | + foreach ($smLinks as $smLink) { |
|
48 | 48 | |
49 | - $links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to; |
|
49 | + $links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to; |
|
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - foreach ($divs as $div) { |
|
53 | + foreach ($divs as $div) { |
|
54 | 54 | |
55 | - if (!empty($links[(string) $div['ID']])) { |
|
55 | + if (!empty($links[(string) $div['ID']])) { |
|
56 | 56 | |
57 | - $id = (string) $div['DMDID']; |
|
57 | + $id = (string) $div['DMDID']; |
|
58 | 58 | |
59 | - break; |
|
59 | + break; |
|
60 | 60 | |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | - if (empty($id)) { |
|
67 | + if (empty($id)) { |
|
68 | 68 | |
69 | - $id = (string) $divs[0]['DMDID']; |
|
69 | + $id = (string) $divs[0]['DMDID']; |
|
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); |
|
73 | + $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); |
|
74 | 74 | |
75 | - if (!empty($recordIds[0])) { |
|
75 | + if (!empty($recordIds[0])) { |
|
76 | 76 | |
77 | - $record_id = (string) $recordIds[0]; |
|
77 | + $record_id = (string) $recordIds[0]; |
|
78 | 78 | |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * |
32 | 32 | * @return void |
33 | 33 | */ |
34 | - public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) { |
|
34 | + public function construct_postProcessRecordId(SimpleXMLElement & $xml, &$record_id) { |
|
35 | 35 | |
36 | 36 | if (!$record_id) { |
37 | 37 |