00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00049 require_once(PATH_t3lib.'class.t3lib_extobjbase.php');
00050 require_once(t3lib_extMgm::extPath('lowlevel').'class.tx_lowlevel_cleaner_core.php');
00051
00052
00053
00054
00055
00056
00057
00065 class tx_lowlevel_cleaner extends t3lib_extobjbase {
00066
00067
00074 function modMenu() {
00075 global $LANG;
00076
00077 $modMenuAdd = array(
00078 'tx_lowlevel_cleaner' => array(
00079 # 'delete_flush' => 'Flush "deleted" records',
00080 # 'delete_restore' => 'Restore "deleted" records',
00081 # 'versions_flush' => 'Flush published versions',
00082
00083 # 'clean_flexform_xml' => 'Clean up FlexForm XML',
00084 # tt_content element removal: templavoila plugin!
00085 # Check for various: uid>0, pid>-1 , lost swapping operations,
00086 # 'l10n_duplicates' => 'Localization errors',
00087 # Find TCA/FlexForm fields which should probably have a soft reference parser attached!
00088
00089 # TemplaVoila plugs in to display mapping issues.
00090 # Overview of http:
00091
00092 'missing_files' => 'Missing files',
00093 'missing_relations' => 'Missing relations',
00094 # 'lost_records' => 'Orphan records',
00095 'lost_files' => 'Orphan files (from uploads/)',
00096 'RTEmagic_files' => 'RTE Magic Images',
00097 'double_files' => 'Double file references',
00098 )
00099 );
00100
00101 return $modMenuAdd;
00102 }
00103
00109 function main() {
00110 global $BE_USER;
00111
00112 $content = '';
00113
00114 if ($BE_USER->isAdmin()) {
00115 $content.= $this->pObj->doc->spacer(5);
00116 $content.= $this->createMenu().'<hr/>';
00117 $content.= $this->moduleContent();
00118 } else {
00119 $content.= $this->pObj->doc->spacer(5);
00120 $content.= 'Only access for admin users, sorry.';
00121 }
00122 return $content;
00123 }
00124
00130 function createMenu() {
00131 if (is_array($this->pObj->MOD_MENU['tx_lowlevel_cleaner'])) {
00132 $menu = '';
00133 foreach($this->pObj->MOD_MENU['tx_lowlevel_cleaner'] as $key => $value) {
00134 $menu.='<a href="index.php?id='.intval(t3lib_div::_GP('id')).'&tx_lowlevel_cleaner='.$key.'">'.htmlspecialchars($value).'</a><br/>';
00135 }
00136 return $menu;
00137 }
00138 }
00139
00145 function moduleContent() {
00146 $cleanerObj = t3lib_div::makeInstance('tx_lowlevel_cleaner_core');
00147 $silent = FALSE;
00148 $filter = 0;
00149
00150 switch(t3lib_div::_GP('tx_lowlevel_cleaner')) {
00151 case 'lost_files':
00152 $res = $cleanerObj->clean_lost_files_analyze();
00153 $output = $cleanerObj->html_printInfo('clean_lost_files_analyze()',$res,$silent,$filter);
00154 break;
00155 case 'RTEmagic_files':
00156 $res = $cleanerObj->RTEmagic_files_analyze();
00157 $output = $cleanerObj->html_printInfo('RTEmagic_files_analyze()',$res,$silent,$filter);
00158 break;
00159 case 'double_files':
00160 $res = $cleanerObj->double_files_analyze();
00161 $output = $cleanerObj->html_printInfo('double_files_analyze()',$res,$silent,$filter);
00162 break;
00163 case 'missing_files':
00164 $res = $cleanerObj->missing_files_analyze();
00165 $output = $cleanerObj->html_printInfo('missing_files_analyze()',$res,$silent,$filter);
00166 break;
00167 case 'missing_relations':
00168 $res = $cleanerObj->missing_relations_analyze();
00169 $output = $cleanerObj->html_printInfo('missing_relations_analyze()',$res,$silent,$filter);
00170 break;
00171 }
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 return $output;
00182 }
00183 }
00184
00185 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/class.tx_lowlevel_cleaner.php']) {
00186 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/class.tx_lowlevel_cleaner.php']);
00187 }
00188 ?>