- Cleaner was updated to sort output - makes better diff-views now.
authorKasper Skårhøj <kasper@typo3.org>
Thu, 31 Jan 2008 21:19:40 +0000 (21:19 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Thu, 31 Jan 2008 21:19:40 +0000 (21:19 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3000 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/lowlevel/clmods/class.cleanflexform.php
typo3/sysext/lowlevel/clmods/class.double_files.php
typo3/sysext/lowlevel/clmods/class.lost_files.php
typo3/sysext/lowlevel/clmods/class.missing_files.php
typo3/sysext/lowlevel/clmods/class.missing_relations.php
typo3/sysext/lowlevel/clmods/class.orphan_records.php
typo3/sysext/lowlevel/clmods/class.rte_images.php
typo3/sysext/lowlevel/clmods/class.syslog.php
typo3/sysext/lowlevel/clmods/class.versions.php

index 3f022bb..97e1301 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2008-01-31  Kasper Sk\8crh¿j <kasper2008@typo3.com>
 
+       * - Cleaner was updated to sort output - makes better diff-views now.
        * - Added feature to configure the TTL for preview links in workspaces.
        * - Added logout button for the preview box in the frontend view when previewing workspaces through preview links.      
        * - Removed copy/cut/pasteafter/delete from context menu of DB mounts. Could lead to confusing scenarios for admin users in workspaces.
index fb74b9f..3cf3405 100644 (file)
@@ -106,6 +106,7 @@ Cleaning XML for FlexForm fields.
 
                $this->genTree($startingPoint,$depth,(int)$this->cli_argValue('--echotree'),'main_parseTreeCallBack');
 
+               asort($resultArray);
                return $resultArray;
        }
 
@@ -135,7 +136,7 @@ Cleaning XML for FlexForm fields.
 
                                        if (md5($recRow[$colName])!=md5($newXML))       {
                                                if ($echoLevel>2)       echo ' was DIRTY, needs cleanup!';
-                                               $this->cleanFlexForm_dirtyFields[] = $tableName.':'.$uid.':'.$colName;
+                                               $this->cleanFlexForm_dirtyFields[t3lib_div::shortMd5($tableName.':'.$uid.':'.$colName)] = $tableName.':'.$uid.':'.$colName;
                                        } else {
                                                if ($echoLevel>2)       echo ' was CLEAN';
                                        }
index 7315c32..5a1c2ce 100644 (file)
@@ -142,6 +142,7 @@ This will check the system for double files relations.';
                                        // Handle missing file:
                                if (!@is_file(PATH_site.$rec['ref_string']))    {
                                        $resultArray['missingFiles'][$rec['ref_string']][$rec['hash']] = $infoString;
+                                       ksort($resultArray['missingFiles'][$rec['ref_string']]);        // Sort by array key
                                }
 
                                        // Add entry if file has multiple references pointing to it:
@@ -151,11 +152,15 @@ This will check the system for double files relations.';
                                                $resultArray['multipleReferencesList'][$rec['ref_string']][$tempCount[$rec['ref_string']][1]] = $tempCount[$rec['ref_string']][0];
                                        }
                                        $resultArray['multipleReferencesList'][$rec['ref_string']][$rec['hash']] = $infoString;
+                                       ksort($resultArray['multipleReferencesList'][$rec['ref_string']]);
                                } else {
                                        $tempCount[$rec['ref_string']] = array($infoString,$rec['hash']);
                                }
                        }
                }
+               
+               ksort($resultArray['missingFiles']);
+               ksort($resultArray['multipleReferencesList']);
 
                        // Add count for multi-references:
                $resultArray['multipleReferencesList_count']['count'] = count($resultArray['multipleReferencesList']);
@@ -164,8 +169,9 @@ This will check the system for double files relations.';
                        // Sort dirname registry and add warnings for directories outside uploads/
                ksort($resultArray['dirname_registry']);
                foreach($resultArray['dirname_registry'] as $dir => $temp)      {
+                       ksort($resultArray['dirname_registry'][$dir]);
                        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));
+                               $resultArray['warnings'][t3lib_div::shortmd5($dir)] = '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));
                        }
                }
 
index 0b8ab74..2277bdc 100644 (file)
@@ -138,12 +138,14 @@ Will report lost files.';
                                        $include = FALSE;
                                }
                        }
+                       
+                       $shortKey = t3lib_div::shortmd5($value);
                                
                        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;
+                                       $resultArray['ignoredFiles'][$shortKey] = $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(
@@ -159,25 +161,31 @@ Will report lost files.';
                                                // If found, unset entry:
                                        if (count($recs))               {
                                                unset($fileArr[$key])   ;
-                                               $resultArray['managedFiles'][] = $value;
+                                               $resultArray['managedFiles'][$shortKey] = $value;
                                                if (count($recs)>1)     {
-                                                       $resultArray['warnings'][]='Warning: File "'.$value.'" had '.count($recs).' references from group-fields, should have only one!';
+                                                       $resultArray['warnings'][$shortKey] = '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;
+                                                       $resultArray['RTEmagicFiles'][$shortKey] = $value;
                                                } else {
                                                                // We conclude that the file is lost...:
                                                        unset($fileArr[$key])   ;
-                                                       $resultArray['lostFiles'][] = $value;
+                                                       $resultArray['lostFiles'][$shortKey] = $value;
                                                }
                                        }
                                }
                        }
                }
 
