2 namespace TYPO3\CMS\Lowlevel\View;
56 protected $templatePath =
'EXT:lowlevel/Resources/Private/Templates/Backend/';
75 $this->
getLanguageService()->includeLLFile(
'EXT:lowlevel/Resources/Private/Language/locallang.xlf');
78 $this->view->getRequest()->setControllerExtensionName(
'lowlevel');
91 $this->moduleTemplate->addJavaScriptCode(
94 function jumpToUrl(URL) {
95 window.location.href = URL;
114 $this->MOD_MENU = array(
116 0 =>
$lang->getLL(
'menuTitle',
true),
117 'records' =>
$lang->getLL(
'recordStatistics',
true),
118 'relations' =>
$lang->getLL(
'databaseRelations',
true),
119 'search' =>
$lang->getLL(
'fullSearch',
true),
120 'refindex' =>
$lang->getLL(
'manageRefIndex',
true)
123 'raw' =>
$lang->getLL(
'rawSearch',
true),
124 'query' =>
$lang->getLL(
'advancedQuery',
true)
126 'search_query_smallparts' =>
'',
127 'search_result_labels' =>
'',
128 'labels_noprefix' =>
'',
129 'options_sortlabel' =>
'',
130 'show_deleted' =>
'',
141 'queryOrderDesc' =>
'',
145 'queryOrder2Desc' =>
'',
151 'storeQueryConfigs' =>
'',
153 'search_query_makeQuery' => array(
154 'all' =>
$lang->getLL(
'selectRecords',
true),
155 'count' =>
$lang->getLL(
'countResults',
true),
156 'explain' =>
$lang->getLL(
'explainQuery',
true),
157 'csv' =>
$lang->getLL(
'csvExport',
true)
169 $setLimitToStart =
false;
170 foreach ($OLD_MOD_SETTINGS as $key => $val) {
171 if (substr($key, 0, 5) ==
'query' && $this->MOD_SETTINGS[$key] != $val && $key !=
'queryLimit' && $key !=
'use_listview') {
172 $setLimitToStart =
true;
173 if ($key ==
'queryTable' && !$addConditionCheck) {
174 $this->MOD_SETTINGS[
'queryConfig'] =
'';
177 if ($key ==
'queryTable' && $this->MOD_SETTINGS[$key] != $val) {
178 $this->MOD_SETTINGS[
'queryFields'] =
'';
181 if ($setLimitToStart) {
182 $currentLimit = explode(
',', $this->MOD_SETTINGS[
'queryLimit']);
183 if ($currentLimit[1]) {
184 $this->MOD_SETTINGS[
'queryLimit'] =
'0,' . $currentLimit[1];
186 $this->MOD_SETTINGS[
'queryLimit'] =
'0';
199 switch ($this->MOD_SETTINGS[
'function']) {
201 $templateFilename =
'CustomSearch.html';
205 $templateFilename =
'RecordStatistics.html';
206 $this->func_records();
209 $templateFilename =
'Relations.html';
213 $templateFilename =
'ReferenceIndex.html';
217 $templateFilename =
'IntegrityOverview.html';
221 $this->content =
'<form action="" method="post" id="DatabaseIntegrityView" name="' . $this->formName .
'">';
222 $this->content .= $this->view->render();
223 $this->content .=
'</form>';
226 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
228 $shortCutButton = $buttonBar->makeShortcutButton()
229 ->setModuleName($this->moduleName)
230 ->setDisplayName($this->MOD_MENU[
'function'][$this->MOD_SETTINGS[
'function']])
231 ->setSetVariables([
'function',
'search',
'search_query_makeQuery']);
263 $this->moduleTemplate->setContent($this->content);
264 $response->
getBody()->write($this->moduleTemplate->renderContent());
273 $menu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
274 $menu->setIdentifier(
'DatabaseJumpMenu');
276 foreach ($this->MOD_MENU[
'function'] as $controller => $title) {
280 BackendUtility::getModuleUrl(
285 'function' => $controller
291 if ($controller === $this->MOD_SETTINGS[
'function']) {
292 $item->setActive(
true);
294 $menu->addMenuItem($item);
296 $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
307 $availableModFuncs = array(
'records',
'relations',
'search',
'refindex');
308 foreach ($availableModFuncs as $modFunc) {
309 $modules[$modFunc] = BackendUtility::getModuleUrl(
'system_dbint') .
'&SET[function]=' . $modFunc;
311 $this->view->assign(
'availableFunctions', $modules);
326 $this->view->assign(
'PATH_typo3', PATH_typo3);
332 list(, $bodyContent) = $refIndexObj->updateIndex($testOnly);
333 $this->view->assign(
'content', str_replace(
'##LF##',
'<br />', $bodyContent));
345 $searchMode = $this->MOD_SETTINGS[
'search'];
347 $fullsearch->setFormName($this->formName);
348 $submenu =
'<div class="form-inline form-inline-spaced">';
350 if ($this->MOD_SETTINGS[
'search'] ==
'query') {
351 $submenu .=
BackendUtility::getDropdownMenu(0,
'SET[search_query_makeQuery]', $this->MOD_SETTINGS[
'search_query_makeQuery'], $this->MOD_MENU[
'search_query_makeQuery']) .
'<br />';
353 $submenu .=
'</div>';
354 if ($this->MOD_SETTINGS[
'search'] ==
'query') {
355 $submenu .=
'<div class="checkbox"><label for="checkSearch_query_smallparts">' .
BackendUtility::getFuncCheck(
$GLOBALS[
'SOBE']->
id,
'SET[search_query_smallparts]', $this->MOD_SETTINGS[
'search_query_smallparts'],
'',
'',
'id="checkSearch_query_smallparts"') .
$lang->getLL(
'showSQL') .
'</label></div>';
356 $submenu .=
'<div class="checkbox"><label for="checkSearch_result_labels">' .
BackendUtility::getFuncCheck(
$GLOBALS[
'SOBE']->
id,
'SET[search_result_labels]', $this->MOD_SETTINGS[
'search_result_labels'],
'',
'',
'id="checkSearch_result_labels"') .
$lang->getLL(
'useFormattedStrings') .
'</label></div>';
357 $submenu .=
'<div class="checkbox"><label for="checkLabels_noprefix">' .
BackendUtility::getFuncCheck(
$GLOBALS[
'SOBE']->
id,
'SET[labels_noprefix]', $this->MOD_SETTINGS[
'labels_noprefix'],
'',
'',
'id="checkLabels_noprefix"') .
$lang->getLL(
'dontUseOrigValues') .
'</label></div>';
358 $submenu .=
'<div class="checkbox"><label for="checkOptions_sortlabel">' .
BackendUtility::getFuncCheck(
$GLOBALS[
'SOBE']->
id,
'SET[options_sortlabel]', $this->MOD_SETTINGS[
'options_sortlabel'],
'',
'',
'id="checkOptions_sortlabel"') .
$lang->getLL(
'sortOptions') .
'</label></div>';
359 $submenu .=
'<div class="checkbox"><label for="checkShow_deleted">' .
BackendUtility::getFuncCheck(
$GLOBALS[
'SOBE']->
id,
'SET[show_deleted]', $this->MOD_SETTINGS[
'show_deleted'],
'',
'',
'id="checkShow_deleted"') .
$lang->getLL(
'showDeleted') .
'</label></div>';
361 $this->view->assign(
'submenu', $submenu);
362 $this->view->assign(
'searchMode', $searchMode);
363 switch ($searchMode) {
365 $this->
getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Core/QueryGenerator');
366 $this->view->assign(
'queryMaker', $fullsearch->queryMaker());
370 $this->view->assign(
'searchOptions', $fullsearch->form());
371 $this->view->assign(
'results', $fullsearch->search());
380 public function func_records()
387 $pageStatistic = array(
388 'total_pages' => array(
389 'icon' => $this->iconFactory->getIconForRecord(
'pages', array(),
Icon::SIZE_SMALL)->render(),
390 'count' => count($admin->page_idArray)
392 'hidden_pages' => array(
393 'icon' => $this->iconFactory->getIconForRecord(
'pages', array(
'hidden' => 1),
Icon::SIZE_SMALL)->render(),
394 'count' => $admin->recStats[
'hidden']
396 'deleted_pages' => array(
397 'icon' => $this->iconFactory->getIconForRecord(
'pages', array(
'deleted' => 1),
Icon::SIZE_SMALL)->render(),
398 'count' => count($admin->recStats[
'deleted'][
'pages'])
406 $doktype =
$GLOBALS[
'TCA'][
'pages'][
'columns'][
'doktype'][
'config'][
'items'];
407 if (is_array($doktype)) {
408 foreach ($doktype as $setup) {
409 if ($setup[1] !=
'--div--') {
411 'icon' => $this->iconFactory->getIconForRecord(
'pages', array(
'doktype' => $setup[1]),
Icon::SIZE_SMALL)->render(),
412 'title' =>
$lang->sL($setup[0]) .
' (' . $setup[1] .
')',
413 'count' => (int)$admin->recStats[
'doktype'][$setup[1]]
420 $id_list =
'-1,0,' . implode(
',', array_keys($admin->page_idArray));
421 $id_list = rtrim($id_list,
',');
422 $admin->lostRecords($id_list);
426 $id_list =
'-1,0,' . implode(
',', array_keys($admin->page_idArray));
427 $id_list = rtrim($id_list,
',');
428 $admin->lostRecords($id_list);
430 $tableStatistic = array();
431 $countArr = $admin->countRecords($id_list);
433 foreach (
$GLOBALS[
'TCA'] as $t => $value) {
434 if (
$GLOBALS[
'TCA'][$t][
'ctrl'][
'hideTable']) {
437 if ($t ===
'pages' && $admin->lostPagesList !==
'') {
438 $lostRecordCount = count(explode(
',', $admin->lostPagesList));
440 $lostRecordCount = count($admin->lRecords[$t]);
442 if ($countArr[
'all'][$t]) {
443 $theNumberOfRe = (int)$countArr[
'non_deleted'][$t] .
'/' . $lostRecordCount;
448 if (is_array($admin->lRecords[$t])) {
449 foreach ($admin->lRecords[$t] as $data) {
451 $lr .=
'<div class="record"><a href="' . htmlspecialchars((BackendUtility::getModuleUrl(
'system_dbint') .
'&SET[function]=records&fixLostRecords_table=' . $t .
'&fixLostRecords_uid=' . $data[
'uid'])) .
'" title="' .
$lang->getLL(
'fixLostRecord',
true) .
'">' . $this->iconFactory->getIcon(
'status-dialog-error',
Icon::SIZE_SMALL)->render() .
'</a>uid:' . $data[
'uid'] .
', pid:' . $data[
'pid'] .
', ' . htmlspecialchars(
GeneralUtility::fixed_lgd_cs(strip_tags($data[
'title']), 20)) .
'</div>';
453 $lr .=
'<div class="record-noicon">uid:' . $data[
'uid'] .
', pid:' . $data[
'pid'] .
', ' . htmlspecialchars(
GeneralUtility::fixed_lgd_cs(strip_tags($data[
'title']), 20)) .
'</div>';
457 $tableStatistic[$t] = array(
458 'icon' => $this->iconFactory->getIconForRecord($t, array(),
Icon::SIZE_SMALL)->render(),
460 'count' => $theNumberOfRe,
466 $this->view->assignMultiple(array(
467 'pages' => $pageStatistic,
468 'doktypes' => $doktypes,
469 'tables' => $tableStatistic
481 $fkey_arrays = $admin->getGroupFields(
'');
482 $admin->selectNonEmptyRecordsWithFkeys($fkey_arrays);
483 $fileTest = $admin->testFileRefs();
485 if (is_array($fileTest[
'noFile'])) {
486 ksort($fileTest[
'noFile']);
488 $this->view->assignMultiple(array(
489 'files' => $fileTest,
490 'select_db' => $admin->testDBRefs($admin->checkSelectDBRefs),
491 'group_db' => $admin->testDBRefs($admin->checkGroupDBRefs)