4 * FusionForge document search engine
6 * Copyright 2005, Fabio Bertagnin
7 * Copyright 2009, Roland Mas
8 * Copyright 2010-2011, Franck Villaume - Capgemini
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require dirname(__FILE__).'/../www/env.inc.php';
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfcommon.'docman/Parsedata.class.php';
29 require_once $gfcommon.'docman/Document.class.php';
30 require_once $gfcommon.'docman/DocumentFactory.class.php';
31 require_once $gfcommon.'docman/DocumentGroupFactory.class.php';
35 $timestarttrait = microtime_float();
38 $result = db_query_params('SELECT doc_data.docid, doc_data.group_id, doc_data.filename, doc_data.title, doc_data.filename, doc_data.description, doc_data.filetype 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)) {
52 foreach ($resarr as $item) {
54 $timestart = microtime_float();
55 $res = db_query_params('SELECT data from doc_data where docid = $1', array($item["docid"]));
57 die("unable to get data: ".db_error());
59 $data = base64_decode(db_result($res, 0, 'data'));
60 $lenin = strlen($data);
61 $res = $p->get_parse_data($data, $item["title"], $item["description"], $item["filetype"]);
63 $resUp = db_query_params('UPDATE doc_data SET data_words=$1 WHERE docid=$2',
64 array ($res, $item["docid"]));
66 die("unable to update data: ".db_error());
68 $timeend = microtime_float();
69 $timetrait = $timeend - $timestart;
70 echo "Analyzed $item[filename] : type=$item[filetype] octets in=$lenin octets out=$len time=$timetrait sec\n";
72 $timeendtrait = microtime_float();
73 $timetot = $timeendtrait - $timestarttrait;
74 db_query_params('UPDATE groups set force_docman_reindex = $1', array('0'));
75 //echo "End analyze : $compt files, $timetot secs.";
77 function microtime_float() {
78 list($usec, $sec) = explode(" ", microtime());
79 return ((float)$usec + (float)$sec);
84 // c-file-style: "bsd"