Reverting a change because it was made in the wrong branch.
authorMichael Stucki <michael.stucki@typo3.org>
Wed, 18 Jan 2006 09:44:07 +0000 (09:44 +0000)
committerMichael Stucki <michael.stucki@typo3.org>
Wed, 18 Jan 2006 09:44:07 +0000 (09:44 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1016 709f56b5-9817-0410-a4d7-c38de5d9e867

TODO.txt
t3lib/class.t3lib_refindex.php
typo3/sysext/lowlevel/config/index.php
typo3/sysext/lowlevel/dbint/cli/conf.php [deleted file]
typo3/sysext/lowlevel/dbint/cli/refindex_cli.phpsh [deleted file]
typo3/sysext/lowlevel/dbint/index.php
typo3/sysext/lowlevel/dbint/locallang.xml [deleted file]
typo3/sysext/lowlevel/ext_emconf.php

index a48481d..ac64d77 100755 (executable)
--- a/TODO.txt
+++ b/TODO.txt
@@ -48,7 +48,7 @@ TCEmain
                - Implement flexform "index" as well (see marks
                - In "Help > About Modules" screen we might want to look if the index is empty and if so, present a link to "Tools > DB check" tool so the index can be created initially for updated sites?
                - (Make class.t3lib_refindex available in the frontend scope for integration in plugins that manipulate the database on their own and need to update the reference index. Actually, I'm inclined to think we should rather think about how to provide t3lib_tcemain for the frontend instead...!)
-               - CLI script for updating refindex with cron-job [OK] and reporting inconsistencies by email
+               - CLI script for updating refindex with cron-job and reporting inconsistencies by email
        - Record clean-up functionality (Tools > DB check module)
                - Remove references to deleted records (also deleted-to-recycler records? Maybe "deleted-to-recycler" references are important to remove in order to make sure "recycler" records are not selected!) (refs to MM for both tables/files)
                - Remove references to lost files etc.
index a133fd9..d5991ed 100755 (executable)
@@ -610,76 +610,6 @@ class t3lib_refindex {
        function error($msg)    {
                $this->errorLog[]=$msg;
        }
-       
-       
-       
-       
-       
-       
-       function updateIndex($testOnly,$cli_echo=FALSE) {
-               global $TCA, $TYPO3_DB;
-               
-               $errors = array();
-               $tableNames = array();
-               $recCount=0;
-               $tableCount=0;
-
-               $headerContent = $testOnly ? 'Reference Index TESTED (nothing written)' : 'Reference Index Updated';
-               if ($cli_echo) echo 
-                                               '*******************************************'.chr(10).
-                                               $headerContent.chr(10).
-                                               '*******************************************'.chr(10); 
-               
-                       // Traverse all tables:
-               foreach($TCA as $tableName => $cfg)     {
-                       $tableNames[] = $tableName;
-                       $tableCount++;
-
-                               // Traverse all non-deleted records in tables:
-                       $allRecs = $TYPO3_DB->exec_SELECTgetRows('uid',$tableName,'1'.t3lib_BEfunc::deleteClause($tableName));
-                       $uidList = array(0);
-                       foreach($allRecs as $recdat)    {
-                               $refIndexObj = t3lib_div::makeInstance('t3lib_refindex');
-                               $result = $refIndexObj->updateRefIndexTable($tableName,$recdat['uid'],$testOnly);
-                               $uidList[]= $recdat['uid'];
-                               $recCount++;
-
-                               if ($result['addedNodes'] || $result['deletedNodes'])   {
-                                       $Err = 'Record '.$tableName.':'.$recdat['uid'].' had '.$result['addedNodes'].' added indexes and '.$result['deletedNodes'].' deleted indexes';
-                                       $errors[]= $Err; 
-                                       if ($cli_echo) echo $Err.chr(10);
-                                       #$errors[] = t3lib_div::view_array($result);
-                               }
-                       }
-
-                               // Searching lost indexes for this table:
-                       $where = 'tablename='.$TYPO3_DB->fullQuoteStr($tableName,'sys_refindex').' AND recuid NOT IN ('.implode(',',$uidList).')';
-                       $lostIndexes = $TYPO3_DB->exec_SELECTgetRows('hash','sys_refindex',$where);
-                       if (count($lostIndexes))        {
-                               $Err = 'Table '.$tableName.' has '.count($lostIndexes).' lost indexes which are now deleted';
-                               $errors[]= $Err;
-                               if ($cli_echo) echo $Err.chr(10);
-                               if (!$testOnly) $TYPO3_DB->exec_DELETEquery('sys_refindex',$where);
-                       }
-               }
-
-                       // Searching lost indexes for non-existing tables:
-               $where = 'tablename NOT IN ('.implode(',',$TYPO3_DB->fullQuoteArray($tableNames,'sys_refindex')).')';
-               $lostTables = $TYPO3_DB->exec_SELECTgetRows('hash','sys_refindex',$where);
-               if (count($lostTables)) {
-                       $Err = 'Index table hosted '.count($lostTables).' indexes for non-existing tables, now removed';
-                       $errors[]= $Err;
-                       if ($cli_echo) echo $Err.chr(10);
-                       if (!$testOnly) $TYPO3_DB->exec_DELETEquery('sys_refindex',$where);
-               }
-
-               $testedHowMuch = $recCount.' records from '.$tableCount.' tables were checked/updated.'.chr(10);
-               
-               $bodyContent = $testedHowMuch.(count($errors)?implode(chr(10),$errors):'Index Integrity was perfect!');
-               if ($cli_echo) echo $testedHowMuch.(count($errors)?'Updates: '.count($errors):'Index Integrity was perfect!').chr(10);
-                               
-               return array($headerContent,$bodyContent);
-       }
 }
 
 
index fc02709..76f163c 100755 (executable)
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 /**
- * Module: Config
+ * Module: Log-viewing
  *
- * This module lets you view the config variables around TYPO3.
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   72: class SC_mod_tools_config_index
- *   89:     function init()
- *  103:     function jumpToUrl(URL)
- *  117:     function menuConfig()
- *  144:     function main()
- *  268:     function printContent()
- *
- * TOTAL FUNCTIONS: 5
- * (This index is automatically created/updated by the extension "extdeveval")
+ * This module lets you view the changelog.
  *
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 
+
 unset($MCONF);
-require ('conf.php');
-require ($BACK_PATH.'init.php');
-require ($BACK_PATH.'template.php');
-require_once (PATH_t3lib.'class.t3lib_arraybrowser.php');
+require ("conf.php");
+require ($BACK_PATH."init.php");
+require ($BACK_PATH."template.php");
+require_once (PATH_t3lib."class.t3lib_arraybrowser.php");
 
 $BE_USER->modAccess($MCONF,1);
 
@@ -62,40 +47,26 @@ $BE_USER->modAccess($MCONF,1);
 
 
 
-/**
- * Script class for the Config module
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
+// ***************************
+// Script Classes
+// ***************************
 class SC_mod_tools_config_index {
-
-       var $MCONF = array();
-       var $MOD_MENU = array();
-       var $MOD_SETTINGS = array();
+       var $MCONF=array();
+       var $MOD_MENU=array();
+       var $MOD_SETTINGS=array();
        var $doc;
 
-       var $include_once = array();
+       var $include_once=array();
        var $content;
 
-
-
-       /**
-        * Initialization
-        *
-        * @return      void
-        */
        function init() {
-               global $BACK_PATH;
-
-               $this->MCONF = $GLOBALS['MCONF'];
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
+               $this->MCONF = $GLOBALS["MCONF"];
 
                $this->menuConfig();
 
-               $this->doc = t3lib_div::makeInstance('noDoc');
+               $this->doc = t3lib_div::makeInstance("noDoc");
                $this->doc->backPath = $BACK_PATH;
-
                                // JavaScript
                $this->doc->JScode = '
                <script language="javascript" type="text/javascript">
@@ -106,175 +77,161 @@ class SC_mod_tools_config_index {
                </script>
                ';
 
-               $this->doc->form = '<form action="" method="post">';
+               $this->doc->form = '<form action="" method="POST">';
        }
-
-       /**
-        * Menu Configuration
-        *
-        * @return      void
-        */
        function menuConfig()   {
-               global $TYPO3_CONF_VARS;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
                        // MENU-ITEMS:
                        // If array, then it's a selector box menu
                        // If empty string it's just a variable, that'll be saved.
                        // Values NOT in this array will not be saved in the settings-array for the module.
                $this->MOD_MENU = array(
-                       'function' => array(
+                       "function" => array(
                                0 => '$TYPO3_CONF_VARS',
                                1 => '$TCA (tables.php)',
                                3 => '$TYPO3_LOADED_EXT',
                                4 => '$TBE_STYLES',
+
+       //                      2 => '$PAGES_TYPES (tables.php)'
                        ),
-                       'regexsearch' => '',
-                       'fixedLgd' => ''
+                       "regexsearch" => "",
+                       "fixedLgd" => ""
                );
 
                        // CLEANSE SETTINGS
-               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
+               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP("SET"), $this->MCONF["name"]);
        }
-
-       /**
-        * [Describe function...]
-        *
-        * @return      [type]          ...
-        */
        function main() {
-               global $BE_USER,$LANG,$TCA,$TYPO3_CONF_VARS;
-
-               $this->content.= $this->doc->startPage('Configuration');
-               $this->content.= $this->doc->header('Configuration');
-               $this->content.= $this->doc->spacer(5);
-
-               $arrayBrowser = t3lib_div::makeInstance('t3lib_arrayBrowser');
-
-               $menu = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.menu').' '.t3lib_BEfunc::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function']).
-                                       '&nbsp;&nbsp;Crop lines:&nbsp;&nbsp;'.t3lib_BEfunc::getFuncCheck(0,'SET[fixedLgd]',$this->MOD_SETTINGS['fixedLgd']);
-               $this->content.=$this->doc->section('','<nobr>'.$menu.'</nobr>');
-
-               switch($this->MOD_SETTINGS['function']) {
-                       case 0:
-                               $theVar = $TYPO3_CONF_VARS;
-                               $arrayBrowser->varName = '$TYPO3_CONF_VARS';
-                       break;
-                       case 1:
-                               reset($TCA);
-                               while(list($ttable) =each($TCA))        {
-                                       t3lib_div::loadTCA($ttable);
-                               }
-                               $theVar = $TCA;
-                               $arrayBrowser->varName = '$TCA';
-                       break;
-                       case 3:
-                               $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
-                               $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
-                       break;
-                       case 4:
-                               $theVar = $GLOBALS['TBE_STYLES'];
-                               $arrayBrowser->varName = '$TBE_STYLES';
-                       break;
-                       default:
-                               $theVar = array();
-                       break;
-               }
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
+
+               $this->content.=$this->doc->startPage("Configuration");
+               $this->content.=$this->doc->header("Configuration");
+               $this->content.=$this->doc->spacer(5);
+
+                       $arrayBrowser = t3lib_div::makeInstance("t3lib_arrayBrowser");
+
+                       $menu = $LANG->sL("LLL:EXT:lang/locallang_core.php:labels.menu")." ".t3lib_BEfunc::getFuncMenu(0,"SET[function]",$this->MOD_SETTINGS["function"],$this->MOD_MENU["function"]).
+                                               fw("&nbsp;&nbsp;Crop lines:&nbsp;&nbsp;").t3lib_BEfunc::getFuncCheck(0,"SET[fixedLgd]",$this->MOD_SETTINGS["fixedLgd"]);
+                       $this->content.=$this->doc->section("",'<NOBR>'.$menu.'</NOBR>');
+
+                       switch($this->MOD_SETTINGS["function"]) {
+                               case 0:
+                                       $theVar = $TYPO3_CONF_VARS;
+                                       $arrayBrowser->varName = '$TYPO3_CONF_VARS';
+                               break;
+                               case 1:
+                                       reset($TCA);
+                                       while(list($ttable)=each($TCA)) {
+                                               t3lib_div::loadTCA($ttable);
+                                       }
+                                       $theVar = $TCA;
+                                       $arrayBrowser->varName = '$TCA';
+                               break;
+                               case 3:
+                                       $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
+                                       $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
+                               break;
+                               case 4:
+                                       $theVar = $GLOBALS['TBE_STYLES'];
+                                       $arrayBrowser->varName = '$TBE_STYLES';
+                               break;
+                               case 2:
+               //                      $theVar = $PAGES_TYPES;
+                               break;
+                               default:
+                                       $theVar = array();
+                               break;
+                       }
 
 
-                       // Update node:
-               $update = 0;
-               $node = t3lib_div::_GET('node');
-               if (is_array($node))    {               // If any plus-signs were clicked, it's registred.
-                       $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']]);
-                       $update = 1;
-               }
-               if ($update) {
-                       $GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'],$this->MOD_SETTINGS);
-               }
+                               // Update node:
+                       $update = 0;
+                       $node = t3lib_div::_GET('node');
+                       if (is_array($node))    {               // If any plus-signs were clicked, it's registred.
+                               $this->MOD_SETTINGS["node_".$this->MOD_SETTINGS["function"]] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS["node_".$this->MOD_SETTINGS["function"]]);
+                               $update=1;
+                       }
+                       if ($update){   $GLOBALS["BE_USER"]->pushModuleData($this->MCONF["name"],$this->MOD_SETTINGS);}
 
-               $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']];
-               $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
-               $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
+                       $arrayBrowser->depthKeys = $this->MOD_SETTINGS["node_".$this->MOD_SETTINGS["function"]];
+                       $arrayBrowser->regexMode = $this->MOD_SETTINGS["regexsearch"];
+                       $arrayBrowser->fixedLgd = $this->MOD_SETTINGS["fixedLgd"];
 
 
-               $search_field = t3lib_div::_GP('search_field');
-               if (t3lib_div::_POST('search') && trim($search_field))  {               // If any POST-vars are send, update the condition array
-                       $arrayBrowser->depthKeys=$arrayBrowser->getSearchKeys($theVar, '',      $search_field, array());
-               }
+                       $search_field = t3lib_div::_GP("search_field");
+                       if (t3lib_div::_POST("search") && trim($search_field))  {               // If any POST-vars are send, update the condition array
+                               $arrayBrowser->depthKeys=$arrayBrowser->getSearchKeys($theVar, "",      $search_field, array());
+               //              debug($arrayBrowser->depthKeys);
+               //              debug($arrayBrowser->searchKeys);
+                       }
 
-               $tree = $arrayBrowser->tree($theVar, '', '');
+                       $tree = $arrayBrowser->tree($theVar, "", "");
 
-               $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
-               $this->content.= $this->doc->sectionEnd();
+                       $label = $this->MOD_MENU["function"][$this->MOD_SETTINGS["function"]];
+                       $this->content.= $this->doc->sectionEnd();
 
-                       // Variable name:
-               if (t3lib_div::_GP('varname'))  {
-                       $this->content.= '<div style="margin: 10px 10px 10px 10px; padding: 10px 10px 10px 10px; background-color: #eeeeee; border: 1px solid black;">Variable: <br/>
-                               <input type="text" name="_" value="'.trim(htmlspecialchars(t3lib_div::_GP('varname'))).'" size="80" /><br/>
-                               (Now, copy/paste this value into the configuration file where you can set it. This is all you can do from here...)
-                               </div>
-                       ';
-               }
+                               // Variable name:
+                       if (t3lib_div::_GP('varname'))  {
+                               $this->content.= '<div style="margin: 10px 10px 10px 10px; padding: 10px 10px 10px 10px; background-color: #eeeeee; border: 1px solid black;">Variable: <br/>
+                                       <input type="text" name="_" value="'.trim(htmlspecialchars(t3lib_div::_GP('varname'))).'" size="80" /><br/>
+                                       (Now, copy/paste this value into the configuration file where you can set it. This is all you can do from here...)
+                                       </div>
+                               ';
+                       }
 
-               $this->content.= '<br/><table border="0" cellpadding="1" cellspacing="0"">';
-               $this->content.= '<tr>
-                                       <td><img src="clear.gif" width="1" height="1" alt="" /></td>
-                                       <td class="bgColor2">
-                                               <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" width="100%"><tr><td nowrap="nowrap"><b>'.$label.'</b></td></tr></table>
-                                       </td>
-                               </tr>';
-               $this->content.='<tr>
-                                       <td></td>
-                                       <td class="bgColor2">
-                                               <table border="0" cellpadding="0" cellspacing="0" bgcolor="#D9D5C9" width="100%"><tr><td nowrap="nowrap">'.$tree.'</td></tr></table>' .
-                                                               '<img src="clear.gif" width="465" height="1" alt="" /></td>
-                               </tr>
-                       </table>
-               ';
+                       $this->content.= '<BR><table border=0 cellpadding=1 cellspacing=0>';
+                       $this->content.= '<tr>
+                                               <td><img src=clear.gif width=1 height=1></td>
+                                               <td class="bgColor2">
+                                                       <table border=0 cellpadding=0 cellspacing=0 class="bgColor5" width="100%"><tr><td nowrap><b>'.fw($label).'</b></td></tr></table>
+                                               </td>
+                                       </tr>';
+                       $this->content.='<tr>
+                                               <td></td>
+                                               <td class="bgColor2">
+                                                       <table border=0 cellpadding=0 cellspacing=0 bgcolor="#D9D5C9" width="100%"><tr><td nowrap>'.$tree.'</td></tr></table><img src=clear.gif width=465 height=1></td>
+                                       </tr>
+                               </table>
+                       ';
 
 
-                       // Search:
-               $this->content.='<br>
-                       <table border="0" cellpadding="1" cellspacing="0"">
-                               <tr>
-                                       <td><img src="clear.gif" width="1" height="1" alt="" /></td>
-                                       <td class="bgColor2">
-                                               <table border="0" cellpadding="0" cellspacing="0" bgcolor="#D9D5C9">
-                                               <tr>
-                                                       <td>&nbsp;Enter search phrase:&nbsp;&nbsp;<input type="text" name="search_field" value="'.htmlspecialchars($search_field).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).'></td>
-                                                       <td><input type="submit" name="search" value="Search" /></td>
-                                               </tr>
-                                               <tr>
-                                                       <td>&nbsp;Use ereg(), not stristr():&nbsp;&nbsp;'.t3lib_BEfunc::getFuncCheck(0,'SET[regexsearch]',$this->MOD_SETTINGS['regexsearch']).'</td>
-                                                       <td>&nbsp;</td>
-                                               </tr>
-                                               </table>
-                                       </td>
-                               </tr>
-                       </table>
-               <br/>
-               ';
+                               // Search:
+                       $this->content.='<br>
+                               <table border=0 cellpadding=1 cellspacing=0>
+                                       <tr>
+                                               <td><img src=clear.gif width=1 height=1></td>
+                                               <td class="bgColor2">
+                                                       <table border=0 cellpadding=0 cellspacing=0 bgcolor="#D9D5C9">
+                                                       <tr>
+                                                               <td>'.fw("&nbsp;Enter search phrase:&nbsp;&nbsp;").'<input type="Text" name="search_field" value="'.htmlspecialchars($search_field).'"'.$GLOBALS["TBE_TEMPLATE"]->formWidth(20).'></td>
+                                                               <td><input type="Submit" name="search" value="Search"></td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>'.fw("&nbsp;Use ereg(), not stristr():&nbsp;&nbsp;").t3lib_BEfunc::getFuncCheck(0,"SET[regexsearch]",$this->MOD_SETTINGS["regexsearch"]).'</td>
+                                                               <td>&nbsp;</td>
+                                                       </tr>
+                                                       </table>
+                                               </td>
+                                       </tr>
+                               </table>
+                       <br>
+                       ';
 
                if ($BE_USER->mayMakeShortcut())        {
-                       $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('','function',$this->MCONF['name']));
+                       $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon("","function",$this->MCONF["name"]));
                }
        }
