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