DBAL compliancy changes and a fix for bug #961.
authorKarsten Dambekalns <karsten.dambekalns@typo3.org>
Wed, 13 Apr 2005 16:54:48 +0000 (16:54 +0000)
committerKarsten Dambekalns <karsten.dambekalns@typo3.org>
Wed, 13 Apr 2005 16:54:48 +0000 (16:54 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@633 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/indexed_search/ChangeLog
typo3/sysext/indexed_search/mod/index.php
typo3/sysext/indexed_search/modfunc1/class.tx_indexedsearch_modfunc1.php
typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php

index c6500a9..c6bebd0 100755 (executable)
@@ -1,3 +1,7 @@
+2005-04-13  Karsten Dambekalns <karsten@typo3.org>
+
+       * Fixed bug #961 and added some DBAL compliancy changes.
+
 2005-04-07  Andreas Otto  <andreas.otto@dkd.de>
 
        * Added modfunc2 which offers statistics of entered search words.
index a56df64..ec167f6 100755 (executable)
@@ -221,7 +221,6 @@ class SC_mod_tools_isearch_index {
                while(list(,$t)=each($tables))  {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $t, '');
                        $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
-
                        $recList[] = array($this->tableHead($t), $row[0]);
                }
                return $recList;
@@ -247,7 +246,7 @@ class SC_mod_tools_isearch_index {
 
                        // TYPO3 pages, unique
                $items = array();
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*),phash', 'index_phash', 'data_page_id!=0', 'phash_grouping,count(*),phash');
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*),phash', 'index_phash', 'data_page_id!=0', 'phash_grouping,pcount,phash');
                while($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
                        $items[] = $row;
                }
@@ -261,10 +260,8 @@ class SC_mod_tools_isearch_index {
                        // External files, unique
                $items = array();
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*),phash', 'index_phash', 'data_filename!=\'\'', 'phash_grouping');
-               while($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
-                       $items[] = $row;
-               }
-               $recList[] = array($this->tableHead("External files"), count($items));
+               $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
+               $recList[] = array($this->tableHead("External files"), $row[0]);
 
                        // External files
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'index_phash', 'data_filename!=\'\'');
@@ -297,7 +294,7 @@ class SC_mod_tools_isearch_index {
                );
 
                        // TYPO3 pages, unique
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*),index_phash.*', 'index_phash', 'data_page_id!=0', 'phash_grouping', 'data_page_id');
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*) AS pcount,index_phash.*', 'index_phash', 'data_page_id!=0', 'phash_grouping,phash,cHashParams,data_filename,data_page_id,data_page_reg1,data_page_type,data_page_mp,gr_list,item_type,item_title,item_description,item_mtime,tstamp,item_size,contentHash,crdate,parsetime,sys_language_uid,item_crdate,externalUrl,recordUid,freeIndexUid', 'data_page_id');
                while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
 
                        $cHash = count(unserialize($row["cHashParams"])) ? $this->formatCHash(unserialize($row["cHashParams"])) : "";
@@ -311,14 +308,14 @@ class SC_mod_tools_isearch_index {
                                t3lib_BEfunc::datetime($row["crdate"]),
                                ($row["tstamp"]!=$row["crdate"] ? t3lib_BEfunc::datetime($row["tstamp"]) : ""),
                                $row["parsetime"],
-                               $this->getNumberOfSections($row["phash"])."/".$grListRec[0]["count(*)"]."/".$this->getNumberOfFulltext($row["phash"]),
-                               $row["count(*)"]."/".$this->formatFeGroup($grListRec),
+                               $this->getNumberOfSections($row["phash"])."/".$grListRec[0]["pcount"]."/".$this->getNumberOfFulltext($row["phash"]),
+                               $row["pcount"]."/".$this->formatFeGroup($grListRec),
                                $row["sys_language_uid"],
                                $cHash,
                                $row["phash"]
                        );
 
