4 * FusionForge document search engine
6 * Copyright 2005, Fabio Bertagnin
7 * Copyright 2009, Roland Mas
8 * Copyright 2010, Franck Villaume
10 * This file is part of FusionForge.
12 * FusionForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published
14 * by the Free Software Foundation; either version 2 of the License,
15 * or (at your option) any later version.
17 * FusionForge is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with FusionForge; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28 require dirname(__FILE__).'/../www/env.inc.php';
29 require_once $gfcommon.'include/pre.php';
30 require_once $gfcommon.'docman/Parsedata.class.php';
31 require_once $gfcommon.'docman/Document.class.php';
32 require_once $gfcommon.'docman/DocumentFactory.class.php';
33 require_once $gfcommon.'docman/DocumentGroupFactory.class.php';
35 $engine_path = dirname(__FILE__).'/../common/docman/engine/';
36 $p = new Parsedata ($engine_path);
38 $timestarttrait = microtime_float();
41 $result = db_query_params ('SELECT doc_data.docid, doc_data.group_id, doc_data.filename, doc_data.title, doc_data.createdate, doc_data.filename, doc_data.description, doc_data.filetype,doc_data.data from doc_data,groups where doc_data.group_id = groups.group_id and groups.force_docman_reindex = $1',
45 while ($arr = db_fetch_array($result))
53 foreach ($resarr as $item)
56 $timestart = microtime_float();
57 $data1 = base64_decode($item["data"]);
58 $lenin = strlen($data1);
59 $res = $p->get_parse_data ($data1, $item["title"], $item["description"], $item["filetype"]);
61 db_query_params ('UPDATE doc_data SET data_words=$1 WHERE docid=$2',
64 $timeend = microtime_float();
65 $timetrait = $timeend - $timestart;
66 print_debug ("analyze $item[filename] type=$item[filetype] octets in=$lenin octets out=$len time=$timetrait sec");
68 $timeendtrait = microtime_float();
69 $timetot = $timeendtrait - $timestarttrait;
70 db_query_params('UPDATE groups set force_docman_reindex = $1', array('0'));
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"