7e7cd24039487bc160d93923fdaedf5916595bb2
[Packages/TYPO3.CMS.git] / typo3 / sysext / lowlevel / Classes / View / DatabaseIntegrityView.php
1 <?php
2 namespace TYPO3\CMS\Lowlevel\View;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the text file GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 use TYPO3\CMS\Core\Utility\GeneralUtility;
31 use TYPO3\CMS\Backend\Utility\BackendUtility;
32
33 /**
34 * Script class for the DB int module
35 *
36 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
37 */
38 class DatabaseIntegrityView {
39
40 /**
41 * @todo Define visibility
42 */
43 public $MCONF = array();
44
45 /**
46 * @todo Define visibility
47 */
48 public $MOD_MENU = array();
49
50 /**
51 * @todo Define visibility
52 */
53 public $MOD_SETTINGS = array();
54
55 /**
56 * Document template object
57 *
58 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
59 * @todo Define visibility
60 */
61 public $doc;
62
63 /**
64 * @todo Define visibility
65 */
66 public $content;
67
68 /**
69 * @todo Define visibility
70 */
71 public $menu;
72
73 protected $formName = 'queryform';
74
75 /**
76 * Constructor
77 */
78 public function __construct() {
79 $GLOBALS['LANG']->includeLLFile('EXT:lowlevel/dbint/locallang.xlf');
80 $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], 1);
81 }
82
83 /**
84 * Initialization
85 *
86 * @return void
87 * @todo Define visibility
88 */
89 public function init() {
90 global $LANG, $BACK_PATH;
91 $this->MCONF = $GLOBALS['MCONF'];
92 $this->menuConfig();
93 $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
94 $this->doc->backPath = $BACK_PATH;
95 $this->doc->setModuleTemplate('EXT:lowlevel/Resources/Private/Templates/dbint.html');
96 $this->doc->form = '<form action="" method="post" name="' . $this->formName . '">';
97 // JavaScript
98 $this->doc->JScode = '
99 <script language="javascript" type="text/javascript">
100 script_ended = 0;
101 function jumpToUrl(URL) {
102 window.location.href = URL;
103 }
104 </script>
105 ';
106 $this->doc->table_TABLE = '<table class="t3-table">
107 <colgroup><col width="24"><col><col width="150"></colgroup>';
108 $this->doc->tableLayout = array(
109 '0' => array(
110 'tr' => array('<thead><tr>', '</tr></thead>'),
111 'defCol' => array('<th>', '</th>')
112 ),
113 'defRow' => array(
114 'defCol' => array('<td>', '</td>')
115 )
116 );
117 }
118
119 /**
120 * Configure menu
121 *
122 * @return void
123 * @todo Define visibility
124 */
125 public function menuConfig() {
126 global $LANG;
127 // MENU-ITEMS:
128 // If array, then it's a selector box menu
129 // If empty string it's just a variable, that'll be saved.
130 // Values NOT in this array will not be saved in the settings-array for the module.
131 $this->MOD_MENU = array(
132 'function' => array(
133 0 => $GLOBALS['LANG']->getLL('menu', TRUE),
134 'records' => $GLOBALS['LANG']->getLL('recordStatistics', TRUE),
135 'relations' => $GLOBALS['LANG']->getLL('databaseRelations', TRUE),
136 'search' => $GLOBALS['LANG']->getLL('fullSearch', TRUE),
137 'refindex' => $GLOBALS['LANG']->getLL('manageRefIndex', TRUE)
138 ),
139 'search' => array(
140 'raw' => $GLOBALS['LANG']->getLL('rawSearch', TRUE),
141 'query' => $GLOBALS['LANG']->getLL('advancedQuery', TRUE)
142 ),
143 'search_query_smallparts' => '',
144 'search_result_labels' => '',
145 'labels_noprefix' => '',
146 'options_sortlabel' => '',
147 'show_deleted' => '',
148 'queryConfig' => '',
149 // Current query
150 'queryTable' => '',
151 // Current table
152 'queryFields' => '',
153 // Current tableFields
154 'queryLimit' => '',
155 // Current limit
156 'queryOrder' => '',
157 // Current Order field
158 'queryOrderDesc' => '',
159 // Current Order field descending flag
160 'queryOrder2' => '',
161 // Current Order2 field
162 'queryOrder2Desc' => '',
163 // Current Order2 field descending flag
164 'queryGroup' => '',
165 // Current Group field
166 'storeArray' => '',
167 // Used to store the available Query config memory banks
168 'storeQueryConfigs' => '',
169 // Used to store the available Query configs in memory
170 'search_query_makeQuery' => array(
171 'all' => $GLOBALS['LANG']->getLL('selectRecords', TRUE),
172 'count' => $GLOBALS['LANG']->getLL('countResults', TRUE),
173 'explain' => $GLOBALS['LANG']->getLL('explainQuery', TRUE),
174 'csv' => $GLOBALS['LANG']->getLL('csvExport', TRUE)
175 ),
176 'sword' => ''
177 );
178 // CLEAN SETTINGS
179 $OLD_MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, '', $this->MCONF['name'], 'ses');
180 $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], 'ses');
181 if (GeneralUtility::_GP('queryConfig')) {
182 $qA = GeneralUtility::_GP('queryConfig');
183 $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, array('queryConfig' => serialize($qA)), $this->MCONF['name'], 'ses');
184 }
185 $addConditionCheck = GeneralUtility::_GP('qG_ins');
186 foreach ($OLD_MOD_SETTINGS as $key => $val) {
187 if (substr($key, 0, 5) == 'query' && $this->MOD_SETTINGS[$key] != $val && $key != 'queryLimit' && $key != 'use_listview') {
188 $setLimitToStart = 1;
189 if ($key == 'queryTable' && !$addConditionCheck) {
190 $this->MOD_SETTINGS['queryConfig'] = '';
191 }
192 }
193 if ($key == 'queryTable' && $this->MOD_SETTINGS[$key] != $val) {
194 $this->MOD_SETTINGS['queryFields'] = '';
195 }
196 }
197 if ($setLimitToStart) {
198 $currentLimit = explode(',', $this->MOD_SETTINGS['queryLimit']);
199 if ($currentLimit[1]) {
200 $this->MOD_SETTINGS['queryLimit'] = '0,' . $currentLimit[1];
201 } else {
202 $this->MOD_SETTINGS['queryLimit'] = '0';
203 }
204 $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, $this->MOD_SETTINGS, $this->MCONF['name'], 'ses');
205 }
206 }
207
208 /**
209 * Main
210 *
211 * @return void
212 * @todo Define visibility
213 */
214 public function main() {
215 // Content creation
216 if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopMenu']) {
217 $this->menu = BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
218 }
219 switch ($this->MOD_SETTINGS['function']) {
220 case 'search':
221 $this->func_search();
222 break;
223 case 'records':
224 $this->func_records();
225 break;
226 case 'relations':
227 $this->func_relations();
228 break;
229 case 'refindex':
230 $this->func_refindex();
231 break;
232 default:
233 $this->func_default();
234 }
235 // Setting up the buttons and markers for docheader
236 $docHeaderButtons = $this->getButtons();
237 $markers = array(
238 'CSH' => $docHeaderButtons['csh'],
239 'FUNC_MENU' => $this->getFuncMenu(),
240 'CONTENT' => $this->content
241 );
242 // Build the <body> for the module
243 $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
244 // Renders the module page
245 $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
246 }
247
248 /**
249 * Print content
250 *
251 * @return void
252 * @todo Define visibility
253 */
254 public function printContent() {
255 echo $this->content;
256 }
257
258 /**
259 * Create the panel of buttons for submitting the form or otherwise perform operations.
260 *
261 * @return array All available buttons as an assoc. array
262 */
263 protected function getButtons() {
264 $buttons = array(
265 'csh' => '',
266 'shortcut' => ''
267 );
268 // Shortcut
269 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
270 $buttons['shortcut'] = $this->doc->makeShortcutIcon('', 'function,search,search_query_makeQuery', $this->MCONF['name']);
271 }
272 return $buttons;
273 }
274
275 /**
276 * Create the function menu
277 *
278 * @return string HTML of the function menu
279 */
280 protected function getFuncMenu() {
281 if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopMenu']) {
282 $funcMenu = BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
283 }
284 return $funcMenu;
285 }
286
287 /**
288 * Creates the overview menu.
289 *
290 * @return void
291 */
292 protected function func_default() {
293 $availableModFuncs = array('records', 'relations', 'search', 'refindex');
294 $content = '<dl class="t3-overview-list">';
295 foreach ($availableModFuncs as $modFunc) {
296 $functionUrl = BackendUtility::getModuleUrl('system_dbint') . '&SET[function]=' . $modFunc;
297 $title = $GLOBALS['LANG']->getLL($modFunc);
298 $description = $GLOBALS['LANG']->getLL($modFunc . '_description');
299 $icon = '<img src="' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'MOD:system_dbint/db.gif', '', 1) . '" width="16" height="16" title="' . $title . '" alt="' . $title . '" />';
300 $content .= '
301 <dt><a href="' . htmlspecialchars($functionUrl) . '">' . $icon . $title . '</a></dt>
302 <dd>' . $description . '</dd>
303 ';
304 }
305 $content .= '</dl>';
306 $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
307 $this->content .= $this->doc->section('', $content, FALSE, TRUE);
308 }
309
310 /****************************
311 *
312 * Functionality implementation
313 *
314 ****************************/
315 /**
316 * Check and update reference index!
317 *
318 * @return void
319 * @todo Define visibility
320 */
321 public function func_refindex() {
322 $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('manageRefIndex', TRUE));
323 if (GeneralUtility::_GP('_update') || GeneralUtility::_GP('_check')) {
324 $testOnly = GeneralUtility::_GP('_check') ? TRUE : FALSE;
325 // Call the functionality
326 $refIndexObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\ReferenceIndex');
327 list($headerContent, $bodyContent) = $refIndexObj->updateIndex($testOnly);
328 // Output content:
329 $this->content .= $this->doc->section('', str_replace(LF, '<br/>', $bodyContent), FALSE, TRUE);
330 }
331
332 // Output content:
333 $content = '<p class="lead">' . $GLOBALS['LANG']->getLL('referenceIndex_description') . '</p>';
334 $content .= '<input type="submit" name="_check" value="' . $GLOBALS['LANG']->getLL('referenceIndex_buttonCheck') . '" /> <input type="submit" name="_update" value="' . $GLOBALS['LANG']->getLL('referenceIndex_buttonUpdate') . '" /><br /><br />';
335 $this->content .= $this->doc->section('', $content, FALSE, TRUE);
336
337 // Command Line Interface
338 $content = '';
339 $content .= '<p>' . $GLOBALS['LANG']->getLL('checkScript') . '</p>';
340
341 $content .= '<h3>' . $GLOBALS['LANG']->getLL('checkScript_check_description') . '</h3>';
342 $content .= '<p><code>php ' . PATH_typo3 . 'cli_dispatch.phpsh lowlevel_refindex -c</code></p>';
343
344 $content .= '<h3>' . $GLOBALS['LANG']->getLL('checkScript_update_description') . '</h3>';
345 $content .= '<p><code>php ' . PATH_typo3 . 'cli_dispatch.phpsh lowlevel_refindex -e</code></p>';
346 $content .= '<div class="typo3-message message-information"><div class="message-body">' . $GLOBALS['LANG']->getLL('checkScript_information') . '</div></div>';
347
348 $content .= '<p>' . $GLOBALS['LANG']->getLL('checkScript_moreDetails') . '<br />';
349 $content .= '<a href="' . $GLOBALS['BACK_PATH'] . 'sysext/lowlevel/HOWTO_clean_up_TYPO3_installations.txt" target="_new">' . PATH_typo3 . 'sysext/lowlevel/HOWTO_clean_up_TYPO3_installations.txt</a></p>';
350 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('checkScript_headline'), $content, FALSE, TRUE);
351 }
352
353 /**
354 * Search (Full / Advanced)
355 *
356 * @return void
357 * @todo Define visibility
358 */
359 public function func_search() {
360 global $LANG;
361 $fullsearch = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryView');
362 $fullsearch->setFormName($this->formName);
363 $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('search'));
364 $this->content .= $this->doc->spacer(5);
365 $menu2 = '';
366 if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopMenu']) {
367 $menu2 = BackendUtility::getFuncMenu(0, 'SET[search]', $this->MOD_SETTINGS['search'], $this->MOD_MENU['search']);
368 }
369 if ($this->MOD_SETTINGS['search'] == 'query' && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopMenu']) {
370 $menu2 .= BackendUtility::getFuncMenu(0, 'SET[search_query_makeQuery]', $this->MOD_SETTINGS['search_query_makeQuery'], $this->MOD_MENU['search_query_makeQuery']) . '<br />';
371 }
372 if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopCheckboxes'] && $this->MOD_SETTINGS['search'] == 'query') {
373 $menu2 .= BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[search_query_smallparts]', $this->MOD_SETTINGS['search_query_smallparts'], '', '', 'id="checkSearch_query_smallparts"') . '&nbsp;<label for="checkSearch_query_smallparts">' . $GLOBALS['LANG']->getLL('showSQL') . '</label><br />';
374 $menu2 .= BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[search_result_labels]', $this->MOD_SETTINGS['search_result_labels'], '', '', 'id="checkSearch_result_labels"') . '&nbsp;<label for="checkSearch_result_labels">' . $GLOBALS['LANG']->getLL('useFormattedStrings') . '</label><br />';
375 $menu2 .= BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[labels_noprefix]', $this->MOD_SETTINGS['labels_noprefix'], '', '', 'id="checkLabels_noprefix"') . '&nbsp;<label for="checkLabels_noprefix">' . $GLOBALS['LANG']->getLL('dontUseOrigValues') . '</label><br />';
376 $menu2 .= BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[options_sortlabel]', $this->MOD_SETTINGS['options_sortlabel'], '', '', 'id="checkOptions_sortlabel"') . '&nbsp;<label for="checkOptions_sortlabel">' . $GLOBALS['LANG']->getLL('sortOptions') . '</label><br />';
377 $menu2 .= BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[show_deleted]', $this->MOD_SETTINGS['show_deleted'], '', '', 'id="checkShow_deleted"') . '&nbsp;<label for="checkShow_deleted">' . $GLOBALS['LANG']->getLL('showDeleted') . '</label>';
378 }
379 $this->content .= $this->doc->section('', $menu2) . $this->doc->spacer(10);
380 switch ($this->MOD_SETTINGS['search']) {
381 case 'query':
382 $this->content .= $fullsearch->queryMaker();
383 break;
384 case 'raw':
385
386 default:
387 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('searchOptions'), $fullsearch->form(), FALSE, TRUE);
388 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('result'), $fullsearch->search(), FALSE, TRUE);
389 }
390 }
391
392 /**
393 * Records overview
394 *
395 * @return void
396 * @todo Define visibility
397 */
398 public function func_records() {
399 /** @var $admin \TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck */
400 $admin = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Integrity\\DatabaseIntegrityCheck');
401 $admin->genTree_makeHTML = 0;
402 $admin->backPath = $GLOBALS['BACK_PATH'];
403 $admin->genTree(0, '');
404 $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('records'));
405
406 // Pages stat
407 $codeArr = array();
408 $codeArr['tableheader'] = array('', '', $GLOBALS['LANG']->getLL('count'));
409 $i++;
410 $codeArr[$i][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', array());
411 $codeArr[$i][] = $GLOBALS['LANG']->getLL('total_pages');
412 $codeArr[$i][] = count($admin->page_idArray);
413 $i++;
414 if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
415 $codeArr[$i][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', array('hidden' => 1));
416 $codeArr[$i][] = $GLOBALS['LANG']->getLL('hidden_pages');
417 $codeArr[$i][] = $admin->recStats['hidden'];
418 $i++;
419 }
420 $codeArr[$i][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', array('deleted' => 1));
421 $codeArr[$i][] = $GLOBALS['LANG']->getLL('deleted_pages');
422 $codeArr[$i][] = count($admin->recStats['deleted']['pages']);
423 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('pages'), $this->doc->table($codeArr), TRUE, TRUE);
424
425 // Doktype
426 $codeArr = array();
427 $codeArr['tableheader'] = array('', $GLOBALS['LANG']->getLL('doktype_value'), $GLOBALS['LANG']->getLL('count'));
428 $doktype = $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'];
429 if (is_array($doktype)) {
430 foreach ($doktype as $n => $setup) {
431 if ($setup[1] != '--div--') {
432 $codeArr[$n][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', array('doktype' => $setup[1]));
433 $codeArr[$n][] = $GLOBALS['LANG']->sL($setup[0]) . ' (' . $setup[1] . ')';
434 $codeArr[$n][] = (int)$admin->recStats['doktype'][$setup[1]];
435 }
436 }
437 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('doktype'), $this->doc->table($codeArr), TRUE, TRUE);
438 }
439
440 // Tables and lost records
441 $id_list = '-1,0,' . implode(',', array_keys($admin->page_idArray));
442 $id_list = rtrim($id_list, ',');
443 $admin->lostRecords($id_list);
444 if ($admin->fixLostRecord(GeneralUtility::_GET('fixLostRecords_table'), GeneralUtility::_GET('fixLostRecords_uid'))) {
445 $admin = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Integrity\\DatabaseIntegrityCheck');
446 $admin->backPath = $BACK_PATH;
447 $admin->genTree(0, '');
448 $id_list = '-1,0,' . implode(',', array_keys($admin->page_idArray));
449 $id_list = rtrim($id_list, ',');
450 $admin->lostRecords($id_list);
451 }
452 $codeArr = array();
453 $codeArr['tableheader'] = array(
454 '',
455 $GLOBALS['LANG']->getLL('label'),
456 $GLOBALS['LANG']->getLL('tablename'),
457 $GLOBALS['LANG']->getLL('total_lost'),
458 ''
459 );
460 $countArr = $admin->countRecords($id_list);
461 if (is_array($GLOBALS['TCA'])) {
462 foreach ($GLOBALS['TCA'] as $t => $value) {
463 if ($GLOBALS['TCA'][$t]['ctrl']['hideTable']) {
464 continue;
465 }
466 $codeArr[$t][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($t, array());
467 $codeArr[$t][] = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$t]['ctrl']['title']);
468 $codeArr[$t][] = $t;
469 if ($t === 'pages' && $admin->lostPagesList !== '') {
470 $lostRecordCount = count(explode(',', $admin->lostPagesList));
471 } else {
472 $lostRecordCount = count($admin->lRecords[$t]);
473 }
474 if ($countArr['all'][$t]) {
475 $theNumberOfRe = (int)$countArr['non_deleted'][$t] . '/' . $lostRecordCount;
476 } else {
477 $theNumberOfRe = '';
478 }
479 $codeArr[$t][] = $theNumberOfRe;
480 $lr = '';
481 if (is_array($admin->lRecords[$t])) {
482 foreach ($admin->lRecords[$t] as $data) {
483 if (!GeneralUtility::inList($admin->lostPagesList, $data[pid])) {
484 $lr .= '<nobr><strong><a href="' . htmlspecialchars((BackendUtility::getModuleUrl('system_dbint') . '&SET[function]=records&fixLostRecords_table=' . $t . '&fixLostRecords_uid=' . $data['uid'])) . '"><img src="' . $BACK_PATH . 'gfx/required_h.gif" width="10" hspace="3" height="10" border="0" align="top" title="' . $GLOBALS['LANG']->getLL('fixLostRecord') . '"></a>uid:' . $data['uid'] . ', pid:' . $data['pid'] . ', ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(strip_tags($data['title']), 20)) . '</strong></nobr><br>';
485 } else {
486 $lr .= '<nobr><img src="' . $BACK_PATH . 'clear.gif" width="16" height="1" border="0"><font color="Gray">uid:' . $data['uid'] . ', pid:' . $data['pid'] . ', ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(strip_tags($data['title']), 20)) . '</font></nobr><br>';
487 }
488 }
489 }
490 $codeArr[$t][] = $lr;
491 }
492 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('tables'), $this->doc->table($codeArr), FALSE, TRUE);
493 }
494 }
495
496 /**
497 * Show list references
498 *
499 * @return void
500 * @todo Define visibility
501 */
502 public function func_relations() {
503 global $LANG, $BACK_PATH;
504 $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('relations'));
505 $admin = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Integrity\\DatabaseIntegrityCheck');
506 $admin->genTree_makeHTML = 0;
507 $admin->backPath = $BACK_PATH;
508 $fkey_arrays = $admin->getGroupFields('');
509 $admin->selectNonEmptyRecordsWithFkeys($fkey_arrays);
510 $fileTest = $admin->testFileRefs();
511
512 $code = '';
513 if (is_array($fileTest['noReferences'])) {
514 foreach ($fileTest['noReferences'] as $val) {
515 $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong></nobr><br>';
516 }
517 } else {
518 $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>';
519 }
520 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_ref'), $code, TRUE, TRUE);
521
522 $code = '';
523 if (is_array($fileTest['moreReferences'])) {
524 foreach ($fileTest['moreReferences'] as $val) {
525 $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong>: ' . $val[2] . ' ' . $GLOBALS['LANG']->getLL('references') . '</nobr><br>' . $val[3] . '<br><br>';
526 }
527 } else {
528 $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>';
529 }
530 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_many_ref'), $code, TRUE, TRUE);
531
532 $code = '';
533 if (is_array($fileTest['noFile'])) {
534 ksort($fileTest['noFile']);
535 foreach ($fileTest['noFile'] as $val) {
536 $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong> ' . $GLOBALS['LANG']->getLL('isMissing') . ' </nobr><br>' . $GLOBALS['LANG']->getLL('referencedFrom') . $val[2] . '<br><br>';
537 }
538 } else {
539 $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>';
540 }
541
542 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_file'), $code, TRUE, TRUE);
543 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('select_db'), $admin->testDBRefs($admin->checkSelectDBRefs), TRUE, TRUE);
544 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('group_db'), $admin->testDBRefs($admin->checkGroupDBRefs), TRUE, TRUE);
545 }
546
547 /**
548 * Searching for files with a specific pattern
549 *
550 * @deprecated since 6.2 will be removed two versions later
551 * @return void
552 */
553 public function func_filesearch() {
554 \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
555 }
556
557 /**
558 * Searching for filename pattern recursively in the specified dir.
559 *
560 * @param string $basedir Base directory
561 * @param string $pattern Match pattern
562 * @param array $matching_files Array of matching files, passed by reference
563 * @param integer $depth Depth to recurse
564 * @deprecated since 6.2 will be removed two versions later
565 * @return array Array with various information about the search result
566 */
567 public function findFile($basedir, $pattern, &$matching_files, $depth) {
568 \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
569 }
570
571 }