-
-       /**
-        * Print output to browser
-        *
-        * @return      void
-        */
        function printContent() {
 
-               $this->content.= $this->doc->endPage();
+               $this->content.=$this->doc->endPage();
                echo $this->content;
        }
 }
 
 // Include extension?
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/config/index.php'])  {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/config/index.php']);
+if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/lowlevel/config/index.php"])  {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/lowlevel/config/index.php"]);
 }
 
 
@@ -289,7 +246,7 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowleve
 
 
 // Make instance:
-$SOBE = t3lib_div::makeInstance('SC_mod_tools_config_index');
+$SOBE = t3lib_div::makeInstance("SC_mod_tools_config_index");
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
diff --git a/typo3/sysext/lowlevel/dbint/cli/conf.php b/typo3/sysext/lowlevel/dbint/cli/conf.php
deleted file mode 100644 (file)
index 9f6b544..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-// DO NOT REMOVE OR CHANGE THESE 3 LINES:
-define('TYPO3_MOD_PATH', 'sysext/lowlevel/dbint/cli/');
-$BACK_PATH = '../../../../';
-$MCONF['name'] = '_CLI_lowlevel';
-
-?>
diff --git a/typo3/sysext/lowlevel/dbint/cli/refindex_cli.phpsh b/typo3/sysext/lowlevel/dbint/cli/refindex_cli.phpsh
deleted file mode 100644 (file)
index 2484870..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /usr/bin/php -q
-<?php
-
-// *****************************************
-// Standard initialization of a CLI module:
-// *****************************************
-
-       // Defining circumstances for CLI mode:
-define('TYPO3_cliMode', TRUE);
-
-       // Defining PATH_thisScript here: Must be the ABSOLUTE path of this script in the right context:
-       // This will work as long as the script is called by it's absolute path!
-define('PATH_thisScript',$_ENV['_']?$_ENV['_']:$_SERVER['_']);
-
-       // Include configuration file:
-require(dirname(PATH_thisScript).'/conf.php');
-
-       // Include init file:
-require(dirname(PATH_thisScript).'/'.$BACK_PATH.'init.php');
-
-
-
-# HERE you run your application!
-require_once(PATH_t3lib.'class.t3lib_refindex.php');
-
-if (in_array('-h',$_SERVER["argv"]))   {
-       echo "
-Options:
--e = Update refindex, otherwise testing
--h = This help screen.
--s = Silent
-";
-       exit;
-}
-
-       // Call the functionality
-$testOnly = !in_array('-e',$_SERVER["argv"]);
-$refIndexObj = t3lib_div::makeInstance('t3lib_refindex');
-list($headerContent,$bodyContent) = $refIndexObj->updateIndex($testOnly,!in_array('-s',$_SERVER["argv"]));
-
-?>
index f43cec5..51a65bc 100755 (executable)
  *
  * This module lets you check if all pages and the records relate properly to each other
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *  120: class SC_mod_tools_dbint_index
- *  134:     function init()
- *  147:     function jumpToUrl(URL)
- *  164:     function menuConfig()
- *  223:     function main()
- *  265:     function printContent()
- *  276:     function func_refindex()
- *  340:     function func_search()
- *  370:     function func_tree()
- *  391:     function func_     records()
- *  487:     function func_relations()
- *  538:     function func_filesearch()
- *  586:     function findFile($basedir,$pattern,&$matching_files,$depth)
- *  629:     function func_default()
- *
- * TOTAL FUNCTIONS: 13
- * (This index is automatically created/updated by the extension "extdeveval")
- *
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 
 
