index.php 16.7 KB
Newer Older
Kasper Skårhøj's avatar
Kasper Skårhøj committed
1
2
3
4
<?php
/***************************************************************
*  Copyright notice
*
5
*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
Kasper Skårhøj's avatar
Kasper Skårhøj committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
*  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!
***************************************************************/
/**
 * Module: Indexing Engine Overview
 *
 * @author	Kasper Skårhøj <kasperYYYY@typo3.com>
 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
32
33
/**
 * [CLASS/FUNCTION INDEX of SCRIPT]
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
34
35
36
37
38
39
40
41
42
43
44
 *
 *
 *
 *   83: class SC_mod_tools_isearch_index
 *   97:     function init()
 *  110:     function jumpToUrl(URL)
 *  133:     function menuConfig()
 *  156:     function main()
 *  193:     function printContent()
 *
 *              SECTION: OTHER FUNCTIONS:
45
46
47
48
49
50
51
52
53
54
55
56
57
 *  216:     function getRecordsNumbers()
 *  234:     function tableHead($str)
 *  243:     function getPhashStat()
 *  278:     function getPhashT3pages()
 *  347:     function getPhashExternalDocs()
 *  416:     function formatFeGroup($fegroup_recs)
 *  432:     function formatCHash($arr)
 *  447:     function getNumberOfSections($phash)
 *  459:     function getNumberOfWords($phash)
 *  471:     function getGrlistRecord($phash)
 *  487:     function getNumberOfFulltext($phash)
 *  498:     function getPhashTypes()
 *  528:     function countUniqueTypes($item_type)
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
58
59
60
61
 *
 * TOTAL FUNCTIONS: 18
 * (This index is automatically created/updated by the extension "extdeveval")
 *
Kasper Skårhøj's avatar
Kasper Skårhøj committed
62
 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
63
64
65
66
67
68
69
70
71


unset($MCONF);
require ("conf.php");
require ($BACK_PATH."init.php");
require ($BACK_PATH."template.php");
$BE_USER->modAccess($MCONF,1);

t3lib_extMgm::isLoaded("indexed_search",1);
72
require_once(t3lib_extMgm::extPath('indexed_search').'class.indexer.php');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
73
74


Kasper Skårhøj's avatar
Kasper Skårhøj committed
75
76
77
78
79
80
81
82

/**
 * Backend module providing boring statistics of the index-tables.
 *
 * @author	Kasper Skaarhoj <kasperYYYY@typo3.com>
 * @package TYPO3
 * @subpackage tx_indexedsearch
 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
83
84
85
86
87
88
89
90
91
class SC_mod_tools_isearch_index {
	var $MCONF=array();
	var $MOD_MENU=array();
	var $MOD_SETTINGS=array();
	var $doc;

	var $include_once=array();
	var $content;

Kasper Skårhøj's avatar
Kasper Skårhøj committed
92
93
	/**
	 * Initialization
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
94
95
	 *
	 * @return	[type]		...
Kasper Skårhøj's avatar
Kasper Skårhøj committed
96
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	function init()	{
		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->form='<form action="" method="POST">';
		$this->doc->backPath = $BACK_PATH;
				// JavaScript
		$this->doc->JScode = '
		<script language="javascript" type="text/javascript">
			script_ended = 0;
			function jumpToUrl(URL)	{
111
				window.location.href = URL;
Kasper Skårhøj's avatar
Kasper Skårhøj committed
112
113
114
115
116
117
118
119
120
			}
		</script>
		';
		$this->doc->tableLayout = Array (
			"defRow" => Array (
				"0" => Array('<td valign="top" nowrap>','</td>'),
				"defCol" => Array('<TD><img src="'.$this->doc->backPath.'clear.gif" width=10 height=1></td><td valign="top" nowrap>','</td>')
			)
		);
121
122
123

		$indexer = t3lib_div::makeInstance('tx_indexedsearch_indexer');
		$indexer->initializeExternalParsers();
124
125
		#debug(array_keys($indexer->external_parsers));
		#debug($indexer->internal_log);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
126
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
127
128
129
130
131
132

	/**
	 * [Describe function...]
	 *
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
	function menuConfig()	{
		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(
				"stat" => "General statistics",
				"typo3pages" => "List: TYPO3 Pages",
				"externalDocs" => "List: External documents",
			)
		);
			// CLEANSE SETTINGS
		$this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP("SET"), $this->MCONF["name"], "ses");
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
150
151
152
153
154
155

	/**
	 * [Describe function...]
	 *
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
	function main()	{
		global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;

		$this->content="";
		$this->content.=$this->doc->startPage("Indexing Engine Statistics");

		$menu=t3lib_BEfunc::getFuncMenu(0,"SET[function]",$this->MOD_SETTINGS["function"],$this->MOD_MENU["function"]);

		$this->content.=$this->doc->header("Indexing Engine Statistics");
		$this->content.=$this->doc->spacer(5);
		$this->content.=$this->doc->section('',$menu);

		switch($this->MOD_SETTINGS["function"])	{
			case "stat":
				$this->content.=$this->doc->section('Records',$this->doc->table($this->getRecordsNumbers()),0,1);
				$this->content.=$this->doc->spacer(15);
		//		$this->content.=$this->doc->section('index_phash STATISTICS',$this->doc->table($this->getPhashStat()),1);
		//		$this->content.=$this->doc->spacer(15);
				$this->content.=$this->doc->section('index_phash TYPES',$this->doc->table($this->getPhashTypes()),1);
				$this->content.=$this->doc->spacer(15);
			break;
			case "externalDocs":
				$this->content.=$this->doc->section('External documents',$this->doc->table($this->getPhashExternalDocs()),0,1);
				$this->content.=$this->doc->spacer(15);
			break;
			case "typo3pages":
				$this->content.=$this->doc->section('TYPO3 Pages',$this->doc->table($this->getPhashT3pages()),0,1);
				$this->content.=$this->doc->spacer(15);
			break;
		}
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
187
188
189
190
191
192

	/**
	 * [Describe function...]
	 *
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
193
194
195
196
197
198
	function printContent()	{
		$this->content.=$this->doc->endPage();
		echo $this->content;
	}


Kasper Skårhøj's avatar
Kasper Skårhøj committed
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213








	/***************************
	 *
	 * OTHER FUNCTIONS:
	 *
	 ***************************/

	/**
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
214
	 * @return	[type]		...
Kasper Skårhøj's avatar
Kasper Skårhøj committed
215
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
216
217
218
219
220
221
222
223
224
225
226
	function getRecordsNumbers()	{
		$tables=explode(",","index_phash,index_words,index_rel,index_grlist,index_section,index_fulltext");
		$recList=array();
		reset($tables);
		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;
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
227
228
229
230
231
232
233

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$str: ...
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
234
235
236
	function tableHead($str)	{
		return "<strong>".$str.":&nbsp;&nbsp;&nbsp;</strong>";
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
237
238
239
240
241
242

	/**
	 * [Describe function...]
	 *
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
243
244
245
246
247
	function getPhashStat()	{
		$recList = array();

			// TYPO3 pages, unique
		$items = array();
248
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*),phash', 'index_phash', 'data_page_id!=0', 'phash_grouping,pcount,phash');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
249
250
251
252
253
254
255
256
257
258
259
260
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res))	{
			$items[] = $row;
		}
		$recList[] = array($this->tableHead("TYPO3 pages"), count($items));

			// TYPO3 pages:
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'index_phash', 'data_page_id!=0');
		$row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
		$recList[] = array($this->tableHead("TYPO3 pages, raw"), $row[0]);

			// External files, unique
		$items = array();
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
261
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*),phash', 'index_phash', 'data_filename!=\'\'', 'phash_grouping');
262
263
		$row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
		$recList[] = array($this->tableHead("External files"), $row[0]);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
264
265

			// External files
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
266
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'index_phash', 'data_filename!=\'\'');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
267
268
269
270
271
		$row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
		$recList[] = array($this->tableHead("External files, raw"), $row[0]);

		return $recList;
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
272
273
274
275
276
277

	/**
	 * [Describe function...]
	 *
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
	function getPhashT3pages()	{
		$recList[]=array(
			$this->tableHead("id/type"),
			$this->tableHead("Title"),
			$this->tableHead("Size"),
			$this->tableHead("Words"),
			$this->tableHead("mtime"),
			$this->tableHead("Indexed"),
			$this->tableHead("Updated"),
			$this->tableHead("Parsetime"),
			$this->tableHead("#sec/gr/full"),
			$this->tableHead("#sub"),
			$this->tableHead("Lang"),
			$this->tableHead("cHash"),
			$this->tableHead("phash")
		);

			// TYPO3 pages, unique
296
		$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,freeIndexSetId', 'data_page_id');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
297
298
299
300
301
302
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{

			$cHash = count(unserialize($row["cHashParams"])) ? $this->formatCHash(unserialize($row["cHashParams"])) : "";
			$grListRec = $this->getGrlistRecord($row["phash"]);
			$recList[] = array(
				$row["data_page_id"].($row["data_page_type"]?"/".$row["data_page_type"]:""),
303
				htmlentities(t3lib_div::fixed_lgd_cs($row["item_title"],30)),
Kasper Skårhøj's avatar
Kasper Skårhøj committed
304
305
306
307
308
309
				t3lib_div::formatSize($row["item_size"]),
				$this->getNumberOfWords($row["phash"]),
				t3lib_BEfunc::datetime($row["item_mtime"]),
				t3lib_BEfunc::datetime($row["crdate"]),
				($row["tstamp"]!=$row["crdate"] ? t3lib_BEfunc::datetime($row["tstamp"]) : ""),
				$row["parsetime"],
310
311
				$this->getNumberOfSections($row["phash"])."/".$grListRec[0]["pcount"]."/".$this->getNumberOfFulltext($row["phash"]),
				$row["pcount"]."/".$this->formatFeGroup($grListRec),
Kasper Skårhøj's avatar
Kasper Skårhøj committed
312
313
314
315
316
				$row["sys_language_uid"],
				$cHash,
				$row["phash"]
			);

317
			if ($row["pcount"]>1)	{
Kasper Skårhøj's avatar
Kasper Skårhøj committed
318
319
320
321
322
323
324
325
326
327
328
329
				$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"]);
					$recList[] = array(
						"",
						"",
						t3lib_div::formatSize($row2["item_size"]),
						$this->getNumberOfWords($row2["phash"]),
						t3lib_BEfunc::datetime($row2["item_mtime"]),
						t3lib_BEfunc::datetime($row2["crdate"]),
						($row2["tstamp"]!=$row2["crdate"] ? t3lib_BEfunc::datetime($row2["tstamp"]) : ""),
						$row2["parsetime"],
330
						$this->getNumberOfSections($row2["phash"])."/".$grListRec[0]["pcount"]."/".$this->getNumberOfFulltext($row2["phash"]),
Kasper Skårhøj's avatar
Kasper Skårhøj committed
331
332
333
334
335
336
337
338
339
340
						"-/".$this->formatFeGroup($grListRec),
						"",
						"",
						$row2["phash"]
					);
				}
			}
		}
		return $recList;
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
341
342
343
344
345
346

	/**
	 * [Describe function...]
	 *
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
	function getPhashExternalDocs()	{
		$recList[]=array(
			$this->tableHead("Filename"),
			$this->tableHead("Size"),
			$this->tableHead("Words"),
			$this->tableHead("mtime"),
			$this->tableHead("Indexed"),
			$this->tableHead("Updated"),
			$this->tableHead("Parsetime"),
			$this->tableHead("#sec/gr/full"),
			$this->tableHead("#sub"),
			$this->tableHead("cHash"),
			$this->tableHead("phash"),
			$this->tableHead("Path")
		);

			// TYPO3 pages, unique
364
		$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,freeIndexSetId', 'item_type');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
365
366
367
368
369
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{

			$cHash = count(unserialize($row["cHashParams"])) ? $this->formatCHash(unserialize($row["cHashParams"])) : "";
			$grListRec = $this->getGrlistRecord($row["phash"]);
			$recList[]=array(
370
				htmlentities(t3lib_div::fixed_lgd_cs($row["item_title"],30)),
Kasper Skårhøj's avatar
Kasper Skårhøj committed
371
372
373
374
375
376
				t3lib_div::formatSize($row["item_size"]),
				$this->getNumberOfWords($row["phash"]),
				t3lib_BEfunc::datetime($row["item_mtime"]),
				t3lib_BEfunc::datetime($row["crdate"]),
				($row["tstamp"]!=$row["crdate"] ? t3lib_BEfunc::datetime($row["tstamp"]) : ""),
				$row["parsetime"],
377
378
				$this->getNumberOfSections($row["phash"])."/".$grListRec[0]["pcount"]."/".$this->getNumberOfFulltext($row["phash"]),
				$row["pcount"],
Kasper Skårhøj's avatar
Kasper Skårhøj committed
379
380
				$cHash,
				$row["phash"],
381
				htmlentities(t3lib_div::fixed_lgd_cs($row["data_filename"],100))
Kasper Skårhøj's avatar
Kasper Skårhøj committed
382
383
			);

384
			if ($row["pcount"]>1)	{
Kasper Skårhøj's avatar
Kasper Skårhøj committed
385
386
387
388
389
390
391
392
393
394
395
396
				$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"])) : "";
					$grListRec = $this->getGrlistRecord($row2["phash"]);
					$recList[]=array(
						"",
						"",
						$this->getNumberOfWords($row2["phash"]),
						"",
						t3lib_BEfunc::datetime($row2["crdate"]),
						($row2["tstamp"]!=$row2["crdate"] ? t3lib_BEfunc::datetime($row2["tstamp"]) : ""),
						$row2["parsetime"],
397
						$this->getNumberOfSections($row2["phash"])."/".$grListRec[0]["pcount"]."/".$this->getNumberOfFulltext($row2["phash"]),
Kasper Skårhøj's avatar
Kasper Skårhøj committed
398
399
400
401
402
403
404
405
406
407
408
						"",
						$cHash,
						$row2["phash"],
						""
					);
				}
			}
	//		debug($row);
		}
		return $recList;
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
409
410
411
412
413
414
415

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$fegroup_recs: ...
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
416
417
418
419
420
421
422
423
424
	function formatFeGroup($fegroup_recs)	{
		reset($fegroup_recs);
		$str = array();
		while(list(,$row)=each($fegroup_recs))	{
			$str[] = $row["gr_list"]=="0,-1" ? "NL" : $row["gr_list"];
		}
		arsort($str);
		return implode("|",$str);
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
425
426
427
428
429
430
431

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$arr: ...
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
432
433
434
435
	function formatCHash($arr)	{
		reset($arr);
		$list=array();
		while(list($k,$v)=each($arr))	{
436
			$list[] = htmlspecialchars($k) . '=' . htmlspecialchars($v);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
437
438
439
		}
		return implode("<BR>",$list);
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
440
441
442
443
444
445
446

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$phash: ...
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
447
448
449
450
451
	function getNumberOfSections($phash)	{
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'index_section', 'phash='.intval($phash));
		$row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
		return $row[0];
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
452
453
454
455
456
457
458

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$phash: ...
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
459
460
461
462
463
	function getNumberOfWords($phash)	{
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'index_rel', 'phash='.intval($phash));
		$row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
		return $row[0];
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
464
465
466
467
468
469
470

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$phash: ...
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
471
472
473
474
	function getGrlistRecord($phash)	{
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('index_grlist.*', 'index_grlist', 'phash='.intval($phash));
		$allRows = array();
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{
475
			$row["pcount"] = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
476
477
478
479
			$allRows[] = $row;
		}
		return $allRows;
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
480
481
482
483
484
485
486

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$phash: ...
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
487
488
489
490
491
	function getNumberOfFulltext($phash)	{
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'index_fulltext', 'phash='.intval($phash));
		$row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
		return $row[0];
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
492
493
494
495
496
497

	/**
	 * [Describe function...]
	 *
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
	function getPhashTypes()	{
		$recList=array();

		// Types:
		$Itypes = array(
			"html" => 1,
			"htm" => 1,
			"pdf" => 2,
			"doc" => 3,
			"txt" => 4
		);

		$revTypes=array_flip($Itypes);
		$revTypes[0]="TYPO3 page";

		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*),item_type', 'index_phash', '', 'item_type', 'item_type');
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res))	{
			$iT = $row[1];
			$recList[] = array($this->tableHead($revTypes[$iT]." ($iT)"), $this->countUniqueTypes($iT)."/".$row[0]);
		}

		return $recList;
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
521
522
523
524
525
526
527

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$item_type: ...
	 * @return	[type]		...
	 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
528
529
	function countUniqueTypes($item_type)	{
			// TYPO3 pages, unique
530
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'index_phash', 'item_type='.$GLOBALS['TYPO3_DB']->fullQuoteStr($item_type, 'index_phash'), 'phash_grouping');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
		$items = array();
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res))	{
			$items[] = $row;
		}
		return count($items);
	}
}

// Include extension?
if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/indexed_search/mod/index.php"])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/indexed_search/mod/index.php"]);
}












// Make instance:
$SOBE = t3lib_div::makeInstance("SC_mod_tools_isearch_index");
$SOBE->init();
$SOBE->main();
$SOBE->printContent();
?>