+               asort($resultArray['ignoredFiles']);
+               asort($resultArray['managedFiles']);
+               asort($resultArray['RTEmagicFiles']);
+               asort($resultArray['lostFiles']);
+               asort($resultArray['warnings']);
+
                // $fileArr variable should now be empty with all contents transferred to the result array keys.
 
 
index e31fa21..d3ca32f 100644 (file)
@@ -137,9 +137,13 @@ This will show you missing files in the TYPO3 system and only report back if err
                                        }
 
                                        $resultArray[$resultArrayIndex][$rec['ref_string']][$rec['hash']] = $infoString;
+                                       ksort($resultArray[$resultArrayIndex][$rec['ref_string']]);     // Sort by array key.
                                }
                        }
                }
+               
+               ksort($resultArray['managedFilesMissing']);
+               ksort($resultArray['softrefFilesMissing']);
 
                return $resultArray;
        }
index 893d6aa..cd03c87 100644 (file)
@@ -151,15 +151,25 @@ Reports missing relations';
                                if ($tempExists[$idx]['uid'])   {
                                        if ($tempExists[$idx]['pid']==-1)       {
                                                $resultArray['offlineVersionRecords'.$suffix][$idx][$rec['hash']] = $infoString;
+                                               ksort($resultArray['offlineVersionRecords'.$suffix][$idx]);
                                        } elseif ($GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete'] && $tempExists[$idx][$GLOBALS['TCA'][$rec['ref_table']]['ctrl']['delete']])      {
                                                $resultArray['deletedRecords'.$suffix][$idx][$rec['hash']] = $infoString;
+                                               ksort($resultArray['deletedRecords'.$suffix][$idx]);
                                        }
                                } else {
                                        $resultArray['nonExistingRecords'.$suffix][$idx][$rec['hash']] = $infoString;
+                                       ksort($resultArray['nonExistingRecords'.$suffix][$idx]);
                                }
                        }
                }
 
+               ksort($resultArray['offlineVersionRecords_m']);
+               ksort($resultArray['deletedRecords_m']);
+               ksort($resultArray['nonExistingRecords_m']);
+               ksort($resultArray['offlineVersionRecords_s']);
+               ksort($resultArray['deletedRecords_s']);
+               ksort($resultArray['nonExistingRecords_s']);
+
                return $resultArray;
        }
 
index 8c3a968..eccd520 100644 (file)
@@ -126,15 +126,18 @@ Will report orphan uids from TCA tables.';
                        $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(
+                       $orphanRecords =        $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                                                                        'uid',
                                                                        $tableName,
                                                                        'uid NOT IN ('.$idList.')',
-                                                                       '','','','uid'
-                                                               ));
+                                                                       '','uid','','uid'
+                                                               );
 
                        if (count($orphanRecords))      {
-                               $resultArray['orphans'][$tableName] = implode(',',$orphanRecords);
+                               $resultArray['orphans'][$tableName] = array();
+                               foreach($orphanRecords as $oR)  {
+                                       $resultArray['orphans'][$tableName][$oR['uid']] = $oR['uid'];
+                               }
                        }
                }
 
@@ -160,7 +163,6 @@ Will report orphan uids from TCA tables.';
                        // 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))     {
index ffe2a66..9c6aa11 100644 (file)
@@ -111,14 +111,12 @@ Reports problems with RTE images';
                                'doubleFiles' => array('Duplicate RTEmagic image files','These files are RTEmagic images found used in multiple records! RTEmagic images should be used by only one record at a time. A large amount of such images probably stems from previous versions of TYPO3 (before 4.2) which did not support making copies automatically of RTEmagic images in case of new copies / versions.',3),
                                '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. Lost files can be auto-fixed but only if you specifically set "lostFiles" as parameter to the --AUTOFIX option.',2),
-                               'warnings' => array('Warnings picked up','',2)
                        ),
                        'RTEmagicFilePairs' => array(),
                        'doubleFiles' => array(),
                        'completeFileList' => array(),
                        'missingFiles' => array(),
                        'lostFiles' => array(),
-                       'warnings' => array()
                );
 
                        // Select all RTEmagic files in the reference table (only from soft references of course)
@@ -175,11 +173,17 @@ Reports problems with RTE images';
                if (is_array($resLostFiles['RTEmagicFiles']))   {
                        foreach($resLostFiles['RTEmagicFiles'] as $fileName) {
                                if (!isset($resultArray['completeFileList'][$fileName]))        {
-                                       $resultArray['lostFiles'][] = $fileName;
+                                       $resultArray['lostFiles'][$fileName] = $fileName;
                                }
                        }
                }
 
+
+               ksort($resultArray['RTEmagicFilePairs']);
+               ksort($resultArray['completeFileList']);
+               ksort($resultArray['missingFiles']);
+               ksort($resultArray['doubleFiles']);
+               ksort($resultArray['lostFiles']);
        #       print_r($resultArray);
 
                return $resultArray;
