Documentation TYPO3 par Ameos

class.tx_lowlevel_cleaner.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00049 require_once(PATH_t3lib.'class.t3lib_extobjbase.php');
00050 require_once(t3lib_extMgm::extPath('lowlevel').'class.tx_lowlevel_cleaner_core.php');
00051 require_once (PATH_t3lib.'class.t3lib_refindex.php');
00052 
00053 die('Not developed...');
00054 
00055 
00056 
00057 
00058 
00066 class tx_lowlevel_cleaner extends t3lib_extobjbase {
00067 
00068 
00075         function modMenu()      {
00076                 global $LANG;
00077 
00078                 $modMenuAdd = array(
00079                         'tx_lowlevel_cleaner' => array(
00080 #                               'delete_flush' => 'Flush "deleted" records',            // ID/depth related
00081 #                               'delete_restore' => 'Restore "deleted" records',        // ID/depth related
00082 #                               'versions_flush' => 'Flush published versions', // ID/depth related
00083 
00084 #                               'clean_flexform_xml' => 'Clean up FlexForm XML',        // ID/depth related
00085                         # tt_content element removal: templavoila plugin!               // ID/depth related
00086                         # Check for various: uid>0, pid>-1      , lost swapping operations,
00087 #                               'l10n_duplicates' => 'Localization errors',
00088 # Find TCA/FlexForm fields which should probably have a soft reference parser attached!
00089 
00090                         # TemplaVoila plugs in to display mapping issues.
00091                         # Overview of http://  and emails                                               // UPDATE index!
00092 
00093                                 'missing_files' => 'Missing files',                             // UPDATE index!
00094                                 'missing_relations' => 'Missing relations',             // UPDATE index!
00095 #                               'lost_records' => 'Orphan records',
00096                                 'lost_files' => 'Orphan files (from uploads/)', // UPDATE index!
00097                                 'RTEmagic_files' => 'RTE Magic Images',                 // UPDATE index!
00098                                 'double_files' => 'Double file references',             // UPDATE index!
00099                         )
00100                 );
00101 
00102                 return $modMenuAdd;
00103         }
00104 
00110         function main() {
00111                 global $BE_USER;
00112 
00113                 $content = '';
00114 
00115                 if ($BE_USER->isAdmin())        {
00116                         $content.= $this->pObj->doc->spacer(5);
00117                         $content.= $this->createMenu().'<hr/>';
00118                         $content.= $this->moduleContent();
00119                         $content.= $this->quickDBlookUp();
00120                 } else {
00121                         $content.= $this->pObj->doc->spacer(5);
00122                         $content.= 'Only access for admin users, sorry.';
00123                 }
00124                 return $content;
00125         }
00126 
00132         function createMenu()   {
00133                 if (is_array($this->pObj->MOD_MENU['tx_lowlevel_cleaner']))     {
00134                         $menu = '';
00135                         foreach($this->pObj->MOD_MENU['tx_lowlevel_cleaner'] as $key => $value) {
00136                                 $menu.='<a href="index.php?id='.intval(t3lib_div::_GP('id')).'&tx_lowlevel_cleaner='.$key.'">'.htmlspecialchars($value).'</a><br/>';
00137                         }
00138                         return $menu;
00139                 }
00140         }
00141 
00147         function moduleContent()        {
00148                 $cleanerObj = t3lib_div::makeInstance('tx_lowlevel_cleaner_core');
00149                 $silent = FALSE;
00150                 $filter = 0;
00151 
00152                 switch(t3lib_div::_GP('tx_lowlevel_cleaner'))   {
00153                         case 'lost_files':
00154                                 $res = $cleanerObj->clean_lost_files_analyze();
00155                                 $output = $cleanerObj->html_printInfo('clean_lost_files_analyze()',$res,$silent,$filter);
00156                         break;
00157                         case 'RTEmagic_files':
00158                                 $res = $cleanerObj->RTEmagic_files_analyze();
00159                                 $output = $cleanerObj->html_printInfo('RTEmagic_files_analyze()',$res,$silent,$filter);
00160                         break;
00161                         case 'double_files':
00162                                 $res = $cleanerObj->double_files_analyze();
00163                                 $output = $cleanerObj->html_printInfo('double_files_analyze()',$res,$silent,$filter);
00164                         break;
00165                         case 'missing_files':
00166                                 $res = $cleanerObj->missing_files_analyze();
00167                                 $output = $cleanerObj->html_printInfo('missing_files_analyze()',$res,$silent,$filter);
00168                         break;
00169                         case 'missing_relations':
00170                                 $res = $cleanerObj->missing_relations_analyze();
00171                                 $output = $cleanerObj->html_printInfo('missing_relations_analyze()',$res,$silent,$filter);
00172                         break;
00173                 }
00174 
00175 /*
00176 // TEST of how we can get the used Content Elements on a TemplaVoila page:
00177 require_once(t3lib_extMgm::extPath('templavoila').'class.tx_templavoila_api.php');
00178 $apiClassName = t3lib_div::makeInstanceClassName('tx_templavoila_api');
00179 $apiObj = new $apiClassName('pages');
00180 $contentTreeData = $apiObj->getContentTree('pages', t3lib_BEfunc::getRecordWSOL('pages',33),FALSE);
00181 debug($contentTreeData);
00182 */
00183                 return $output;
00184         }
00185         
00186         function quickDBlookUp()        {
00187                 $output = 'Enter [table]:[uid]:[fieldlist (optional)] <input name="table_uid" value="'.htmlspecialchars(t3lib_div::_POST('table_uid')).'" />';
00188                 $output.='<input type="submit" name="_" value="REFRESH" /><br/>';
00189                 
00190                         // Show record:
00191                 if (t3lib_div::_POST('table_uid'))      {
00192                         list($table,$uid,$fieldName) = t3lib_div::trimExplode(':',t3lib_div::_POST('table_uid'),1);
00193                         if ($GLOBALS['TCA'][$table])    {
00194                                 $rec = t3lib_BEfunc::getRecordRaw($table,'uid='.intval($uid),$fieldName?$fieldName:'*');
00195 
00196                                 if (count($rec))        {
00197                                         if (t3lib_div::_POST('_EDIT'))  {
00198                                                 $output.='<hr/>Edit:<br/><br/>';
00199                                                 foreach($rec as $field => $value)       {
00200                                                         $output.= htmlspecialchars($field).'<br/><input name="record['.$table.']['.$uid.']['.$field.']" value="'.htmlspecialchars($value).'" /><br/>';
00201                                                 }
00202                                                 $output.='<input type="submit" name="_SAVE" value="SAVE" />';
00203                                         } elseif (t3lib_div::_POST('_SAVE'))    {
00204                                                 $incomingData = t3lib_div::_POST('record');
00205                                                 $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table,'uid='.intval($uid),$incomingData[$table][$uid]);
00206                                                 $output.='<br/>Updated '.$table.':'.$uid.'...';
00207                                                 $this->updateRefIndex($table,$uid);
00208                                         } else if (t3lib_div::_POST('_DELETE')) {
00209                                                 $GLOBALS['TYPO3_DB']->exec_DELETEquery($table,'uid='.intval($uid));
00210                                                 $output.='<br/>Deleted '.$table.':'.$uid.'...';
00211                                                 $this->updateRefIndex($table,$uid);
00212                                         } else {
00213                                                 $output.='<input type="submit" name="_EDIT" value="EDIT" />';
00214                                                 $output.='<input type="submit" name="_DELETE" value="DELETE" onclick="return confirm(\'Are you sure you wish to delete?\');" />';
00215                                                 $output.=t3lib_div::view_array($rec);
00216                                                 $output.=md5(implode($rec));
00217                                         }
00218                                 } else {
00219                                         $output.='No record existed!';
00220                                 }
00221                         }
00222                 }
00223                                 
00224                 return $output;
00225         }
00226 
00227 
00235         function updateRefIndex($table,$id)     {
00236                 $refIndexObj = t3lib_div::makeInstance('t3lib_refindex');
00237                 $result = $refIndexObj->updateRefIndexTable($table,$id);
00238         }
00239 }
00240 
00241 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/class.tx_lowlevel_cleaner.php'])      {
00242         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/class.tx_lowlevel_cleaner.php']);
00243 }
00244 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6