* Copyright 2005, Fabio Bertagnin
* Copyright 2009, Roland Mas
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
*
- * This file is part of FusionForge.
+ * This file is part of FusionForge. FusionForge 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 Licence, or (at your option)
+ * any later version.
*
- * FusionForge 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.
+ * FusionForge 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.
*
- * FusionForge 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require dirname(__FILE__).'/../www/env.inc.php';
require_once $gfcommon.'docman/DocumentFactory.class.php';
require_once $gfcommon.'docman/DocumentGroupFactory.class.php';
-$engine_path = dirname(__FILE__).'/../common/docman/engine/';
-$p = new Parsedata($engine_path);
+$p = new Parsedata();
$timestarttrait = microtime_float();
// documents list
}
if ($result) {
- while ($arr = db_fetch_array($result)) {
+ while ($arr = db_fetch_array($result)) {
$resarr[] = $arr;
}
}
foreach ($resarr as $item) {
$compt++;
$timestart = microtime_float();
- $doc_dataData = db_query_params('SELECT data from doc_data where docid = $1', array($item["docid"]));
- if (!$doc_dataData) {
+ $res = db_query_params('SELECT data from doc_data where docid = $1', array($item["docid"]));
+ if (!$res) {
die("unable to get data: ".db_error());
}
- $data1 = base64_decode($doc_dataData["data"]);
- $lenin = strlen($data1);
- $res = $p->get_parse_data($data1, $item["title"], $item["description"], $item["filetype"]);
+ $data = base64_decode(db_result($res, 0, 'data'));
+ $lenin = strlen($data);
+ $res = $p->get_parse_data($data, htmlspecialchars($item['title']), htmlspecialchars($item['description']), $item["filetype"]);
$len = strlen($res);
$resUp = db_query_params('UPDATE doc_data SET data_words=$1 WHERE docid=$2',
array ($res, $item["docid"]));
}
$timeend = microtime_float();
$timetrait = $timeend - $timestart;
- print_debug("analyze $item[filename] type=$item[filetype] octets in=$lenin octets out=$len time=$timetrait sec");
+ echo "Analyzed $item[filename] : type=$item[filetype] octets in=$lenin octets out=$len time=$timetrait sec\n";
}
$timeendtrait = microtime_float();
$timetot = $timeendtrait - $timestarttrait;
db_query_params('UPDATE groups set force_docman_reindex = $1', array('0'));
-//print_debug ("End analyze : $compt files, $timetot secs.");
-
-
-function print_debug ($text) {
- echo "$text\n";
-}
+//echo "End analyze : $compt files, $timetot secs.";
function microtime_float() {
list($usec, $sec) = explode(" ", microtime());