-                       if ($row["count(*)"]>1) {
+                       if ($row["pcount"]>1)   {
                                $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('index_phash.*', 'index_phash', 'phash_grouping='.intval($row['phash_grouping']).' AND phash!='.intval($row['phash']));
                                while($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2))     {
                                        $grListRec = $this->getGrlistRecord($row2["phash"]);
@@ -331,7 +328,7 @@ class SC_mod_tools_isearch_index {
                                                t3lib_BEfunc::datetime($row2["crdate"]),
                                                ($row2["tstamp"]!=$row2["crdate"] ? t3lib_BEfunc::datetime($row2["tstamp"]) : ""),
                                                $row2["parsetime"],
-                                               $this->getNumberOfSections($row2["phash"])."/".$grListRec[0]["count(*)"]."/".$this->getNumberOfFulltext($row2["phash"]),
+                                               $this->getNumberOfSections($row2["phash"])."/".$grListRec[0]["pcount"]."/".$this->getNumberOfFulltext($row2["phash"]),
                                                "-/".$this->formatFeGroup($grListRec),
                                                "",
                                                "",
@@ -365,7 +362,7 @@ class SC_mod_tools_isearch_index {
                );
 
                        // TYPO3 pages, unique
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*),index_phash.*', 'index_phash', 'item_type>0', 'phash_grouping', 'item_type');
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*) AS pcount,index_phash.*', 'index_phash', 'item_type>0', 'phash_grouping,phash,cHashParams,data_filename,data_page_id,data_page_reg1,data_page_type,data_page_mp,gr_list,item_type,item_title,item_description,item_mtime,tstamp,item_size,contentHash,crdate,parsetime,sys_language_uid,item_crdate,externalUrl,recordUid,freeIndexUid', 'item_type');
                while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
 
                        $cHash = count(unserialize($row["cHashParams"])) ? $this->formatCHash(unserialize($row["cHashParams"])) : "";
@@ -378,14 +375,14 @@ class SC_mod_tools_isearch_index {
                                t3lib_BEfunc::datetime($row["crdate"]),
                                ($row["tstamp"]!=$row["crdate"] ? t3lib_BEfunc::datetime($row["tstamp"]) : ""),
                                $row["parsetime"],
-                               $this->getNumberOfSections($row["phash"])."/".$grListRec[0]["count(*)"]."/".$this->getNumberOfFulltext($row["phash"]),
-                               $row["count(*)"],
+                               $this->getNumberOfSections($row["phash"])."/".$grListRec[0]["pcount"]."/".$this->getNumberOfFulltext($row["phash"]),
+                               $row["pcount"],
                                $cHash,
                                $row["phash"],
                                t3lib_div::fixed_lgd($row["data_filename"],100)
                        );
 
-                       if ($row["count(*)"]>1) {
+                       if ($row["pcount"]>1)   {
                                $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('index_phash.*', 'index_phash', 'phash_grouping='.intval($row['phash_grouping']).' AND phash!='.intval($row['phash']));
                                while($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2))     {
                                        $cHash = count(unserialize($row2["cHashParams"])) ? $this->formatCHash(unserialize($row2["cHashParams"])) : "";
@@ -398,7 +395,7 @@ class SC_mod_tools_isearch_index {
                                                t3lib_BEfunc::datetime($row2["crdate"]),
                                                ($row2["tstamp"]!=$row2["crdate"] ? t3lib_BEfunc::datetime($row2["tstamp"]) : ""),
                                                $row2["parsetime"],
-                                               $this->getNumberOfSections($row2["phash"])."/".$grListRec[0]["count(*)"]."/".$this->getNumberOfFulltext($row2["phash"]),
+                                               $this->getNumberOfSections($row2["phash"])."/".$grListRec[0]["pcount"]."/".$this->getNumberOfFulltext($row2["phash"]),
                                                "",
                                                $cHash,
                                                $row2["phash"],
@@ -476,7 +473,7 @@ class SC_mod_tools_isearch_index {
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('index_grlist.*', 'index_grlist', 'phash='.intval($phash));
                $allRows = array();
                while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
-                       $row["count(*)"] = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
+                       $row["pcount"] = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
                        $allRows[] = $row;
                }
                return $allRows;
index 07e04e0..af8ad8d 100755 (executable)
@@ -316,7 +316,7 @@ class tx_indexedsearch_modfunc1 extends t3lib_extobjbase {
                                        'ISEC.*, IP.*, count(*) AS count_val',
                                        'index_phash IP, index_section ISEC',
                                        'IP.phash = ISEC.phash AND ISEC.page_id = '.intval($data['uid']),
-                                       'IP.phash,IP.phash_grouping,IP.cHashParams,IP.data_filename,IP.data_page_id,IP.data_page_reg1,IP.data_page_type,IP.data_page_mp,IP.gr_list,IP.item_type,IP.item_title,IP.item_description,IP.item_mtime,IP.tstamp,IP.item_size,IP.contentHash,IP.crdate,IP.parsetime,IP.sys_language_uid,IP.item_crdate,ISEC.phash,ISEC.phash_t3,ISEC.rl0,ISEC.rl1,ISEC.rl2,ISEC.page_id,ISEC.uniqid',
+                                       'IP.phash,IP.phash_grouping,IP.cHashParams,IP.data_filename,IP.data_page_id,IP.data_page_reg1,IP.data_page_type,IP.data_page_mp,IP.gr_list,IP.item_type,IP.item_title,IP.item_description,IP.item_mtime,IP.tstamp,IP.item_size,IP.contentHash,IP.crdate,IP.parsetime,IP.sys_language_uid,IP.item_crdate,ISEC.phash,ISEC.phash_t3,ISEC.rl0,ISEC.rl1,ISEC.rl2,ISEC.page_id,ISEC.uniqid,IP.externalUrl,IP.recordUid,IP.freeIndexUid',
                                        'IP.item_type, IP.tstamp',
                                        ($this->maxListPerPage+1)
                                );
index 3bb115d..7c51dfd 100755 (executable)
@@ -1027,7 +1027,7 @@ class tx_indexedsearch extends tslib_pibase {
                                                        AND ISEC.phash = IR.phash
                                                        AND IP.phash = IR.phash
                                                        AND     '.$page_where,
-                                               'IP.phash,ISEC.phash,ISEC.phash_t3,ISEC.rl0,ISEC.rl1,ISEC.rl2 ,ISEC.page_id,ISEC.uniqid,IP.phash_grouping,IP.data_filename ,IP.data_page_id ,IP.data_page_reg1,IP.data_page_type,IP.data_page_mp,IP.gr_list,IP.item_type,IP.item_title,IP.item_description,IP.item_mtime,IP.tstamp,IP.item_size,IP.contentHash,IP.crdate,IP.parsetime,IP.sys_language_uid,IP.item_crdate',
+                                               'IP.phash,ISEC.phash,ISEC.phash_t3,ISEC.rl0,ISEC.rl1,ISEC.rl2 ,ISEC.page_id,ISEC.uniqid,IP.phash_grouping,IP.data_filename ,IP.data_page_id ,IP.data_page_reg1,IP.data_page_type,IP.data_page_mp,IP.gr_list,IP.item_type,IP.item_title,IP.item_description,IP.item_mtime,IP.tstamp,IP.item_size,IP.contentHash,IP.crdate,IP.parsetime,IP.sys_language_uid,IP.item_crdate,IP.cHashParams,IP.externalUrl,IP.recordUid,IP.freeIndexUid',
                                                $orderBy
                                        );
                } else {        // Otherwise, if sorting are done with the pages table or other fields, there is no need for joining with the rel/word tables:
@@ -1053,7 +1053,7 @@ class tx_indexedsearch extends tslib_pibase {
                                                        $this->languageWhere().'
                                                        AND IP.phash = ISEC.phash
                                                        AND '.$page_where,
-                                               'IP.phash',
+                                               'IP.phash,ISEC.phash,ISEC.phash_t3,ISEC.rl0,ISEC.rl1,ISEC.rl2 ,ISEC.page_id,ISEC.uniqid,IP.phash_grouping,IP.data_filename ,IP.data_page_id ,IP.data_page_reg1,IP.data_page_type,IP.data_page_mp,IP.gr_list,IP.item_type,IP.item_title,IP.item_description,IP.item_mtime,IP.tstamp,IP.item_size,IP.contentHash,IP.crdate,IP.parsetime,IP.sys_language_uid,IP.item_crdate,IP.cHashParams,IP.externalUrl,IP.recordUid,IP.freeIndexUid',
                                                $orderBy
                                        );
                }
@@ -1146,7 +1146,7 @@ class tx_indexedsearch extends tslib_pibase {
                                $insertFields = array(
                                        'word' => $val['sword'],                // $GLOBALS['TSFE']->csConvObj->conv_case('utf-8', $val['sword'], 'toLower'),
                                        'index_stat_search_id' => $newId,
-                                       'tstamp' => $GLOBALS['EXEC_TIME']               // Time stamp
+                                       'tstamp' => $GLOBALS['EXEC_TIME'],              // Time stamp
                                        'pageid' => $GLOBALS['TSFE']->id        //search page id for indexed search stats
                                );