See changelog.
authorKasper Skårhøj <kasper@typo3.org>
Fri, 1 Dec 2006 14:55:42 +0000 (14:55 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Fri, 1 Dec 2006 14:55:42 +0000 (14:55 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1839 709f56b5-9817-0410-a4d7-c38de5d9e867

18 files changed:
ChangeLog
t3lib/class.t3lib_flexformtools.php
t3lib/class.t3lib_tcemain.php
t3lib/class.t3lib_transl8tools.php
t3lib/config_default.php
typo3/sysext/cms/tbl_cms.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/web_info/class.tx_cms_webinfo_lang.php
typo3/sysext/lowlevel/clmods/clmods/class.cleanflexform.php [deleted file]
typo3/sysext/lowlevel/clmods/clmods/class.deleted.php [deleted file]
typo3/sysext/lowlevel/clmods/clmods/class.double_files.php [deleted file]
typo3/sysext/lowlevel/clmods/clmods/class.lost_files.php [deleted file]
typo3/sysext/lowlevel/clmods/clmods/class.missing_files.php [deleted file]
typo3/sysext/lowlevel/clmods/clmods/class.missing_relations.php [deleted file]
typo3/sysext/lowlevel/clmods/clmods/class.orphan_records.php [deleted file]
typo3/sysext/lowlevel/clmods/clmods/class.rte_images.php [deleted file]
typo3/sysext/lowlevel/clmods/clmods/class.versions.php [deleted file]

index 208f516..6d8d3b8 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-12-01     Kasper Skårhøj  <kasper2006@typo3.com>
+
+       * Additionsl to FlexFormTools
+       * Improved localization in tcemain
+       * Changed pages_languages_overlay to NOT be hidden by default
+       * Introduced REDIRECT: prefix to pagenot found handling (for backwards compatibility since someone changed to read the file instead of redirecting).
+       * Added "linkHandler" hook for typolink. TSref is updated.
+       * Modified Web >Info > Localization tools to not show details. 
+       * Removed redundant directory, clmods.
+
 2006-11-28     Kasper Skårhøj  <kasper2006@typo3.com>
 
        * Added "option.additionalPreviewLanguages" which enables to add other languages than the "default" to the list of those that a translator will see along with his own language
index e0b9e0c..b64c197 100644 (file)
@@ -72,6 +72,9 @@ class t3lib_flexformtools {
 
        var $convertCharset = FALSE;            // If set, the charset of data XML is converted to system charset.
        var $reNumberIndexesOfSectionData = FALSE;      // If set, section indexes are re-numbered before processing
+       
+       var $traverseFlexFormXMLData_DS = array();      // Contains data structure when traversing flexform
+       var $traverseFlexFormXMLData_Data = array();    // Contains data array when traversing flexform
 
                // Options for array2xml() for flexform. This will map the weird keys from the internal array to tags that could potentially be checked with a DTD/schema
        var $flexArray2Xml_options = array(
@@ -182,6 +185,9 @@ class t3lib_flexformtools {
                                                $PA['field'] = $field;
                                                $PA['uid'] = $row['uid'];
 
+                                               $this->traverseFlexFormXMLData_DS = &$dataStruct;
+                                               $this->traverseFlexFormXMLData_Data = &$editData;
+
                                                        // Render flexform:
                                                $this->traverseFlexFormXMLData_recurse(
                                                        $dataStruct['ROOT']['el'],
index 123fd09..79c9cba 100755 (executable)
@@ -924,6 +924,8 @@ class t3lib_TCEmain {
                        }
                } else {
                        $currentRecord = $checkValueRecord = $this->recordInfo($table,$id,'*'); // We must use the current values as basis for this!
+                       
+                       t3lib_BEfunc::fixVersioningPid($table,$currentRecord);  // This is done to make the pid positive for offline versions; Necessary to have diff-view for pages_language_overlay in workspaces.
 
                                // Get original language record if available:
                        if (is_array($currentRecord)
@@ -3138,7 +3140,7 @@ class t3lib_TCEmain       {
 
        /**
         * Localizes a record to another system language
-        * In reality it only works if transOrigPointerTable is not set. And it doesn't work for "pages" table either.
+        * In reality it only works if transOrigPointerTable is not set. For "pages" the implementation is hardcoded
         *
         * @param       string          Table name
         * @param       integer         Record uid (to be localized)
@@ -3153,26 +3155,35 @@ class t3lib_TCEmain     {
                if ($TCA[$table] && $uid)       {
                        t3lib_div::loadTCA($table);
 
-                       if ($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'])   {
+                       if (($TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable']) || $table==='pages')     {
                                if ($langRec = t3lib_BEfunc::getRecord('sys_language',intval($language),'uid,title'))   {
                                        if ($this->doesRecordExist($table,$uid,'show')) {
 
                                                $row = t3lib_BEfunc::getRecordWSOL($table,$uid);        // Getting workspace overlay if possible - this will localize versions in workspace if any
                                                if (is_array($row))     {
-                                                       if ($row[$TCA[$table]['ctrl']['languageField']] <= 0)   {
-                                                               if ($row[$TCA[$table]['ctrl']['transOrigPointerField']] == 0)   {
-                                                                       if (!t3lib_BEfunc::getRecordsByField($table,$TCA[$table]['ctrl']['transOrigPointerField'],$uid,'AND pid='.intval($row['pid']).' AND '.$TCA[$table]['ctrl']['languageField'].'='.intval($langRec['uid'])))       {
+                                                       if ($row[$TCA[$table]['ctrl']['languageField']] <= 0 || $table==='pages')       {
+                                                               if ($row[$TCA[$table]['ctrl']['transOrigPointerField']] == 0 || $table==='pages')       {
+                                                                       if ($table==='pages')   {
+                                                                               $pass = $TCA[$table]['ctrl']['transForeignTable']==='pages_language_overlay' && !t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$uid,' AND '.$TCA['pages_language_overlay']['ctrl']['languageField'].'='.intval($langRec['uid']));
+                                                                               $Ttable = 'pages_language_overlay';
+                                                                               t3lib_div::loadTCA($Ttable);
+                                                                       } else {
+                                                                               $pass = !t3lib_BEfunc::getRecordsByField($table,$TCA[$table]['ctrl']['transOrigPointerField'],$uid,'AND pid='.intval($row['pid']).' AND '.$TCA[$table]['ctrl']['languageField'].'='.intval($langRec['uid']));
+                                                                               $Ttable = $table;
+                                                                       }
+                                                                       
+                                                                       if ($pass)      {
 
                                                                                        // Initialize:
                                                                                $overrideValues = array();
                                                                                $excludeFields = array();
 
                                                                                        // Set override values:
-                                                                               $overrideValues[$TCA[$table]['ctrl']['languageField']] = $langRec['uid'];
-                                                                               $overrideValues[$TCA[$table]['ctrl']['transOrigPointerField']] = $uid;
+                                                                               $overrideValues[$TCA[$Ttable]['ctrl']['languageField']] = $langRec['uid'];
+                                                                               $overrideValues[$TCA[$Ttable]['ctrl']['transOrigPointerField']] = $uid;
 
                                                                                        // Set exclude Fields:
-                                                                               foreach($TCA[$table]['columns'] as $fN => $fCfg)        {
+                                                                               foreach($TCA[$Ttable]['columns'] as $fN => $fCfg)       {
                                                                                        if ($fCfg['l10n_mode']=='prefixLangTitle')      {       // Check if we are just prefixing:
                                                                                                if (($fCfg['config']['type']=='text' || $fCfg['config']['type']=='input') && strlen($row[$fN])) {
                                                                                                        list($tscPID) = t3lib_BEfunc::getTSCpid($table,$uid,'');
@@ -3187,12 +3198,33 @@ class t3lib_TCEmain     {
 
                                                                                                        $overrideValues[$fN] = '['.$translateToMsg.'] '.$row[$fN];
                                                                                                }
-                                                                                       } elseif (t3lib_div::inList('exclude,noCopy,mergeIfNotBlank',$fCfg['l10n_mode']) && $fN!=$TCA[$table]['ctrl']['languageField'] && $fN!=$TCA[$table]['ctrl']['transOrigPointerField']) {  // Otherwise, do not copy field (unless it is the language field or pointer to the original language)
+                                                                                       } elseif (t3lib_div::inList('exclude,noCopy,mergeIfNotBlank',$fCfg['l10n_mode']) && $fN!=$TCA[$Ttable]['ctrl']['languageField'] && $fN!=$TCA[$Ttable]['ctrl']['transOrigPointerField']) {        // Otherwise, do not copy field (unless it is the language field or pointer to the original language)
                                                                                                $excludeFields[] = $fN;
                                                                                        }
                                                                                }
-                                                                                       // Execute the copy:
-                                                                               $this->copyRecord($table,$uid,-$uid,1,$overrideValues,implode(',',$excludeFields));
+                                                                               
+                                                                               if ($Ttable === $table) {
+                                                                               
+                                                                                               // Execute the copy:
+                                                                                       $this->copyRecord($table,$uid,-$uid,1,$overrideValues,implode(',',$excludeFields));
+                                                                               } else {
+                                                                                       
+                                                                                               // Create new record:
+                                                                                       $copyTCE = t3lib_div::makeInstance('t3lib_TCEmain');
+                                                                                       $copyTCE->stripslashes_values = 0;
+                                                                                       $copyTCE->cachedTSconfig = $this->cachedTSconfig;       // Copy forth the cached TSconfig
+                                                                                       $copyTCE->dontProcessTransformations=1;         // Transformations should NOT be carried out during copy
+
+                                                                                       $copyTCE->start(array($Ttable=>array('NEW'=>$overrideValues)),'',$this->BE_USER);
+                                                                                       $copyTCE->process_datamap();
+
+                                                                                               // Getting the new UID as if it had been copied:
+                                                                                       $theNewSQLID = $copyTCE->substNEWwithIDs['NEW'];
+                                                                                       if ($theNewSQLID)       {
+                                                                                                       // If is by design that $Ttable is used and not $table! See "l10nmgr" extension. Could be debated, but this is what I chose for this "pseudo case"
+                                                                                               $this->copyMappingArray[$Ttable][$uid] = $theNewSQLID;
+                                                                                       }
+                                                                               }
                                                                        } else $this->newlog('Localization failed; There already was a localization for this language of the record!',1);
                                                                } else $this->newlog('Localization failed; Source record contained a reference to an original default record (which is strange)!',1);
                                                        } else $this->newlog('Localization failed; Source record had another language than "Default" or "All" defined!',1);
index b637863..27ab49f 100755 (executable)
@@ -54,7 +54,9 @@
  */
 class t3lib_transl8tools       {
        
-       
+       /**
+        *
+        */
        function getSystemLanguages($page_id=0,$backPath='')    {
                global $TCA,$LANG;
 
@@ -156,7 +158,7 @@ class t3lib_transl8tools    {
                        } else return 'Record "'.$table.'_'.$uid.'" was not found';
                } else return 'No table "'.$table.'" or no UID value';
        }
-       
+               
        /**
         *  Returns the table in which translations for input table is found.
         */
index 175d26a..756e644 100755 (executable)
@@ -185,7 +185,7 @@ $TYPO3_CONF_VARS = Array(
                'secureFormmail' => TRUE,                               // Boolean. If set, the internal "formmail" feature in TYPO3 will send mail ONLY to the recipients that are defined in the form CE record. This protects against spammers misusing the formmailer.
                'compressionLevel' => 0,                                // Determines output compression of FE output. Makes output smaller but slows down the page generation depending on the compression level. Requires zlib in your PHP4 installation. Range 1-9, where 1 is least compression (approx. 50%) and 9 is greatest compression (approx 33%). 'true' as value will set the compression based on the system load (works with Linux, FreeBSD). Suggested value is 3. For more info, see class in t3lib/class.gzip_encode.php written by Sandy McArthur, Jr. <Leknor@Leknor.com>
                'compressionDebugInfo' => 0,                    // Boolean. If set, then in the end of the pages, the sizes of the compressed and non-compressed document is output. This should be used ONLY as a test, because the content is compressed twice in order to output this statistics!
-               'pageNotFound_handling' => '',                  // How TYPO3 should handle requests for non-existing/accessible pages. false (default): The 'nearest' page is shown. TRUE or '1': An TYPO3 error box is displayed. Strings: redirect URL, eg. 'notfound.html' or 'http://www.domain.org/errors/notfound.html'. If prefixed with "READFILE:" then it will expect the remaining string to be a HTML file which will be read and outputted directly after having the marker "###CURRENT_URL###" substituted with REQUEST_URI and ###REASON### with reason text, for example: "READFILE:fileadmin/notfound.html". Another option is the prefix "USER_FUNCTION:" which will call a user function, eg. "USER_FUNCTION:typo3conf/pageNotFoundHandling.php:user_pageNotFound->pageNotFound" where the file must contain a class "user_pageNotFound" with a method "pageNotFound" inside with two parameters, $param and $ref
+               'pageNotFound_handling' => '',                  // How TYPO3 should handle requests for non-existing/accessible pages. false (default): The 'nearest' page is shown. TRUE or '1': An TYPO3 error box is displayed. Strings: page to show (reads content and outputs with correct headers), eg. 'notfound.html' or 'http://www.domain.org/errors/notfound.html'. If prefixed "REDIRECT:" it will redirect to the URL/script after the prefix (original behaviour). If prefixed with "READFILE:" then it will expect the remaining string to be a HTML file which will be read and outputted directly after having the marker "###CURRENT_URL###" substituted with REQUEST_URI and ###REASON### with reason text, for example: "READFILE:fileadmin/notfound.html". Another option is the prefix "USER_FUNCTION:" which will call a user function, eg. "USER_FUNCTION:typo3conf/pageNotFoundHandling.php:user_pageNotFound->pageNotFound" where the file must contain a class "user_pageNotFound" with a method "pageNotFound" inside with two parameters, $param and $ref
                'pageNotFound_handling_statheader' => 'HTTP/1.0 404 Not Found',                 // If 'pageNotFound_handling' is enabled, this string will always be sent as header before the actual handling.
                'pageNotFoundOnCHashError' => 0,                // Boolean. If true, a page not found call is made when cHash evaluation errors occur. By default they will just disable caching but still display page output.
                'userFuncClassPrefix' => 'user_',               // This prefix must be the first part of any function or class name called from TypoScript, for instance in the stdWrap function.
index 71f20bc..ebd9261 100755 (executable)
@@ -445,7 +445,7 @@ $TCA['pages_language_overlay'] = Array (
                        'label' => 'LLL:EXT:lang/locallang_general.php:LGL.hidden',
                        'config' => Array (
                                'type' => 'check',
-                               'default' => '1'
+                               'default' => '0'
                        )
                ),
                'starttime' => Array (
@@ -476,6 +476,7 @@ $TCA['pages_language_overlay'] = Array (
                        )
                ),
                'title' => Array (
+                       'l10n_mode' => 'prefixLangTitle',
                        'label' => $TCA['pages']['columns']['title']['label'],
                        'l10n_cat' => 'text',
                        'config' => Array (
index 70093d4..24575f3 100755 (executable)
@@ -5087,6 +5087,14 @@ class tslib_cObj {
                $this->lastTypoLinkTarget = '';
                if ($link_param)        {
                        $link_paramA = t3lib_div::unQuoteFilenames($link_param,true);
+                       
+                               // Check for link-handler keyword:
+                       list($linkHandlerKeyword,$linkHandlerValue) = explode(':',trim($link_paramA[0]),2);
+                       if ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][$linkHandlerKeyword] && strcmp($linkHandlerValue,"")) {
+                               $linkHandlerObj = &t3lib_div::getUserObj($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][$linkHandlerKeyword]);
+                               return $linkHandlerObj->main($linktxt, $conf, $linkHandlerKeyword, $linkHandlerValue, $link_param, $this);
+                       }
+                       
                        $link_param = trim($link_paramA[0]);    // Link parameter value
                        $linkClass = trim($link_paramA[2]);             // Link class
                        if ($linkClass=='-')    $linkClass = '';        // The '-' character means 'no class'. Necessary in order to specify a title as fourth parameter without setting the target or class!
@@ -5316,7 +5324,7 @@ class tslib_cObj {
                        }
 
                        if ($forceTitle)        {$title=$forceTitle;}
-debug($finalTagParts);
+
                        if ($JSwindowParams)    {
 
                                        // Create TARGET-attribute only if the right doctype is used
@@ -7535,9 +7543,6 @@ class tslib_controlTable  {
 }
 
 
-
-
-
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php'])  {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']);
 }
index 688c4c0..91b1b56 100755 (executable)
                        } else {
                                $this->printError('Configuration Error: 404 page "'.$readFile.'" could not be found.');
                        }
+               } elseif (t3lib_div::isFirstPartOfStr($code,'REDIRECT:')) {
+                       header('Location: '.t3lib_div::locationHeaderUrl(substr($code,9)));
+                       exit;
                } elseif (strlen($code))        {
                                // Check if URL is relative
                        $url_parts = parse_url($code);
index c8a9d00..8d89b1a 100644 (file)
@@ -75,11 +75,11 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
 
                $menuArray = array (
                        'depth' => array(
+                               0 => $LANG->getLL('depth_0'),
                                1 => $LANG->getLL('depth_1'),
                                2 => $LANG->getLL('depth_2'),
                                3 => $LANG->getLL('depth_3')
                        ),
-                       'details' => ''
                );
 
                        // Languages:
@@ -108,7 +108,6 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
                                // Depth selector:
                        $h_func = t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[depth]',$this->pObj->MOD_SETTINGS['depth'],$this->pObj->MOD_MENU['depth'],'index.php');
                        $h_func.= t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[lang]',$this->pObj->MOD_SETTINGS['lang'],$this->pObj->MOD_MENU['lang'],'index.php');
-                       $h_func.= t3lib_BEfunc::getFuncCheck($this->pObj->id,'SET[details]',$this->pObj->MOD_SETTINGS['details'],'index.php').' Details';
                        $theOutput.= $h_func;
 
                                // Add CSH:
@@ -133,7 +132,7 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
                        );
 
                                // Create the tree from starting point:
-                       $tree->getTree($treeStartingPoint, $depth, '');
+                       if ($depth)     $tree->getTree($treeStartingPoint, $depth, '');
                        #debug($tree->tree);
 
                                // Add CSS needed:
@@ -242,7 +241,6 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
                                                                        ($row['_COUNT']>1 ? '<div>'.$LANG->getLL('lang_renderl10n_badThingThereAre','1').'</div>':'');
                                                $tCells[] = '<td class="'.$status.' c-leftLine">'.
                                                                                $info.
-                                                                               ($this->pObj->MOD_SETTINGS['details'] ? $this->getLocalizedElementInfo($data['row']['uid'],$langRow['uid']) : '').
                                                                                '</td>';
 
                                                        // Edit whole record:
@@ -390,84 +388,6 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
         * @param       integer         Sys language uid
         * @return      integer         Number of content elements from the PID where the language is set to a certain value.
         */
-       function getLocalizedElementInfo($pageId,$sysLang)      {
-               global $TCA;
-
-               $info = '<hr/>';
-               foreach($TCA as $table => $cfg) {
-                       if ($table!='pages' && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'])  {
-#                      $info.='<h3>'.$table.'</h3>';
-                               if ($TCA[$table]['ctrl']['transOrigPointerTable'])      {
-                                       #$info.='Table "'.$table.'" is skipped because it had a transOrigPointerTable set which is not supported - yet.';
-                               } else {
-
-                                               // First, select all records that are default language OR international:
-                                       $allRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                                               '*',
-                                               $table,
-                                               'pid='.intval($pageId).
-                                                       ' AND '.$TCA[$table]['ctrl']['languageField'].'<=0'.
-                                                       t3lib_BEfunc::deleteClause($table).
-                                                       t3lib_BEfunc::versioningPlaceholderClause($table)
-                                       );
-                                       if (count($allRows))    {
-                       $info.='<h3>'.$table.'</h3>';
-
-$info.='[<b>'.$TCA[$table]['ctrl']['languageField'].'</b>]';
-$info.='[<b>'.$TCA[$table]['ctrl']['transOrigPointerField'].'</b>]';
-$info.='[<b>'.$TCA[$table]['ctrl']['transOrigDiffSourceField'].'</b>]<br/>';
-
-                                                       // Now, for each record, look for localization:
-                                               $translationsUids = array(0);
-                                               foreach($allRows as $row)       {
-                                                       $info.='UID:'.$row['uid'].'/lang:'.$row[$TCA[$table]['ctrl']['languageField']].' has translations:';
-                                                       $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                                                               '*',
-                                                               $table,
-                                                               'pid='.intval($pageId).
-                                                                       ' AND '.$TCA[$table]['ctrl']['languageField'].'='.intval($sysLang).
-                                                                       ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
-                                                                       t3lib_BEfunc::deleteClause($table).
-                                                                       t3lib_BEfunc::versioningPlaceholderClause($table)
-                                                       );
-
-                                                       foreach($translations as $c => $tr)     {
-                                                               $info.=($c>0 ? 'UPS!!':'').'['.$tr['uid'].'],';
-                                                               $translationsUids[] = $tr['uid'];
-                                                       }
-
-
-
-                                                       $info.='<br/>';
-                                               }
-
-                                                       // Look for "lost" translations
-                                               $lostTranslations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                                                       'uid',
-                                                       $table,
-                                                       'pid='.intval($pageId).
-                                                               ' AND '.$TCA[$table]['ctrl']['languageField'].'='.intval($sysLang).
-                                                               ' AND uid NOT IN ('.implode(',',$translationsUids).')'.
-                                                               t3lib_BEfunc::deleteClause($table).
-                                                               t3lib_BEfunc::versioningPlaceholderClause($table)
-                                               );
-                                               if (count($lostTranslations))   {
-                                                       $info.=t3lib_div::view_array($lostTranslations);
-                                               }
-                                       }
-                               }
-                       }
-               }
-               return $info;
-       }
-
-       /**
-        * Counting content elements for a single language on a page.
-        *
-        * @param       integer         Page id to select for.
-        * @param       integer         Sys language uid
-        * @return      integer         Number of content elements from the PID where the language is set to a certain value.
-        */
        function getContentElementCount($pageId,$sysLang)       {
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                        'count(*)',
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.cleanflexform.php b/typo3/sysext/lowlevel/clmods/clmods/class.cleanflexform.php
deleted file mode 100644 (file)
index fb74b9f..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: cleanflexform
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   57: class tx_lowlevel_cleanflexform extends tx_lowlevel_cleaner_core
- *   64:     function tx_lowlevel_cleanflexform()
- *   89:     function main()
- *  122:     function main_parseTreeCallBack($tableName,$uid,$echoLevel,$versionSwapmode,$rootIsVersion)
- *  154:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 4
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-/**
- * cleanflexform
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_cleanflexform extends tx_lowlevel_cleaner_core {
-
-       /**
-        * Constructor
-        *
-        * @return      void
-        */
-       function tx_lowlevel_cleanflexform()    {
-               parent::tx_lowlevel_cleaner_core();
-
-                       // Setting up help:
-               $this->cli_options[] = array('--echotree level', 'When "level" is set to 1 or higher you will see the page of the page tree outputted as it is traversed. A value of 2 for "level" will show even more information.');
-               $this->cli_options[] = array('--pid id', 'Setting start page in page tree. Default is the page tree root, 0 (zero)');
-               $this->cli_options[] = array('--depth int', 'Setting traversal depth. 0 (zero) will only analyse start page (see --pid), 1 will traverse one level of subpages etc.');
-
-               $this->cli_help['name'] = 'cleanflexform -- Find flexform fields with unclean XML';
-               $this->cli_help['description'] = trim('
-Traversing page tree and finding records with FlexForm fields with XML that could be cleaned up. This will just remove obsolete data garbage.
-
-Automatic Repair:
-Cleaning XML for FlexForm fields.
-');
-
-               $this->cli_help['examples'] = '';
-       }
-
-       /**
-        * Find orphan records
-        * VERY CPU and memory intensive since it will look up the whole page tree!
-        *
-        * @return      array
-        */
-       function main() {
-               global $TYPO3_DB;
-
-                       // Initialize result array:
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'dirty' => array('','',2),
-                       ),
-                       'dirty' => array()
-               );
-
-               $startingPoint = $this->cli_isArg('--pid') ? t3lib_div::intInRange($this->cli_argValue('--pid'),0) : 0;
-               $depth = $this->cli_isArg('--depth') ? t3lib_div::intInRange($this->cli_argValue('--depth'),0) : 1000;
-
-               $this->cleanFlexForm_dirtyFields = &$resultArray['dirty'];
-               $this->genTree_traverseDeleted = FALSE; // Do not repair flexform data in deleted records.
-
-               $this->genTree($startingPoint,$depth,(int)$this->cli_argValue('--echotree'),'main_parseTreeCallBack');
-
-               return $resultArray;
-       }
-
-       /**
-        * Call back function for page tree traversal!
-        *
-        * @param       string          Table name
-        * @param       integer         UID of record in processing
-        * @param       integer         Echo level  (see calling function
-        * @param       string          Version swap mode on that level (see calling function
-        * @param       integer         Is root version (see calling function
-        * @return      void
-        */
-       function main_parseTreeCallBack($tableName,$uid,$echoLevel,$versionSwapmode,$rootIsVersion)     {
-
-               t3lib_div::loadTCA($tableName);
-               foreach($GLOBALS['TCA'][$tableName]['columns'] as $colName => $config)  {
-                       if ($config['config']['type']=='flex')  {
-                               if ($echoLevel>2)       echo chr(10).'                  [cleanflexform:] Field "'.$colName.'" in '.$tableName.':'.$uid.' was a flexform and...';
-
-                               $recRow = t3lib_BEfunc::getRecordRaw($tableName,'uid='.intval($uid));
-                               $flexObj = t3lib_div::makeInstance('t3lib_flexformtools');
-                               if ($recRow[$colName])  {
-
-                                               // Clean XML:
-                                       $newXML = $flexObj->cleanFlexFormXML($tableName,$colName,$recRow);
-
-                                       if (md5($recRow[$colName])!=md5($newXML))       {
-                                               if ($echoLevel>2)       echo ' was DIRTY, needs cleanup!';
-                                               $this->cleanFlexForm_dirtyFields[] = $tableName.':'.$uid.':'.$colName;
-                                       } else {
-                                               if ($echoLevel>2)       echo ' was CLEAN';
-                                       }
-                               } else if ($echoLevel>2)        echo ' was EMPTY';
-                       }
-               }
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-               foreach($resultArray['dirty'] as $fieldID)      {
-                       list($table, $uid, $field) = explode(':',$fieldID);
-                       echo 'Cleaning XML in "'.$fieldID.'": ';
-                       if ($bypass = $this->cli_noExecutionCheck($fieldID))    {
-                               echo $bypass;
-                       } else {
-
-                                       // Clean XML:
-                               $data = array();
-                               $recRow = t3lib_BEfunc::getRecordRaw($table,'uid='.intval($uid));
-                               $flexObj = t3lib_div::makeInstance('t3lib_flexformtools');
-                               if ($recRow[$field])    {
-                                       $data[$table][$uid][$field] = $flexObj->cleanFlexFormXML($table,$field,$recRow);
-                               }
-
-                                       // Execute Data array:
-                               $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                               $tce->stripslashes_values = FALSE;
-                               $tce->dontProcessTransformations = TRUE;
-                               $tce->bypassWorkspaceRestrictions = TRUE;
-                               $tce->bypassFileHandling = TRUE;
-
-                               $tce->start($data,array());     // check has been done previously that there is a backend user which is Admin and also in live workspace
-                               $tce->process_datamap();
-
-                                       // Return errors if any:
-                               if (count($tce->errorLog))      {
-                                       echo '  ERROR from "TCEmain":'.chr(10).'TCEmain:'.implode(chr(10).'TCEmain:',$tce->errorLog);
-                               } else echo 'DONE';
-                       }
-                       echo chr(10);
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.deleted.php b/typo3/sysext/lowlevel/clmods/clmods/class.deleted.php
deleted file mode 100644 (file)
index 3decb18..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: Deleted records
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   56: class tx_lowlevel_deleted extends tx_lowlevel_cleaner_core
- *   63:     function tx_lowlevel_deleted()
- *   88:     function main()
- *  116:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 3
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-/**
- * Looking for Deleted records
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_deleted extends tx_lowlevel_cleaner_core {
-
-       /**
-        * Constructor
-        *
-        * @return      [type]          ...
-        */
-       function tx_lowlevel_deleted()  {
-               parent::tx_lowlevel_cleaner_core();
-
-                       // Setting up help:
-               $this->cli_options[] = array('--echotree level', 'When "level" is set to 1 or higher you will see the page of the page tree outputted as it is traversed. A value of 2 for "level" will show even more information.');
-               $this->cli_options[] = array('--pid id', 'Setting start page in page tree. Default is the page tree root, 0 (zero)');
-               $this->cli_options[] = array('--depth int', 'Setting traversal depth. 0 (zero) will only analyse start page (see --pid), 1 will traverse one level of subpages etc.');
-
-               $this->cli_help['name'] = 'deleted -- To find and flush deleted records in the page tree';
-               $this->cli_help['description'] = trim('
-Traversing page tree and finding deleted records
-
-Automatic Repair:
-Although deleted records are not errors to be repaired, this tool allows you to flush the deleted records completely from the system as an automatic action. Limiting this lookup by --pid and --depth can help you to narrow in the operation to a part of the page tree.
-');
-
-               $this->cli_help['examples'] = '';
-       }
-
-       /**
-        * Find orphan records
-        * VERY CPU and memory intensive since it will look up the whole page tree!
-        *
-        * @return      array
-        */
-       function main() {
-               global $TYPO3_DB;
-
-                       // Initialize result array:
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'deleted' => array('Index of deleted records','These are records from the page tree having the deleted-flag set. The --AUTOFIX option will flush them completely!',1),
-                       ),
-                       'deleted' => array(),
-               );
-
-               $startingPoint = $this->cli_isArg('--pid') ? t3lib_div::intInRange($this->cli_argValue('--pid'),0) : 0;
-               $depth = $this->cli_isArg('--depth') ? t3lib_div::intInRange($this->cli_argValue('--depth'),0) : 1000;
-               $this->genTree($startingPoint,$depth,(int)$this->cli_argValue('--echotree'));
-
-               $resultArray['deleted'] = $this->recStats['deleted'];
-
-               return $resultArray;
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-
-                       // Putting "tx_templavoila_datastructure" table in the bottom:
-               if (isset($resultArray['deleted']['tx_templavoila_datastructure']))     {
-                       $_tx_templavoila_datastructure = $resultArray['deleted']['tx_templavoila_datastructure'];
-                       unset($resultArray['deleted']['tx_templavoila_datastructure']);
-                       $resultArray['deleted']['tx_templavoila_datastructure'] = $_tx_templavoila_datastructure;
-               }
-
-                       // Putting "pages" table in the bottom:
-               if (isset($resultArray['deleted']['pages']))    {
-                       $_pages = $resultArray['deleted']['pages'];
-                       unset($resultArray['deleted']['pages']);
-                       $resultArray['deleted']['pages'] = array_reverse($_pages);      // To delete sub pages first assuming they are accumulated from top of page tree.
-               }
-
-                       // Traversing records:
-               foreach($resultArray['deleted'] as $table => $list)     {
-                       echo 'Flushing deleted records from table "'.$table.'":'.chr(10);
-                       foreach($list as $uid)  {
-                               echo '  Flushing record "'.$table.':'.$uid.'": ';
-                               if ($bypass = $this->cli_noExecutionCheck($table.':'.$uid))     {
-                                       echo $bypass;
-                               } else {
-
-                                               // Execute CMD array:
-                                       $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                                       $tce->stripslashes_values = FALSE;
-                                       $tce->start(array(),array());
-                                       $tce->deleteRecord($table,$uid, TRUE, TRUE);    // Notice, we are deleting pages with no regard to subpages/subrecords - we do this since they should also be included in the set of deleted pages of course (no un-deleted record can exist under a deleted page...)
-
-                                               // Return errors if any:
-                                       if (count($tce->errorLog))      {
-                                               echo '  ERROR from "TCEmain":'.chr(10).'TCEmain:'.implode(chr(10).'TCEmain:',$tce->errorLog);
-                                       } else echo "DONE";
-                               }
-                               echo chr(10);
-                       }
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.double_files.php b/typo3/sysext/lowlevel/clmods/clmods/class.double_files.php
deleted file mode 100644 (file)
index 40a0ee6..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: Double Files
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   58: class tx_lowlevel_double_files extends tx_lowlevel_cleaner_core
- *   67:     function tx_lowlevel_double_files()
- *   99:     function main()
- *  182:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 3
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
-
-/**
- * Looking for double files
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_double_files extends tx_lowlevel_cleaner_core {
-
-       var $checkRefIndex = TRUE;
-
-       /**
-        * Constructor
-        *
-        * @return      void
-        */
-       function tx_lowlevel_double_files()     {
-               parent::tx_lowlevel_cleaner_core();
-
-                       // Setting up help:
-               $this->cli_help['name'] = 'double_files -- Looking for files from TYPO3 managed records which are referenced more than one time (only one time allowed)';
-               $this->cli_help['description'] = trim('
-Assumptions:
-- a perfect integrity of the reference index table (always update the reference index table before using this tool!)
-- files found in deleted records are included (otherwise you would see a false list of lost files)
-
-Files attached to records in TYPO3 using a "group" type configuration in TCA or FlexForm DataStructure are managed exclusively by the system and there must always exist a 1-1 reference between the file and the reference in the record.
-This tool will expose when such files are referenced from multiple locations which is considered an integrity error.
-If a multi-reference is found it was typically created because the record was copied or modified outside of TCEmain which will otherwise maintain the relations correctly.
-Multi-references should be resolved to 1-1 references as soon as possible. The danger of keeping multi-references is that if the file is removed from one of the refering records it will actually be deleted in the file system, leaving missing files for the remaining referers!
-
-Automatic Repair of Errors:
-- The multi-referenced file is copied under a new name and references updated.
-
-Manual repair suggestions:
-- None that can not be handled by the automatic repair.
-');
-
-               $this->cli_help['examples'] = '/.../cli_dispatch.phpsh lowlevel_cleaner double_files -s -r
-This will check the system for double files relations.';
-       }
-
-       /**
-        * Find managed files which are referred to more than one time
-        * Fix methods: API in t3lib_refindex that allows to change the value of a reference (we could copy the file) or remove reference
-        *
-        * @return      array
-        */
-       function main() {
-               global $TYPO3_DB;
-
-                       // Initialize result array:
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'multipleReferencesList_count' => array('Number of multi-reference files','(See below)',0),
-                               'singleReferencesList_count' => array('Number of files correctly referenced','The amount of correct 1-1 references',0),
-                               'multipleReferencesList' => array('Entries with files having multiple references','These are serious problems that should be resolved ASAP to prevent data loss! '.$this->label_infoString,3),
-                               'dirname_registry' => array('Registry of directories in which files are found.','Registry includes which table/field pairs store files in them plus how many files their store.',0),
-                               'missingFiles' => array('Tracking missing files','(Extra feature, not related to tracking of double references. Further, the list may include more files than found in the missing_files()-test because this list includes missing files from deleted records.)',0),
-                               'warnings' => array('Warnings picked up','',2)
-                       ),
-                       'multipleReferencesList_count' => 0,
-                       'singleReferencesList_count' => 0,
-                       'multipleReferencesList' => array(),
-                       'dirname_registry' => array(),
-                       'missingFiles' => array(),
-                       'warnings' => array()
-               );
-
-                       // Select all files in the reference table not found by a soft reference parser (thus TCA configured)
-               $recs = $TYPO3_DB->exec_SELECTgetRows(
-                       '*',
-                       'sys_refindex',
-                       'ref_table='.$TYPO3_DB->fullQuoteStr('_FILE', 'sys_refindex').
-                               ' AND softref_key='.$TYPO3_DB->fullQuoteStr('', 'sys_refindex'),
-                       '',
-                       'sorting DESC'
-               );
-
-                       // Traverse the files and put into a large table:
-               $tempCount = array();
-               if (is_array($recs)) {
-                       foreach($recs as $rec)  {
-
-                                       // Compile info string for location of reference:
-                               $infoString = $this->infoStr($rec);
-
-                                       // Registering occurencies in directories:
-                               $resultArray['dirname_registry'][dirname($rec['ref_string'])][$rec['tablename'].':'.$rec['field']]++;
-
-                                       // Handle missing file:
-                               if (!@is_file(PATH_site.$rec['ref_string']))    {
-                                       $resultArray['missingFiles'][$rec['ref_string']][$rec['hash']] = $infoString;
-                               }
-
-                                       // Add entry if file has multiple references pointing to it:
-                               if (isset($tempCount[$rec['ref_string']]))      {
-                                       if (!is_array($resultArray['multipleReferencesList'][$rec['ref_string']]))      {
-                                               $resultArray['multipleReferencesList'][$rec['ref_string']] = array();
-                                               $resultArray['multipleReferencesList'][$rec['ref_string']][$tempCount[$rec['ref_string']][1]] = $tempCount[$rec['ref_string']][0];
-                                       }
-                                       $resultArray['multipleReferencesList'][$rec['ref_string']][$rec['hash']] = $infoString;
-                               } else {
-                                       $tempCount[$rec['ref_string']] = array($infoString,$rec['hash']);
-                               }
-                       }
-               }
-
-                       // Add count for multi-references:
-               $resultArray['multipleReferencesList_count'] = count($resultArray['multipleReferencesList']);
-               $resultArray['singleReferencesList_count'] = count($tempCount) - $resultArray['multipleReferencesList_count'];
-
-                       // Sort dirname registry and add warnings for directories outside uploads/
-               ksort($resultArray['dirname_registry']);
-               foreach($resultArray['dirname_registry'] as $dir => $temp)      {
-                       if (!t3lib_div::isFirstPartOfStr($dir,'uploads/'))      {
-                               $resultArray['warnings'][] = 'Directory "'.$dir.'" was outside uploads/ which is unusual practice in TYPO3 although not forbidden. Directory used by the following table:field pairs: '.implode(',',array_keys($temp));
-                       }
-               }
-
-               return $resultArray;
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-               foreach($resultArray['multipleReferencesList'] as $key => $value)       {
-                       $absFileName = t3lib_div::getFileAbsFileName($key);
-                       if ($absFileName && @is_file($absFileName))     {
-                               echo 'Processing file: '.$key.chr(10);
-                               $c=0;
-                               foreach($value as $hash => $recReference)       {
-                                       if ($c==0)      {
-                                               echo '  Keeping '.$key.' for record "'.$recReference.'"'.chr(10);
-                                       } else {
-                                                       // Create unique name for file:
-                                               $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-                                               $newName = $fileFunc->getUniqueName(basename($key), dirname($absFileName));
-                                               echo '  Copying '.$key.' to '.substr($newName,strlen(PATH_site)).' for record "'.$recReference.'": ';
-
-                                               if ($bypass = $this->cli_noExecutionCheck($recReference))       {
-                                                       echo $bypass;
-                                               } else {
-                                                       t3lib_div::upload_copy_move($absFileName,$newName);
-                                                       clearstatcache();
-
-                                                       if (@is_file($newName)) {
-                                                               $sysRefObj = t3lib_div::makeInstance('t3lib_refindex');
-                                                               $error = $sysRefObj->setReferenceValue($hash,basename($newName));
-                                                               if ($error)     {
-                                                                       echo '  ERROR:  t3lib_refindex::setReferenceValue(): '.$error.chr(10);
-                                                                       exit;
-                                                               } else echo "DONE";
-                                                       } else {
-                                                               echo '  ERROR: File "'.$newName.'" was not created!';
-                                                       }
-                                               }
-                                               echo chr(10);
-                                       }
-                                       $c++;
-                               }
-                       } else {
-                               echo '  ERROR: File "'.$absFileName.'" was not found!';
-                       }
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.lost_files.php b/typo3/sysext/lowlevel/clmods/clmods/class.lost_files.php
deleted file mode 100644 (file)
index 0b8ab74..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: Lost files
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   56: class tx_lowlevel_lost_files extends tx_lowlevel_cleaner_core
- *   65:     function tx_lowlevel_lost_files()
- *  103:     function main()
- *  181:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 3
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-/**
- * Looking for Lost files
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_lost_files extends tx_lowlevel_cleaner_core {
-
-       var $checkRefIndex = TRUE;
-
-       /**
-        * Constructor
-        *
-        * @return      void
-        */
-       function tx_lowlevel_lost_files()       {
-               parent::tx_lowlevel_cleaner_core();
-
-               $this->cli_options[] = array('--excludePath [path-list]', 'Comma separated list of paths to exclude. Example: "uploads/[path1],uploads/[path2],..."');
-
-                       // Setting up help:
-               $this->cli_help['name'] = 'lost_files -- Looking for files in the uploads/ folder which does not have a reference in TYPO3 managed records.';
-               $this->cli_help['description'] = trim('
-Assumptions:
-- a perfect integrity of the reference index table (always update the reference index table before using this tool!)
-- that all contents in the uploads folder are files attached to TCA records and exclusively managed by TCEmain through "group" type fields
-- exceptions are: index.html and .htaccess files (ignored)
-- exceptions are: RTEmagic* image files (ignored)
-- files found in deleted records are included (otherwise you would see a false list of lost files)
-
-The assumptions are not requirements by the TYPO3 API but reflects the de facto implementation of most TYPO3 installations and therefore a practical approach to cleaning up the uploads/ folder.
-Therefore, if all "group" type fields in TCA and flexforms are positioned inside the uploads/ folder and if no files inside are managed manually it should be safe to clean out files with no relations found in the system.
-Under such circumstances there should theoretically be no lost files in the uploads/ folder since TCEmain should have managed relations automatically including adding and deleting files.
-However, there is at least one reason known to why files might be found lost and that is when FlexForms are used. In such a case a change of/in the Data Structure XML (or the ability of the system to find the Data Structure definition!) used for the flexform could leave lost files behind. This is not unlikely to happen when records are deleted. More details can be found in a note to the function t3lib_BEfunc::getFlexFormDS()
-Another scenario could of course be de-installation of extensions which managed files in the uploads/ folders.
-
-Automatic Repair of Errors:
-- Simply delete lost files (Warning: First, make sure those files are not used somewhere TYPO3 does not know about! See the assumptions above).
-');
-
-               $this->cli_help['examples'] = '/.../cli_dispatch.phpsh lowlevel_cleaner lost_files -s -r
-Will report lost files.';
-       }
-
-
-       /**
-        * Find lost files in uploads/ folder
-        * FIX METHOD: Simply delete the file...
-        *
-        * TODO: Add parameter to exclude filepath
-        * TODO: Add parameter to list more file names/patterns to ignore
-        * TODO: Add parameter to include RTEmagic images
-        *
-        * @return      array
-        */
-       function main() {
-               global $TYPO3_DB;
-
-                       // Initialize result array:
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'managedFiles' => array('Files related to TYPO3 records and managed by TCEmain','These files you definitely want to keep.',0),
-                               'ignoredFiles' => array('Ignored files (index.html, .htaccess etc.)','These files are allowed in uploads/ folder',0),
-                               'RTEmagicFiles' => array('RTE magic images - those found (and ignored)','These files are also allowed in some uploads/ folders as RTEmagic images.',0),
-                               'lostFiles' => array('Lost files - those you can delete','You can delete these files!',3),
-                               'warnings' => array('Warnings picked up','',2)
-                       ),
-                       'managedFiles' => array(),
-                       'ignoredFiles' => array(),
-                       'RTEmagicFiles' => array(),
-                       'lostFiles' => array(),
-                       'warnings' => array()
-               );
-
-                       // Get all files:
-               $fileArr = array();
-               $fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,PATH_site.'uploads/');
-               $fileArr = t3lib_div::removePrefixPathFromList($fileArr,PATH_site);
-
-               $excludePaths = t3lib_div::trimExplode(',',$this->cli_argValue('--excludePath',0),1);
-
-                       // Traverse files and for each, look up if its found in the reference index.
-               foreach($fileArr as $key => $value) {
-
-                       $include = TRUE;
-                       foreach($excludePaths as $exclPath)     {
-                               if (t3lib_div::isFirstPartOfStr($value,$exclPath))      {
-                                       $include = FALSE;
-                               }
-                       }
-                               
-                       if ($include)   {
-                                       // First, allow "index.html", ".htaccess" files since they are often used for good reasons
-                               if (substr($value,-11) == '/index.html' || substr($value,-10) == '/.htaccess')  {
-                                       unset($fileArr[$key])   ;
-                                       $resultArray['ignoredFiles'][] = $value;
-                               } else {
-                                               // Looking for a reference from a field which is NOT a soft reference (thus, only fields with a proper TCA/Flexform configuration)
-                                       $recs = $TYPO3_DB->exec_SELECTgetRows(
-                                               '*',
-                                               'sys_refindex',
-                                               'ref_table='.$TYPO3_DB->fullQuoteStr('_FILE', 'sys_refindex').
-                                                       ' AND ref_string='.$TYPO3_DB->fullQuoteStr($value, 'sys_refindex').
-                                                       ' AND softref_key='.$TYPO3_DB->fullQuoteStr('', 'sys_refindex'),
-                                               '',
-                                               'sorting DESC'
-                                       );
-
-                                               // If found, unset entry:
-                                       if (count($recs))               {
-                                               unset($fileArr[$key])   ;
-                                               $resultArray['managedFiles'][] = $value;
-                                               if (count($recs)>1)     {
-                                                       $resultArray['warnings'][]='Warning: File "'.$value.'" had '.count($recs).' references from group-fields, should have only one!';
-                                               }
-                                       } else {
-                                                       // When here it means the file was not found. So we test if it has a RTEmagic-image name and if so, we allow it:
-                                               if (ereg('^RTEmagic[P|C]_',basename($value)))   {
-                                                       unset($fileArr[$key])   ;
-                                                       $resultArray['RTEmagicFiles'][] = $value;
-                                               } else {
-                                                               // We conclude that the file is lost...:
-                                                       unset($fileArr[$key])   ;
-                                                       $resultArray['lostFiles'][] = $value;
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               // $fileArr variable should now be empty with all contents transferred to the result array keys.
-
-
-               return $resultArray;
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-               foreach($resultArray['lostFiles'] as $key => $value)    {
-                       $absFileName = t3lib_div::getFileAbsFileName($value);
-                       echo 'Deleting file: "'.$absFileName.'": ';
-                       if ($bypass = $this->cli_noExecutionCheck($absFileName))        {
-                               echo $bypass;
-                       } else {
-                               if ($absFileName && @is_file($absFileName))     {
-                                       unlink($absFileName);
-                                       echo 'DONE';
-                               } else {
-                                       echo '  ERROR: File "'.$absFileName.'" was not found!';
-                               }
-                       }
-                       echo chr(10);
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.missing_files.php b/typo3/sysext/lowlevel/clmods/clmods/class.missing_files.php
deleted file mode 100644 (file)
index e31fa21..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: Missing files
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   56: class tx_lowlevel_missing_files extends tx_lowlevel_cleaner_core
- *   65:     function tx_lowlevel_missing_files()
- *   98:     function main()
- *  154:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 3
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-/**
- * Looking for missing files.
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_missing_files extends tx_lowlevel_cleaner_core {
-
-       var $checkRefIndex = TRUE;
-
-       /**
-        * Constructor
-        *
-        * @return      void
-        */
-       function tx_lowlevel_missing_files()    {
-               parent::tx_lowlevel_cleaner_core();
-
-                       // Setting up help:
-               $this->cli_help['name'] = 'missing_files -- Find all file references from records pointing to a missing (non-existing) file.';
-               $this->cli_help['description'] = trim('
-Assumptions:
-- a perfect integrity of the reference index table (always update the reference index table before using this tool!)
-- relevant soft reference parsers applied everywhere file references are used inline
-
-Files may be missing for these reasons (except software bugs):
-- someone manually deleted the file inside fileadmin/ or another user maintained folder. If the reference was a soft reference (opposite to a TCEmain managed file relation from "group" type fields), technically it is not an error although it might be a mistake that someone did so.
-- someone manually deleted the file inside the uploads/ folder (typically containing managed files) which is an error since no user interaction should take place there.
-
-Automatic Repair of Errors:
-- Managed files (TCA/FlexForm attachments): Will silently remove the reference from the record since the file is missing. For this reason you might prefer a manual approach instead.
-- Soft References: Requires manual fix if you consider it an error.
-
-Manual repair suggestions:
-- Managed files: You might be able to locate the file and re-insert it in the correct location. However, no automatic fix can do that for you.
-- Soft References: You should investigate each case and edit the content accordingly. A soft reference to a file could be in an HTML image tag (for example <img src="missing_file.jpg" />) and you would have to either remove the whole tag, change the filename or re-create the missing file.
-');
-
-               $this->cli_help['examples'] = '/.../cli_dispatch.phpsh lowlevel_cleaner missing_files -s -r
-This will show you missing files in the TYPO3 system and only report back if errors were found.';
-       }
-
-       /**
-        * Find file references that points to non-existing files in system
-        * Fix methods: API in t3lib_refindex that allows to change the value of a reference (or remove it)
-        *
-        * @return      array
-        */
-       function main() {
-               global $TYPO3_DB;
-
-                       // Initialize result array:
-               $listExplain = ' Shows the relative filename of missing file as header and under a list of record fields in which the references are found. '.$this->label_infoString;
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'managedFilesMissing' => array('List of missing files managed by TCEmain', $listExplain, 3),
-                               'softrefFilesMissing' => array('List of missing files registered as a soft reference', $listExplain, 2),
-                       ),
-                       'managedFilesMissing' => array(),
-                       'softrefFilesMissing' => array(),
-               );
-
-
-                       // Select all files in the reference table
-               $recs = $TYPO3_DB->exec_SELECTgetRows(
-                       '*',
-                       'sys_refindex',
-                       'ref_table='.$TYPO3_DB->fullQuoteStr('_FILE', 'sys_refindex'),
-                       '',
-                       'sorting DESC'
-               );
-
-                       // Traverse the files and put into a large table:
-               if (is_array($recs)) {
-                       foreach($recs as $rec)  {
-
-                                       // Compile info string for location of reference:
-                               $infoString = $this->infoStr($rec);
-
-                                       // Handle missing file:
-                               if (!@is_file(PATH_site.$rec['ref_string']))    {
-
-                                       if ((string)$rec['softref_key']=='')    {
-                                               $resultArrayIndex = 'managedFilesMissing';
-                                       } else {
-                                               $resultArrayIndex = 'softrefFilesMissing';
-                                       }
-
-                                       $resultArray[$resultArrayIndex][$rec['ref_string']][$rec['hash']] = $infoString;
-                               }
-                       }
-               }
-
-               return $resultArray;
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-               foreach($resultArray['managedFilesMissing'] as $key => $value)  {
-                       echo 'Processing file: '.$key.chr(10);
-                       $c=0;
-                       foreach($value as $hash => $recReference)       {
-                               echo '  Removing reference in record "'.$recReference.'": ';
-                               if ($bypass = $this->cli_noExecutionCheck($recReference))       {
-                                       echo $bypass;
-                               } else {
-                                       $sysRefObj = t3lib_div::makeInstance('t3lib_refindex');
-                                       $error = $sysRefObj->setReferenceValue($hash,NULL);
-                                       if ($error)     {
-                                               echo '          t3lib_refindex::setReferenceValue(): '.$error.chr(10);
-                                               echo 'missing_files: exit on error'.chr(10);
-                                               exit;
-                                       } else echo "DONE";
-                               }
-                               echo chr(10);
-                       }
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.missing_relations.php b/typo3/sysext/lowlevel/clmods/clmods/class.missing_relations.php
deleted file mode 100644 (file)
index 893d6aa..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: Missing relations
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   56: class tx_lowlevel_missing_relations extends tx_lowlevel_cleaner_core
- *   65:     function tx_lowlevel_missing_relations()
- *  101:     function main()
- *  173:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 3
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-/**
- * Looking for missing relations.
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_missing_relations extends tx_lowlevel_cleaner_core {
-
-       var $checkRefIndex = TRUE;
-
-       /**
-        * Constructor
-        *
-        * @return      void
-        */
-       function tx_lowlevel_missing_relations()        {
-               parent::tx_lowlevel_cleaner_core();
-
-                       // Setting up help:
-               $this->cli_help['name'] = 'missing_relations -- Find all record references pointing to a non-existing record.';
-               $this->cli_help['description'] = trim('
-Assumptions:
-- a perfect integrity of the reference index table (always update the reference index table before using this tool!)
-- all database references to check are integers greater than zero
-- does not check if a referenced record is inside an offline branch, another workspace etc. which could make the reference useless in reality or otherwise question integrity
-Records may be missing for these reasons (except software bugs):
-- someone deleted the record which is technically not an error although it might be a mistake that someone did so.
-- after flushing published versions and/or deleted-flagged records a number of new missing references might appear; those were pointing to records just flushed.
-
-Automatic Repair of Errors:
-- Only managed references are repaired (TCA-configured).
-- Offline Version Records and Non Existing Records: Reference is removed
-
-Manual repair suggestions:
-- For soft references you should investigate each case and edit the content accordingly.
-- References to deleted records can theoretically be removed since a deleted record cannot be selected and hence your website should not be affected by removal of the reference. On the other hand it does not hurt to ignore it for now. To have this automatically fixed you must first flush the deleted records after which remaining references will appear as pointing to Non Existing Records and can now be removed with the automatic fix.
-
-NOTICE: Uses the Reference Index Table (sys_refindex) for analysis. Update it before use!
-');
-
-               $this->cli_help['examples'] = '/.../cli_dispatch.phpsh lowlevel_cleaner missing_relations -s -r
-Reports missing relations';
-       }
-
-
-       /**
-        * Find relations pointing to non-existing records
-        * Fix methods: API in t3lib_refindex that allows to change the value of a reference (or remove it) [Only for managed relations!]
-        *
-        * @return      array
-        */
-       function main() {
-               global $TYPO3_DB;
-
-                       // Initialize result array:
-               $listExplain = ' Shows the missing record as header and underneath a list of record fields in which the references are found. '.$this->label_infoString;
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'offlineVersionRecords_m' => array('Offline version records (managed)','These records are offline versions having a pid=-1 and references should never occur directly to their uids.'.$listExplain,3),
-                               'deletedRecords_m' => array('Deleted-flagged records (managed)','These records are deleted with a flag but references are still pointing at them. Keeping the references is useful if you undelete the referenced records later, otherwise the references are lost completely when the deleted records are flushed at some point. Notice that if those records listed are themselves deleted (marked with "DELETED") it is not a problem.'.$listExplain,2),
-                               'nonExistingRecords_m' => array('Non-existing records to which there are references (managed)','These references can safely be removed since there is no record found in the database at all.'.$listExplain,3), // 3 = error
-                               'offlineVersionRecords_s' => array('Offline version records (softref)','See above.'.$listExplain,2),
-                               'deletedRecords_s' => array('Deleted-flagged records (softref)','See above.'.$listExplain,2),
-                               'nonExistingRecords_s' => array('Non-existing records to which there are references (softref)','See above.'.$listExplain,2),
-                       ),
-                       'offlineVersionRecords_m' => array(),
-                       'deletedRecords_m' => array(),
-                       'nonExistingRecords_m' => array(),
-                       'offlineVersionRecords_s' => array(),
-                       'deletedRecords_s' => array(),
-                       'nonExistingRecords_s' => array(),
-               );
-
-                       // Select DB relations from reference table
-               $recs = $TYPO3_DB->exec_SELECTgetRows(
-                       '*',
-                       'sys_refindex',
-                       'ref_table!='.$TYPO3_DB->fullQuoteStr('_FILE', 'sys_refindex'). // Assuming that any other key will be a table name!
-                       ' AND ref_uid>0'.
-                       $filterClause,
-                       '',
-                       'sorting DESC'
-               );
-
-                       // Traverse the records
-               $tempExists = array();
-               if (is_array($recs)) {
-                       foreach($recs as $rec)  {
-                               $suffix = $rec['softref_key']!='' ? '_s' : '_m';
-                               $idx = $rec['ref_table'].':'.$rec['ref_uid'];
-
-                                       // Get referenced record:
-                               if (!isset($tempExists[$idx]))  {
-                                       $tempExists[$idx] = t3lib_BEfunc::getRecordRaw($rec['ref_table'],'uid='.intval($rec['ref_uid']),'uid,pid'.($GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete'] ? ','.$GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete'] : ''));
-                               }
-
-                                       // Compile info string for location of reference:
-                               $infoString = $this->infoStr($rec);
-
-                                       // Handle missing file:
-                               if ($tempExists[$idx]['uid'])   {
-                                       if ($tempExists[$idx]['pid']==-1)       {
-                                               $resultArray['offlineVersionRecords'.$suffix][$idx][$rec['hash']] = $infoString;
-                                       } elseif ($GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete'] && $tempExists[$idx][$GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete']])      {
-                                               $resultArray['deletedRecords'.$suffix][$idx][$rec['hash']] = $infoString;
-                                       }
-                               } else {
-                                       $resultArray['nonExistingRecords'.$suffix][$idx][$rec['hash']] = $infoString;
-                               }
-                       }
-               }
-
-               return $resultArray;
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-
-               $trav = array('offlineVersionRecords_m', 'nonExistingRecords_m');
-               foreach($trav as $tk)   {
-                       echo 'Processing managed "'.$tk.'"...'.chr(10);
-                       foreach($resultArray[$tk] as $key => $value)    {
-                               foreach($value as $hash => $recReference)       {
-                                       echo '  Removing reference to '.$key.' in record "'.$recReference.'": ';
-                                       if ($bypass = $this->cli_noExecutionCheck($recReference))       {
-                                               echo $bypass;
-                                       } else {
-                                               $sysRefObj = t3lib_div::makeInstance('t3lib_refindex');
-                                               $error = $sysRefObj->setReferenceValue($hash,NULL);
-                                               if ($error)     {
-                                                       echo '          t3lib_refindex::setReferenceValue(): '.$error.chr(10);
-                                               } else echo 'DONE';
-                                       }
-                                       echo chr(10);
-                               }
-                       }
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.orphan_records.php b/typo3/sysext/lowlevel/clmods/clmods/class.orphan_records.php
deleted file mode 100644 (file)
index 8c3a968..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: Orphan records
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   56: class tx_lowlevel_orphan_records extends tx_lowlevel_cleaner_core
- *   63:     function tx_lowlevel_orphan_records()
- *   96:     function main()
- *  151:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 3
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-/**
- * Looking for Orphan Records
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_orphan_records extends tx_lowlevel_cleaner_core {
-
-       /**
-        * Constructor
-        *
-        * @return      [type]          ...
-        */
-       function tx_lowlevel_orphan_records()   {
-               parent::tx_lowlevel_cleaner_core();
-
-                       // Setting up help:
-               $this->cli_options[] = array('--echotree level', 'When "level" is set to 1 or higher you will see the page of the page tree outputted as it is traversed. A value of 2 for "level" will show even more information.');
-               $this->cli_help['name'] = 'orphan_records -- To find records that has lost their connection with the page tree';
-               $this->cli_help['description'] = trim('
-Assumptions:
-- That all actively used records on the website from TCA configured tables are located in the page tree exclusively.
-
-All records managed by TYPO3 via the TCA array configuration has to belong to a page in the page tree, either directly or indirectly as a version of another record.
-VERY TIME, CPU and MEMORY intensive operation since the full page tree is looked up!
-
-Automatic Repair of Errors:
-- Silently deleting the orphaned records. In theory they should not be used anywhere in the system, but there could be references. See below for more details on this matter.
-
-Manual repair suggestions:
-- Possibly re-connect orphaned records to page tree by setting their "pid" field to a valid page id. A lookup in the sys_refindex table can reveal if there are references to a orphaned record. If there are such references (from records that are not themselves orphans) you might consider to re-connect the record to the page tree, otherwise it should be safe to delete it.
-');
-               $this->cli_help['todo'] = trim('
-- Implement a check for references to orphaned records and if a reference comes from a record that is not orphaned itself, we might rather like to re-connect the record to the page tree.
-- Implement that orphans can be fixed by setting the PID to a certain page instead of deleting.');
-
-               $this->cli_help['examples'] = '/.../cli_dispatch.phpsh lowlevel_cleaner orphan_records -s -r
-Will report orphan uids from TCA tables.';
-       }
-
-       /**
-        * Find orphan records
-        * VERY CPU and memory intensive since it will look up the whole page tree!
-        *
-        * @return      array
-        */
-       function main() {
-               global $TYPO3_DB;
-
-                       // Initialize result array:
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'orphans' => array('Index of orphaned records','',3),
-                               'misplaced_at_rootlevel' => array('Records that should not be at root level but are.','Fix manually by moving record into page tree',2),
-                               'misplaced_inside_tree' => array('Records that should be at root level but are not.','Fix manually by moving record to tree root',2),
-                               'illegal_record_under_versioned_page' => array('Records that cannot be attached to a versioned page','(Listed under orphaned records so is fixed along with orphans.)',2),
-                       ),
-                       'orphans' => array(),
-                       'misplaced_at_rootlevel' => array(),                            // Subset of "all": Those that should not be at root level but are. [Warning: Fix by moving record into page tree]
-                       'misplaced_inside_tree' => array(),                                     // Subset of "all": Those that are inside page tree but should be at root level [Warning: Fix by setting PID to zero]
-                       'illegal_record_under_versioned_page' => array(),
-               );
-
-               $startingPoint = 0;     // zero = tree root, must use tree root if you wish to reverse selection to find orphans!
-               $pt = t3lib_div::milliseconds();
-
-               $this->genTree($startingPoint,1000,(int)$this->cli_argValue('--echotree'));
-
-               $resultArray['misplaced_at_rootlevel'] = $this->recStats['misplaced_at_rootlevel'];
-               $resultArray['misplaced_inside_tree'] = $this->recStats['misplaced_inside_tree'];
-               $resultArray['illegal_record_under_versioned_page'] = $this->recStats['illegal_record_under_versioned_page'];
-
-                       // Find orphans:
-               foreach($GLOBALS['TCA'] as $tableName => $cfg)  {
-
-                       $idList = is_array($this->recStats['all'][$tableName]) && count($this->recStats['all'][$tableName]) ? implode(',',$this->recStats['all'][$tableName]) : 0;
-
-                               // Select all records belonging to page:
-                       $orphanRecords =        array_keys($GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                                                                       'uid',
-                                                                       $tableName,
-                                                                       'uid NOT IN ('.$idList.')',
-                                                                       '','','','uid'
-                                                               ));
-
-                       if (count($orphanRecords))      {
-                               $resultArray['orphans'][$tableName] = implode(',',$orphanRecords);
-                       }
-               }
-
-               return $resultArray;
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-
-                       // Putting "pages" table in the bottom:
-               if (isset($resultArray['orphans']['pages']))    {
-                       $_pages = $resultArray['orphans']['pages'];
-                       unset($resultArray['orphans']['pages']);
-                       $resultArray['orphans']['pages'] = $_pages;
-               }
-
-                       // Traversing records:
-               foreach($resultArray['orphans'] as $table => $list)     {
-                       echo 'Removing orphans from table "'.$table.'":'.chr(10);
-                       $list = explode(',',$list);
-                       foreach($list as $uid)  {
-                               echo '  Flushing orphan record "'.$table.':'.$uid.'": ';
-                               if ($bypass = $this->cli_noExecutionCheck($table.':'.$uid))     {
-                                       echo $bypass;
-                               } else {
-
-                                               // Execute CMD array:
-                                       $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                                       $tce->stripslashes_values = FALSE;
-                                       $tce->start(array(),array());
-                                       $tce->deleteRecord($table,$uid, TRUE, TRUE);    // Notice, we are deleting pages with no regard to subpages/subrecords - we do this since they should also be included in the set of orphans of course!
-
-                                               // Return errors if any:
-                                       if (count($tce->errorLog))      {
-                                               echo '  ERROR from "TCEmain":'.chr(10).'TCEmain:'.implode(chr(10).'TCEmain:',$tce->errorLog);
-                                       } else echo 'DONE';
-                               }
-                               echo chr(10);
-                       }
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.rte_images.php b/typo3/sysext/lowlevel/clmods/clmods/class.rte_images.php
deleted file mode 100644 (file)
index 5fcf15c..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: RTE magicc images
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   56: class tx_lowlevel_rte_images extends tx_lowlevel_cleaner_core
- *   65:     function tx_lowlevel_rte_images()
- *   99:     function main()
- *  181:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 3
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-/**
- * Looking for RTE images integrity
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_rte_images extends tx_lowlevel_cleaner_core {
-
-       var $checkRefIndex = TRUE;
-
-       /**
-        * Constructor
-        *
-        * @return      void
-        */
-       function tx_lowlevel_rte_images()       {
-               parent::tx_lowlevel_cleaner_core();
-
-                       // Setting up help:
-               $this->cli_help['name'] = 'rte_images -- Looking up all occurencies of RTEmagic images in the database and check existence of parent and copy files on the file system plus report possibly lost files of this type.';
-               $this->cli_help['description'] = trim('
-Assumptions:
-- a perfect integrity of the reference index table (always update the reference index table before using this tool!)
-- that all RTEmagic image files in the database are registered with the soft reference parser "images"
-- images found in deleted records are included (means that you might find lost RTEmagic images after flushing deleted records)
-
-The assumptions are not requirements by the TYPO3 API but reflects the de facto implementation of most TYPO3 installations.
-However, many custom fields using an RTE will probably not have the "images" soft reference parser registered and so the index will be incomplete and not listing all RTEmagic image files.
-The consequence of this limitation is that you should be careful if you wish to delete lost RTEmagic images - they could be referenced from a field not parsed by the "images" soft reference parser!
-Another limitation: In theory a RTEmagic image should be used from only one record, however TCEmain does not support this (unfortunately!) so when a record is copied or versioned no new version will be produced. This leads to a usage count of more than one for many RTEmagic images which is also shown in the overview. At this point in time its not considered a bug and there is no fix for it.
-
-Automatic Repair of Errors:
-- There is currently no automatic repair available
-
-Manual repair suggestions:
-- Missing files: Re-insert missing files or edit record where the reference is found.
-- Lost files: Delete them if you do not recognize them as used somewhere the system does not know about.
-');
-
-               $this->cli_help['examples'] = '/.../cli_dispatch.phpsh lowlevel_cleaner rte_images -s -r
-Reports problems with RTE images';
-       }
-
-       /**
-        * Analyse situation with RTE magic images. (still to define what the most useful output is).
-        * Fix methods: API in t3lib_refindex that allows to change the value of a reference (we could copy the files) or remove reference
-        *
-        * @return      array
-        */
-       function main() {
-                       global $TYPO3_DB;
-
-                       // Initialize result array:
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'completeFileList' => array('Complete list of used RTEmagic files','Both parent and copy are listed here including usage count (which should in theory all be "1"). This list does not exclude files that might be missing.',1),
-                               'RTEmagicFilePairs' => array('Statistical info about RTEmagic files','(copy used as index)',0),
-                               'missingFiles' => array('Missing RTEmagic image files','These files are not found in the file system! Should be corrected!',3),
-                               'lostFiles' => array('Lost RTEmagic files from uploads/','These files you might be able to delete but only if _all_ RTEmagic images are found by the soft reference parser. If you are using the RTE in third-party extensions it is likely that the soft reference parser is not applied correctly to their RTE and thus these "lost" files actually represent valid RTEmagic images, just not registered.',2),
-                               'warnings' => array('Warnings picked up','',2)
-                       ),
-                       'RTEmagicFilePairs' => array(),
-                       'completeFileList' => array(),
-                       'missingFiles' => array(),
-                       'lostFiles' => array(),
-                       'warnings' => array()
-               );
-
-                       // Select all RTEmagic files in the reference table (only from soft references of course)
-               $recs = $TYPO3_DB->exec_SELECTgetRows(
-                       '*',
-                       'sys_refindex',
-                       'ref_table='.$TYPO3_DB->fullQuoteStr('_FILE', 'sys_refindex').
-                               ' AND ref_string LIKE '.$TYPO3_DB->fullQuoteStr('%/RTEmagic%', 'sys_refindex').
-                               ' AND softref_key='.$TYPO3_DB->fullQuoteStr('images', 'sys_refindex'),
-                       '',
-                       'sorting DESC'
-               );
-
-                       // Traverse the files and put into a large table:
-               if (is_array($recs)) {
-                       foreach($recs as $rec)  {
-                               $filename = basename($rec['ref_string']);
-                               if (t3lib_div::isFirstPartOfStr($filename,'RTEmagicC_'))        {
-                                       $original = 'RTEmagicP_'.ereg_replace('\.[[:alnum:]]+$','',substr($filename,10));
-                                       $infoString = $this->infoStr($rec);
-
-                                               // Build index:
-                                       $resultArray['RTEmagicFilePairs'][$rec['ref_string']]['exists'] = @is_file(PATH_site.$rec['ref_string']);
-                                       $resultArray['RTEmagicFilePairs'][$rec['ref_string']]['original'] = substr($rec['ref_string'],0,-strlen($filename)).$original;
-                                       $resultArray['RTEmagicFilePairs'][$rec['ref_string']]['original_exists'] = @is_file(PATH_site.$resultArray['RTEmagicFilePairs'][$rec['ref_string']]['original']);
-                                       $resultArray['RTEmagicFilePairs'][$rec['ref_string']]['count']++;
-                                       $resultArray['RTEmagicFilePairs'][$rec['ref_string']]['usedIn'][$rec['hash']] = $infoString;
-
-                                       $resultArray['completeFileList'][$resultArray['RTEmagicFilePairs'][$rec['ref_string']]['original']]++;
-                                       $resultArray['completeFileList'][$rec['ref_string']]++;
-
-                                               // Missing files:
-                                       if (!$resultArray['RTEmagicFilePairs'][$rec['ref_string']]['exists'])   {
-                                               $resultArray['missingFiles'][$rec['ref_string']] = $resultArray['RTEmagicFilePairs'][$rec['ref_string']]['usedIn'];
-                                       }
-                                       if (!$resultArray['RTEmagicFilePairs'][$rec['ref_string']]['original_exists'])  {
-                                               $resultArray['missingFiles'][$resultArray['RTEmagicFilePairs'][$rec['ref_string']]['original']] = $resultArray['RTEmagicFilePairs'][$rec['ref_string']]['usedIn'];
-                                       }
-                               }
-                       }
-               }
-
-                       // Now, ask for RTEmagic files inside uploads/ folder:
-               $cleanerModules = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lowlevel']['cleanerModules'];
-               $cleanerMode = &t3lib_div::getUserObj($cleanerModules['lost_files'][0]);
-               $resLostFiles = $cleanerMode->main(array(),FALSE,TRUE);
-               if (is_array($resLostFiles['RTEmagicFiles']))   {
-                       foreach($resLostFiles['RTEmagicFiles'] as $fileName) {
-                               if (!isset($resultArray['completeFileList'][$fileName]))        {
-                                       $resultArray['lostFiles'][] = $fileName;
-                               }
-                       }
-               }
-
-               return $resultArray;
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-               echo "There is currently no automatic repair available\n";
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/lowlevel/clmods/clmods/class.versions.php b/typo3/sysext/lowlevel/clmods/clmods/class.versions.php
deleted file mode 100644 (file)
index ed8d49f..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Cleaner module: Versions of records
- * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   56: class tx_lowlevel_versions extends tx_lowlevel_cleaner_core
- *   63:     function tx_lowlevel_versions()
- *   88:     function main()
- *  122:     function main_autoFix($resultArray)
- *
- * TOTAL FUNCTIONS: 3
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
-
-
-/**
- * Looking for versions of records
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class tx_lowlevel_versions extends tx_lowlevel_cleaner_core {
-
-       /**
-        * Constructor
-        *
-        * @return      void
-        */
-       function tx_lowlevel_versions() {
-               parent::tx_lowlevel_cleaner_core();
-
-                       // Setting up help:
-               $this->cli_options[] = array('--echotree level', 'When "level" is set to 1 or higher you will see the page of the page tree outputted as it is traversed. A value of 2 for "level" will show even more information.');
-               $this->cli_options[] = array('--pid id', 'Setting start page in page tree. Default is the page tree root, 0 (zero)');
-               $this->cli_options[] = array('--depth int', 'Setting traversal depth. 0 (zero) will only analyse start page (see --pid), 1 will traverse one level of subpages etc.');
-               
-               $this->cli_options[] = array('--flush-live', 'If set, not only published versions from Live workspace are flushed, but ALL versions from Live workspace (which are offline of course)');
-
-               $this->cli_help['name'] = 'versions -- To find information about versions and workspaces in the system';
-               $this->cli_help['description'] = trim('
-Traversing page tree and finding versions, categorizing them by various properties.
-Published versions from the Live workspace are registered. So are all offline versions from Live workspace in general. Further, versions in non-existing workspaces are found.
-
-Automatic Repair:
-- Deleting (completely) published versions from LIVE workspace OR _all_ offline versions from Live workspace (toogle by --flush-live)
-- Resetting workspace for versions where workspace is deleted. (You might want to run this tool again after this operation to clean out those new elements in the Live workspace)
-- Deleting unused placeholders
-');
-
-               $this->cli_help['examples'] = '';
-       }
-
-       /**
-        * Find orphan records
-        * VERY CPU and memory intensive since it will look up the whole page tree!
-        *
-        * @return      array
-        */
-       function main() {
-               global $TYPO3_DB;
-
-                       // Initialize result array:
-               $resultArray = array(
-                       'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
-                       'headers' => array(
-                               'versions' => array('All versions','Showing all versions of records found',0),
-                               'versions_published' => array('All published versions','This is all records that has been published and can therefore be removed permanently',1),
-                               'versions_liveWS' => array('All versions in Live workspace','This is all records that are offline versions in the Live workspace. You may wish to flush these if you only use workspaces for versioning since then you might find lots of versions piling up in the live workspace which have simply been disconnected from the workspace before they were published.',1),
-                               'versions_lost_workspace' => array('Versions outside a workspace','Versions that has lost their connection to a workspace in TYPO3.',3),
-                               'versions_inside_versioned_page' => array('Versions in versions','Versions inside an already versioned page. Something that is confusing to users and therefore should not happen but is technically possible.',2),
-                               'versions_unused_placeholders' => array('Unused placeholder records','Placeholder records which are not used anymore by offline versions.',2)
-                       ),
-                       'versions' => array(),
-               );
-
-               $startingPoint = $this->cli_isArg('--pid') ? t3lib_div::intInRange($this->cli_argValue('--pid'),0) : 0;
-               $depth = $this->cli_isArg('--depth') ? t3lib_div::intInRange($this->cli_argValue('--depth'),0) : 1000;
-               $this->genTree($startingPoint,$depth,(int)$this->cli_argValue('--echotree'));
-
-               $resultArray['versions'] = $this->recStats['versions'];
-               $resultArray['versions_published'] = $this->recStats['versions_published'];
-               $resultArray['versions_liveWS'] = $this->recStats['versions_liveWS'];
-               $resultArray['versions_lost_workspace'] = $this->recStats['versions_lost_workspace'];
-               $resultArray['versions_inside_versioned_page'] = $this->recStats['versions_inside_versioned_page'];
-
-                       // Finding all placeholders with no records attached!
-               $resultArray['versions_unused_placeholders'] = array(); 
-               foreach($GLOBALS['TCA'] as $table => $cfg)      {
-                       if ($cfg['ctrl']['versioningWS'])       {
-                               $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid',$table,'t3ver_state=1 AND pid>=0'.t3lib_BEfunc::deleteClause($table));
-                               foreach($placeHolders as $phrec)        {
-                                       if (count(t3lib_BEfunc::selectVersionsOfRecord($table, $phrec['uid'], 'uid'))<=1)       {
-                                               $resultArray['versions_unused_placeholders'][] = $table.':'.$phrec['uid']; 
-                                       }
-                               }
-                       }
-               }
-
-               return $resultArray;
-       }
-
-       /**
-        * Mandatory autofix function
-        * Will run auto-fix on the result array. Echos status during processing.
-        *
-        * @param       array           Result array from main() function
-        * @return      void
-        */
-       function main_autoFix($resultArray)     {
-
-               $kk = $this->cli_isArg('--flush-live') ? 'versions_liveWS' : 'versions_published';
-
-                       // Putting "pages" table in the bottom:
-               if (isset($resultArray[$kk]['pages']))  {
-                       $_pages = $resultArray[$kk]['pages'];
-                       unset($resultArray[$kk]['pages']);
-                       $resultArray[$kk]['pages'] = $_pages;
-               }
-
-                       // Traversing records:
-               foreach($resultArray[$kk] as $table => $list)   {
-                       echo 'Flushing published records from table "'.$table.'":'.chr(10);
-                       foreach($list as $uid)  {
-                               echo '  Flushing record "'.$table.':'.$uid.'": ';
-
-                               if ($bypass = $this->cli_noExecutionCheck($table.':'.$uid))     {
-                                       echo $bypass;
-                               } else {
-
-                                               // Execute CMD array:
-                                       $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                                       $tce->stripslashes_values = FALSE;
-                                       $tce->start(array(),array());
-                                       $tce->deleteEl($table,$uid, TRUE, TRUE);
-
-                                               // Return errors if any:
-                                       if (count($tce->errorLog))      {
-                                               echo '  ERROR from "TCEmain":'.chr(10).'TCEmain:'.implode(chr(10).'TCEmain:',$tce->errorLog);
-                                       } else echo 'DONE';
-                               }
-                               echo chr(10);
-                       }
-               }
-
-                       // Traverse workspace:
-               foreach($resultArray['versions_lost_workspace'] as $table => $list)     {
-                       echo 'Resetting workspace to zero for records from table "'.$table.'":'.chr(10);
-                       foreach($list as $uid)  {
-                               echo '  Flushing record "'.$table.':'.$uid.'": ';
-                               if ($bypass = $this->cli_noExecutionCheck($table.':'.$uid))     {
-                                       echo $bypass;
-                               } else {
-                                       $fields_values = array(
-                                               't3ver_wsid' => 0
-                                       );
-                                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table,'uid='.intval($uid),$fields_values);
-                                       echo 'DONE';
-                               }
-                               echo chr(10);
-                       }
-               }
-               
-                       // Delete unused placeholders
-               foreach($resultArray['versions_unused_placeholders'] as $recID) {
-                       list($table,$uid)       = explode(':',$recID);
-                       echo 'Deleting unused placeholder (soft) "'.$table.':'.$uid.'": ';
-                       if ($bypass = $this->cli_noExecutionCheck($table.':'.$uid))     {
-                               echo $bypass;
-                       } else {
-
-                                       // Execute CMD array:
-                               $tce = t3lib_div::makeInstance('t3lib_TCEmain');
-                               $tce->stripslashes_values = FALSE;
-                               $tce->start(array(),array());
-                               $tce->deleteAction($table, $uid);
-
-                                       // Return errors if any:
-                               if (count($tce->errorLog))      {
-                                       echo '  ERROR from "TCEmain":'.chr(10).'TCEmain:'.implode(chr(10).'TCEmain:',$tce->errorLog);
-                               } else echo 'DONE';                     
-                       }
-                       echo chr(10);
-               }               
-       }
-}
-
-?>
\ No newline at end of file