index 752052d..c2347c6 100644 (file)
@@ -99,8 +99,8 @@ Showing last 25 hour entries from the syslog. More features pending. This is the
                foreach($rows as $r)    {
                        $l = unserialize($r['log_data']);
                        $explained = '#'.$r['uid'].' '.t3lib_BEfunc::datetime($r['tstamp']).' USER['.$r['userid'].']: '.sprintf($r['details'],$l[0],$l[1],$l[2],$l[3],$l[4],$l[5]);
-                       $resultArray['listing'][] = $explained;
-                       $resultArray['allDetails'][] = array($explained,t3lib_div::arrayToLogString($r,'uid,userid,action,recuid,tablename,recpid,error,tstamp,type,details_nr,IP,event_pid,NEWid,workspace'));
+                       $resultArray['listing'][$r['uid']] = $explained;
+                       $resultArray['allDetails'][$r['uid']] = array($explained,t3lib_div::arrayToLogString($r,'uid,userid,action,recuid,tablename,recpid,error,tstamp,type,details_nr,IP,event_pid,NEWid,workspace'));
                }
 
                return $resultArray;
index 47e1a5b..99b5ea5 100644 (file)
@@ -127,11 +127,12 @@ Automatic Repair:
                                $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']; 
+                                               $resultArray['versions_unused_placeholders'][t3lib_div::shortmd5($table.':'.$phrec['uid'])] = $table.':'.$phrec['uid']; 
                                        }
                                }
                        }
                }
+               asort($resultArray['versions_unused_placeholders']);
 
                        // Finding all move placeholders with inconsistencies:
                $resultArray['versions_move_placeholders_ok'] = array(); 
@@ -140,14 +141,15 @@ Automatic Repair:
                        if ((int)$cfg['ctrl']['versioningWS']>=2)       {
                                $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid,t3ver_move_id,t3ver_wsid,t3ver_state',$table,'t3ver_state=3 AND pid>=0'.t3lib_BEfunc::deleteClause($table));
                                foreach($placeHolders as $phrec)        {
+                                       $shortID = t3lib_div::shortmd5($table.':'.$phrec['uid']);
                                        if ((int)$phrec['t3ver_wsid']!=0)       {
                                                $phrecCopy = $phrec;
                                                if (t3lib_BEfunc::movePlhOL($table,$phrec))     {
                                                        if ($wsAlt = t3lib_BEfunc::getWorkspaceVersionOfRecord($phrecCopy['t3ver_wsid'], $table, $phrec['uid'], 'uid,pid,t3ver_state')) {
                                                                if ($wsAlt['t3ver_state']!=4)   {
-                                                                       $resultArray['versions_move_placeholders_bad'][] = array($table.':'.$phrec['uid'],'State for version was not "4" as it should be!',$phrecCopy); 
+                                                                       $resultArray['versions_move_placeholders_bad'][$shortID] = array($table.':'.$phrec['uid'],'State for version was not "4" as it should be!',$phrecCopy); 
                                                                } else {
-                                                                       $resultArray['versions_move_placeholders_ok'][] = array(
+                                                                       $resultArray['versions_move_placeholders_ok'][$shortID] = array(
                                                                                $table.':'.$phrec['uid'],
                                                                                'PLH' => $phrecCopy,
                                                                                'online' => $phrec,
@@ -155,18 +157,21 @@ Automatic Repair:
                                                                        ); 
                                                                }
                                                        } else {
-                                                               $resultArray['versions_move_placeholders_bad'][] = array($table.':'.$phrec['uid'],'No version was found for online record to be moved. A version must exist.',$phrecCopy); 
+                                                               $resultArray['versions_move_placeholders_bad'][$shortID] = array($table.':'.$phrec['uid'],'No version was found for online record to be moved. A version must exist.',$phrecCopy); 
                                                        }
                                                } else {
-                                                       $resultArray['versions_move_placeholders_bad'][] = array($table.':'.$phrec['uid'],'Did not find online record for "t3ver_move_id" value '.$phrec['t3ver_move_id'],$phrec); 
+                                                       $resultArray['versions_move_placeholders_bad'][$shortID] = array($table.':'.$phrec['uid'],'Did not find online record for "t3ver_move_id" value '.$phrec['t3ver_move_id'],$phrec); 
                                                }
                                        } else {
-                                               $resultArray['versions_move_placeholders_bad'][] = array($table.':'.$phrec['uid'],'Placeholder was not assigned a workspace value in t3ver_wsid.',$phrec); 
+                                               $resultArray['versions_move_placeholders_bad'][$shortID] = array($table.':'.$phrec['uid'],'Placeholder was not assigned a workspace value in t3ver_wsid.',$phrec); 
                                        }
                                }
                        }
                }
 
+               ksort($resultArray['versions_move_placeholders_ok']); 
+               ksort($resultArray['versions_move_placeholders_bad']); 
+
                        // Finding move_id_check inconsistencies:
                $resultArray['versions_move_id_check'] = array(); 
                foreach($GLOBALS['TCA'] as $table => $cfg)      {