4 * FusionForge document search engine
6 * Copyright 2005, Fabio Bertagnin
7 * Copyright 2009, Roland Mas
9 * This file is part of FusionForge.
11 * FusionForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published
13 * by the Free Software Foundation; either version 2 of the License,
14 * or (at your option) any later version.
16 * FusionForge is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with FusionForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 require dirname(__FILE__).'/../www/env.inc.php';
29 require_once $gfwww.'include/pre.php';
30 require_once $gfwww.'docman/include/doc_utils.php';
31 require_once $gfcommon.'docman/Parsedata.class.php';
32 require_once $gfcommon.'docman/Document.class.php';
33 require_once $gfcommon.'docman/DocumentFactory.class.php';
34 require_once $gfcommon.'docman/DocumentGroupFactory.class.php';
36 $engine_path = $gfcommon.'docman/engine/';
37 $p = new Parsedata ($engine_path);
39 $timestarttrait = microtime_float();
42 $result = db_query_params ('SELECT docid, group_id, filename, title, createdate, filename, description, filetype, data FROM doc_data',
46 while ($arr = db_fetch_array($result))
54 foreach ($resarr as $item)
57 $timestart = microtime_float();
58 $data1 = base64_decode($item["data"]);
59 $lenin = strlen($data1);
60 $res = $p->get_parse_data ($data1, $item["title"], $item["description"], $item["filetype"]);
62 db_query_params ('UPDATE doc_data SET data_words=$1 WHERE docid=$2',
65 $timeend = microtime_float();
66 $timetrait = $timeend - $timestart;
67 print_debug ("analyze $item[filename] type=$item[filetype] octets in=$lenin octets out=$len time=$timetrait sec");
69 $timeendtrait = microtime_float();
70 $timetot = $timeendtrait - $timestarttrait;
71 print_debug ("End analyze : $compt files, $timetot secs.");
74 function print_debug ($text)
79 function microtime_float()
81 list($usec, $sec) = explode(" ", microtime());
82 return ((float)$usec + (float)$sec);
87 // c-file-style: "bsd"