@@ -68,47 +44,72 @@ require_once (PATH_t3lib.'class.t3lib_xml.php');
 require_once (PATH_t3lib.'class.t3lib_fullsearch.php');
 require_once (PATH_t3lib.'class.t3lib_refindex.php');
 
-$LANG->includeLLFile('EXT:lowlevel/dbint/locallang.xml');
 $BE_USER->modAccess($MCONF,1);
 
 
 
+// **************************
+// Setting english (ONLY!) LOCAL_LANG
+// **************************
+$LOCAL_LANG = Array (
+       'default' => Array (
+               'tables' => 'Tables:',
+               'fixLostRecord' => 'Click to move this lost record to rootlevel (pid=0)',
 
+               'doktype' => 'Document types:',
+               'pages' => 'Pages:',
+               'total_pages' => 'Total number of pages:',
+               'deleted_pages' => 'Marked-deleted pages:',
+               'hidden_pages' => 'Hidden pages:',
+               'relations' => 'Relations:',
+               'relations_description' => 'This will analyse the content of the tables and check if there are \'empty\' relations between records or if files are missing from their expected position.',
 
+               'files_many_ref' => 'Files referenced from more than one record:',
+               'files_no_ref' => 'Files with no references at all (delete them!):',
+               'files_no_file' => 'Missing files:',
+               'select_db' => 'Select fields:',
+               'group_db' => 'Group fields:',
 
-/**
- * Script class for the DB int module
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tx_lowlevel
- */
-class SC_mod_tools_dbint_index {
+               'tree' => 'The Page Tree:',
+               'tree_description' => 'This shows all pages in the system in one large tree. Beware that this will probably result in a very long document which will also take some time for the server to compute!',
+               'records' => 'Records Statistics:',
+               'records_description' => 'This shows some statistics for the records in the database. This runs through the entire page-tree and therefore it will also load the server heavily!',
+               'search' => 'Search Whole Database',
+               'search_description' => 'This searches through all database tables and records for a text string.',
+               'filesearch' => 'Search all filenames for pattern',
+               'filesearch_description' => 'Will search recursively for filenames in the PATH_site (subdirs to the website path) matching a certain regex pattern.',
+               'title' => 'Database integrity check'
+       )
+);
 
-       var $MCONF = array();
-       var $MOD_MENU = array();
-       var $MOD_SETTINGS = array();
+
+
+
+
+// ***************************
+// Script Classes
+// ***************************
+class SC_mod_tools_dbint_index {
+       var $MCONF=array();
+       var $MOD_MENU=array();
+       var $MOD_SETTINGS=array();
        var $doc;
 
        var $content;
        var $menu;
 
-
        /**
-        * Initialization
-        * 
-        * @return      void
+        * @return      [type]          ...
         */
        function init() {
-               global $LANG,$BACK_PATH;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
                $this->MCONF = $GLOBALS['MCONF'];
 
                $this->menuConfig();
 
                $this->doc = t3lib_div::makeInstance('mediumDoc');
-               $this->doc->form='<form action="" method="post">';
+               $this->doc->form='<form action="" method="POST">';
                $this->doc->backPath = $BACK_PATH;
-               
                                // JavaScript
                $this->doc->JScode = '
                <script language="javascript" type="text/javascript">
@@ -118,23 +119,20 @@ class SC_mod_tools_dbint_index {
                        }
                </script>
                ';
-               
                $this->doc->tableLayout = Array (
                        'defRow' => Array (
                                '0' => Array('<td valign="top">','</td>'),
                                '1' => Array('<td valign="top">','</td>'),
-                               'defCol' => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="15" height="1" alt="" /></td><td valign="top">','</td>')
+                               'defCol' => Array('<TD><img src="'.$this->doc->backPath.'clear.gif" width="15" height="1"></td><td valign="top">','</td>')
                        )
                );
        }
 
        /**
-        * Configure menu
-        * 
-        * @return      void
+        * @return      [type]          ...
         */
        function menuConfig()   {
-               global $LANG;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
                // MENU-ITEMS:
                        // If array, then it's a selector box menu
@@ -190,16 +188,16 @@ class SC_mod_tools_dbint_index {
        }
 
        /**
-        * Main 
-        * 
-        * @return      void
+        * @return      [type]          ...
         */
        function main() {
-               global $BE_USER,$LANG;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
-                       // Content creation
-               $this->content.= $this->doc->startPage($LANG->getLL('title'));
-               $this->menu = t3lib_BEfunc::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function']);
+               // **************************
+               // Content creation
+               // **************************
+               $this->content.=$this->doc->startPage($LANG->getLL('title'));
+               $this->menu=t3lib_BEfunc::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function']);
 
                switch($this->MOD_SETTINGS['function']) {
                        case 'search':
@@ -232,57 +230,72 @@ class SC_mod_tools_dbint_index {
        }
 
        /**
-        * Print content
-        * 
-        * @return      void
+        * @return      [type]          ...
         */
        function printContent() {
 
-               $this->content.= $this->doc->endPage();
+               $this->content.=$this->doc->endPage();
                echo $this->content;
        }
 
-
-
-
-
-
-
-
-
-       /****************************
-        *  
-        * Functionality implementation
-        * 
-        ****************************/
-
-       /**
-        * Check and update reference index!
-        *
-        * @return      [type]          ...
-        */
        function func_refindex()        {
-               global $TYPO3_DB,$TCA;
+               global $TCA,$TYPO3_DB;
 
                $this->content.=$this->doc->section('',$this->menu);//$this->doc->divider(5);
                $this->content.=$this->doc->section('',$menu2).$this->doc->spacer(10);
 
                if (t3lib_div::_GP('_update') || t3lib_div::_GP('_check'))      {
                        $testOnly = t3lib_div::_GP('_check')?TRUE:FALSE;
-                       
-                               // Call the functionality
-                       $refIndexObj = t3lib_div::makeInstance('t3lib_refindex');
-                       list($headerContent,$bodyContent) = $refIndexObj->updateIndex($testOnly);
+                       $errors = array();
+                       $tableNames = array();
+                       $recCount=0;
+                       $tableCount=0;
+
+                               // Traverse all tables:
+                       foreach($TCA as $tableName => $cfg)     {
+                               $tableNames[] = $tableName;
+                               $tableCount++;
+
+                                       // Traverse all non-deleted records in tables:
+                               $allRecs = $TYPO3_DB->exec_SELECTgetRows('uid',$tableName,'1'.t3lib_BEfunc::deleteClause($tableName));
+                               $uidList = array(0);
+                               foreach($allRecs as $recdat)    {
+                                       $refIndexObj = t3lib_div::makeInstance('t3lib_refindex');
+                                       $result = $refIndexObj->updateRefIndexTable($tableName,$recdat['uid'],$testOnly);
+                                       $uidList[]= $recdat['uid'];
+                                       $recCount++;
+
+                                       if ($result['addedNodes'] || $result['deletedNodes'])   {
+                                               $errors[] = 'Record '.$tableName.':'.$recdat['uid'].' had '.$result['addedNodes'].' added indexes and '.$result['deletedNodes'].' deleted indexes';
+                                               #$errors[] = t3lib_div::view_array($result);
+                                       }
+                               }
+
+                                       // Searching lost indexes for this table:
+                               $where = 'tablename='.$TYPO3_DB->fullQuoteStr($tableName,'sys_refindex').' AND recuid NOT IN ('.implode(',',$uidList).')';
+                               $lostIndexes = $TYPO3_DB->exec_SELECTgetRows('hash','sys_refindex',$where);
+                               if (count($lostIndexes))        {
+                                       $errors[] = 'Table '.$tableName.' has '.count($lostIndexes).' lost indexes which are now deleted';
+                                       if (!$testOnly) $TYPO3_DB->exec_DELETEquery('sys_refindex',$where);
+                               }
+                       }
+
+                               // Searching lost indexes for non-existing tables:
+                       $where = 'tablename NOT IN ('.implode(',',$TYPO3_DB->fullQuoteArray($tableNames,'sys_refindex')).')';
+                       $lostTables = $TYPO3_DB->exec_SELECTgetRows('hash','sys_refindex',$where);
+                       if (count($lostTables)) {
+                               $errors[] = 'Index table hosted '.count($lostTables).' indexes for non-existing tables, now removed';
+                               if (!$testOnly) $TYPO3_DB->exec_DELETEquery('sys_refindex',$where);
+                       }
 
+                       $testedHowMuch = $recCount.' records from '.$tableCount.' tables were checked/updated.<br/>';
                                // Output content:
-                       $this->content.=$this->doc->section($headerContent,str_replace(chr(10),'<br/>',$bodyContent),0,1);
+                       $this->content.=$this->doc->section($testOnly ? 'Reference Index TESTED (nothing written)' : 'Reference Index Updated',$testedHowMuch.(count($errors)?implode('<br/>',$errors):'Index Integrity was perfect!'),0,1);
                }
 
                        // Output content:
                $content = 'Click here to update reference index: <input type="submit" name="_update" value="Update now!" /><br/>';
-               $content.= 'Click here to test reference index: <input type="submit" name="_check" value="Check now!" /><br/>';
-               $content.= 'You can also run the check as a shell script if the processing takes longer than the PHP max_execution_time allows:<br/>'.
-                                       t3lib_extMgm::extPath('lowlevel').'dbint/cli/refindex_cli.phpsh';
+               $content.= 'Click here to test reference index: <input type="submit" name="_check" value="Check now!" />';
                $this->content.=$this->doc->section('Update reference index',$content,0,1);
        }
 
@@ -290,7 +303,7 @@ class SC_mod_tools_dbint_index {
         * @return      [type]          ...
         */
        function func_search()  {
-               global $LANG;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
                $fullsearch = t3lib_div::makeInstance('t3lib_fullsearch');
                $this->content.=$this->doc->header($LANG->getLL('search'));
@@ -320,7 +333,7 @@ class SC_mod_tools_dbint_index {
         * @return      [type]          ...
         */
        function func_tree()    {
-               global $LANG,$BACK_PATH;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
                $startID=0;
                $admin = t3lib_div::makeInstance('t3lib_admin');
@@ -341,7 +354,7 @@ class SC_mod_tools_dbint_index {
         * @return      [type]          ...
         */
        function func_records() {
-               global $LANG,$TCA,$BACK_PATH;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
                global $PAGES_TYPES;
 
                $admin = t3lib_div::makeInstance('t3lib_admin');
@@ -437,7 +450,7 @@ class SC_mod_tools_dbint_index {
         * @return      [type]          ...
         */
        function func_relations()       {
-               global $LANG,$BACK_PATH;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
                $this->content.=$this->doc->header($LANG->getLL('relations'));
                $this->content.=$this->doc->spacer(5);
@@ -488,7 +501,7 @@ class SC_mod_tools_dbint_index {
         * @return      [type]          ...
         */
        function func_filesearch()      {
-               global $LANG;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
                $this->content.=$this->doc->header($LANG->getLL('relations'));
                $this->content.=$this->doc->spacer(5);
@@ -579,7 +592,7 @@ class SC_mod_tools_dbint_index {
         * @return      [type]          ...
         */
        function func_default() {
-               global $LANG;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
                $this->content.=$this->doc->header($LANG->getLL('title'));
                $this->content.=$this->doc->spacer(5);
diff --git a/typo3/sysext/lowlevel/dbint/locallang.xml b/typo3/sysext/lowlevel/dbint/locallang.xml
deleted file mode 100644 (file)
index 46a105d..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<T3locallang>
-    <meta type="array">
-        <description>Labels for DB int module</description>
-        <type>module</type>
-        <csh_table></csh_table>
-        <fileId>EXT:lowlevel/dbint/locallang.xml</fileId>
-        <labelContext type="array">
-            <label index="tables"></label>
-            <label index="fixLostRecord"></label>
-            <label index="doktype"></label>
-            <label index="pages"></label>
-            <label index="total_pages"></label>
-            <label index="deleted_pages"></label>
-            <label index="hidden_pages"></label>
-            <label index="relations"></label>
-            <label index="relations_description"></label>
-            <label index="files_many_ref"></label>
-            <label index="files_no_ref"></label>
-            <label index="files_no_file"></label>
-            <label index="select_db"></label>
-            <label index="group_db"></label>
-            <label index="tree"></label>
-            <label index="tree_description"></label>
-            <label index="records"></label>
-            <label index="records_description"></label>
-            <label index="search"></label>
-            <label index="search_description"></label>
-            <label index="filesearch"></label>
-            <label index="filesearch_description"></label>
-            <label index="title"></label>
-        </labelContext>
-    </meta>
-    <data type="array">
-        <languageKey index="default" type="array">
-            <label index="tables">Tables:</label>
-            <label index="fixLostRecord">Click to move this lost record to rootlevel (pid=0)</label>
-            <label index="doktype">Document types:</label>
-            <label index="pages">Pages:</label>
-            <label index="total_pages">Total number of pages:</label>
-            <label index="deleted_pages">Marked-deleted pages:</label>
-            <label index="hidden_pages">Hidden pages:</label>
-            <label index="relations">Relations:</label>
-            <label index="relations_description">This will analyse the content of the tables and check if there are 'empty' relations between records or if files are missing from their expected position.</label>
-            <label index="files_many_ref">Files referenced from more than one record:</label>
-            <label index="files_no_ref">Files with no references at all (delete them!):</label>
-            <label index="files_no_file">Missing files:</label>
-            <label index="select_db">Select fields:</label>
-            <label index="group_db">Group fields:</label>
-            <label index="tree">The Page Tree:</label>
-            <label index="tree_description">This shows all pages in the system in one large tree. Beware that this will probably result in a very long document which will also take some time for the server to compute!</label>
-            <label index="records">Records Statistics:</label>
-            <label index="records_description">This shows some statistics for the records in the database. This runs through the entire page-tree and therefore it will also load the server heavily!</label>
-            <label index="search">Search Whole Database</label>
-            <label index="search_description">This searches through all database tables and records for a text string.</label>
-            <label index="filesearch">Search all filenames for pattern</label>
-            <label index="filesearch_description">Will search recursively for filenames in the PATH_site (subdirs to the website path) matching a certain regex pattern.</label>
-            <label index="title">Database integrity check</label>
-        </languageKey>
-    </data>
-    <orig_hash type="array">
-        <languageKey index="default" type="array">
-            <label index="tables" type="integer">267355363</label>
-            <label index="fixLostRecord" type="integer">264598103</label>
-            <label index="doktype" type="integer">59646372</label>
-            <label index="pages" type="integer">9915692</label>
-            <label index="total_pages" type="integer">120516512</label>
-            <label index="deleted_pages" type="integer">251989828</label>
-            <label index="hidden_pages" type="integer">56221326</label>
-            <label index="relations" type="integer">158458960</label>
-            <label index="relations_description" type="integer">98163255</label>
-            <label index="files_many_ref" type="integer">253873964</label>
-            <label index="files_no_ref" type="integer">51429792</label>
-            <label index="files_no_file" type="integer">103076812</label>
-            <label index="select_db" type="integer">222215195</label>
-            <label index="group_db" type="integer">89872761</label>
-            <label index="tree" type="integer">254322778</label>
-            <label index="tree_description" type="integer">13437987</label>
-            <label index="records" type="integer">107937849</label>
-            <label index="records_description" type="integer">36151804</label>
-            <label index="search" type="integer">201691087</label>
-            <label index="search_description" type="integer">44447557</label>
-            <label index="filesearch" type="integer">138409460</label>
-            <label index="filesearch_description" type="integer">206400326</label>
-            <label index="title" type="integer">152428276</label>
-        </languageKey>
-    </orig_hash>
-    <orig_text type="array">
-        <languageKey index="default" type="array">
-        </languageKey>
-    </orig_text>
-</T3locallang>
\ No newline at end of file
index 6abf5b2..4f9176f 100755 (executable)
@@ -20,7 +20,7 @@ $EM_CONF[$_EXTKEY] = Array (
        'loadOrder' => '',
        'TYPO3_version' => '3.7.0-',
        'PHP_version' => '0.0.1-0.0.1',
-       'module' => 'config,dbint,dbint/cli',
+       'module' => 'config,dbint',
        'state' => 'stable',
        'internal' => 0,
        'uploadfolder' => 0,