mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
version 3.1.20
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
require_once dirname( __FILE__ ) . "/../lib/bootstrap_task.php";
|
||||
phrasea::start(); // because it's not done in bootstrap_task.php anymore to low the number of actives cnx
|
||||
$session = session::getInstance(); // because it's not done in bootstrap_task.php anymore to low the number of actives cnx
|
||||
|
||||
$argt = array(
|
||||
"--help" => array("set"=>false, "values"=>array(), "usage"=>"[={task_id|classname}] : this help | help of task {task_id} | help of {classname}"),
|
||||
"--display_errors" => array("set"=>false, "values"=>array(), "usage"=>" : force php ini_set('display_errors', 1)"),
|
||||
@@ -212,10 +215,11 @@ if(!parse_cmdargs($ztask->argt, $err, true) ) // || $argt["--help"]["set"])
|
||||
{
|
||||
print($err);
|
||||
// print("parsing argt\n");
|
||||
print(getUsage($argt));
|
||||
// print(getUsage($argt, false));
|
||||
// printf("parsing ztask->argt (%s)\n", var_export($ztask->argt, true));
|
||||
print(getUsage($ztask->argt, false));
|
||||
flush();
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
require_once dirname( __FILE__ ) . "/../lib/bootstrap_task.php";
|
||||
phrasea::start();
|
||||
$session = session::getInstance();
|
||||
|
||||
|
||||
require_once(GV_RootPath."lib/index_utils2.php");
|
||||
|
||||
$argt = array(
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . "/../lib/bootstrap_task.php";
|
||||
|
||||
|
||||
define('TASKDELAYTOQUIT', 20); // allow 20 sec for never-ending tasks before sending SIGKILL
|
||||
?>
|
||||
#!/usr/bin/php
|
||||
@@ -176,7 +178,7 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
$conn->query($sql);
|
||||
|
||||
// if scheduler is stopped, stop the tasks
|
||||
$sql = 'UPDATE task2 SET status=\'tostop\' WHERE status!="stopped" and status!="manual"';
|
||||
$sql = 'UPDATE task2 SET status=\'tostop\', last_change=NOW() WHERE status!="stopped" and status!="manual"';
|
||||
$conn->query($sql);
|
||||
|
||||
$msg = sprintf("schedstatus == 'stopping', waiting tasks to end");
|
||||
@@ -283,7 +285,7 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
$ttask[$tkey]["process"] = null;
|
||||
if($schedstatus == 'started')
|
||||
{
|
||||
$sql = 'UPDATE task2 SET status=\'tostart\' WHERE task_id="' . $conn->escape_string($ttask[$tkey]["tid"]) . '"';
|
||||
$sql = 'UPDATE task2 SET status=\'tostart\', last_change=NOW() WHERE task_id="' . $conn->escape_string($ttask[$tkey]["tid"]) . '"';
|
||||
$conn->query($sql);
|
||||
}
|
||||
break;
|
||||
@@ -318,7 +320,7 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
}
|
||||
if ($ttask[$tkey]['pid'] !== NULL)
|
||||
{
|
||||
$sql = 'UPDATE task2 SET status=\'started\' WHERE task_id="' . $conn->escape_string($ttask[$tkey]['tid']) . '"';
|
||||
$sql = 'UPDATE task2 SET status=\'started\', last_change=NOW() WHERE task_id="' . $conn->escape_string($ttask[$tkey]['tid']) . '"';
|
||||
$conn->query($sql);
|
||||
$msg = sprintf("Task %s '%s' started (pid=%s)", $ttask[$tkey]["tid"], $cmd, $ttask[$tkey]['pid']);
|
||||
my_syslog(LOG_INFO, $msg);
|
||||
@@ -336,9 +338,9 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
$msg = sprintf("Task %s '%s' failed to start %d times", $ttask[$tkey]["tid"], $cmd, $ttask[$tkey]["crashed"]);
|
||||
my_syslog(LOG_INFO, $msg);
|
||||
if ($ttask[$tkey]["crashed"] >= 5)
|
||||
$sql = "UPDATE task2 SET status='stopped', pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$sql = "UPDATE task2 SET status='stopped', last_change=NOW(), pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
else
|
||||
$sql = "UPDATE task2 SET status='tostart', pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$sql = "UPDATE task2 SET status='tostart', last_change=NOW(), pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$conn->query($sql);
|
||||
}
|
||||
}
|
||||
@@ -392,9 +394,9 @@ while ($schedstatus == 'started' || $runningtask > 0)
|
||||
$msg = sprintf("Task %s crashed %d times", $ttask[$tkey]["tid"], $ttask[$tkey]["crashed"]);
|
||||
my_syslog(LOG_INFO, $msg);
|
||||
if ($ttask[$tkey]["crashed"] >= 5)
|
||||
$sql = "UPDATE task2 SET status='stopped', pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$sql = "UPDATE task2 SET status='stopped', last_change=NOW(), pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
else
|
||||
$sql = "UPDATE task2 SET status='tostart', pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$sql = "UPDATE task2 SET status='tostart', last_change=NOW(), pid=0, crashed=crashed+1 WHERE task_id='" . $conn->escape_string($ttask[$tkey]['tid']) . "'";
|
||||
$conn->query($sql);
|
||||
}
|
||||
break;
|
||||
|
@@ -1,3 +1,6 @@
|
||||
3.7.1.1
|
||||
fix some bad types (long/int)
|
||||
|
||||
3.7.1.0
|
||||
candidates terms can be filtered using the property 'candidates="str"' in structure/field :
|
||||
"str" is a string of characters (flags, in any order) to allow candidates for different kind of terms
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
|
||||
AC_INIT([phraseanet_indexer], [3.6.1.1])
|
||||
AC_INIT([phraseanet_indexer], [3.7.1.1])
|
||||
|
||||
AM_INIT_AUTOMAKE(no-dependencies no-define no-dist no-installinfo)
|
||||
|
||||
@@ -21,11 +21,11 @@ XTRAINCPATHS="-I/usr/include/libxml2/"
|
||||
# Checks for MySQL lib
|
||||
AC_MSG_CHECKING([MySQL client library])
|
||||
for i in / /usr /usr/local /opt/local; do
|
||||
if test -r $i/lib/libmysqlclient.a; then
|
||||
if test -r $i/lib/libmysqlclient.so -o -r $i/lib/libmysqlclient.dylib; then
|
||||
MYSQL_LIBDIR=$i/lib/
|
||||
elif test -r $i/lib/mysql/libmysqlclient.a; then
|
||||
elif test -r $i/lib/mysql/libmysqlclient.so -o -r $i/lib/mysql/libmysqlclient.dylib; then
|
||||
MYSQL_LIBDIR=$i/lib/mysql/
|
||||
elif test -r $i/lib/mysql5/mysql/libmysqlclient.a; then
|
||||
elif test -r $i/lib/mysql5/mysql/libmysqlclient.so -o -r $i/lib/mysql5/mysql/libmysqlclient.dylib; then
|
||||
MYSQL_LIBDIR=$i/lib/mysql5/mysql/
|
||||
fi
|
||||
done
|
||||
|
@@ -20,7 +20,7 @@
|
||||
//
|
||||
|
||||
#ifndef PHDOTVERSION
|
||||
#define PHDOTVERSION 3.7.1.0
|
||||
#define PHDOTVERSION 3.7.1.1
|
||||
#endif
|
||||
//
|
||||
//=======================================================================
|
||||
|
@@ -27,7 +27,7 @@
|
||||
// prototypes local fcts
|
||||
void evt_start(CDOMDocument *xmlparser, const char *name, const char *path, const char *upath);
|
||||
void evt_end(CDOMDocument *xmlparser);
|
||||
void evt_keyword(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, UINT32 pos, UINT32 len, UINT32 index);
|
||||
void evt_keyword(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, unsigned int pos, unsigned int len, unsigned int index);
|
||||
|
||||
// prototypes external fcts
|
||||
extern CSyslog zSyslog; // , LOG_PID, LOG_DAEMON);
|
||||
@@ -527,7 +527,7 @@ void evt_end(CDOMDocument *xmlparser)
|
||||
// ----------------------------------------------
|
||||
// the parser met a keyword
|
||||
// ----------------------------------------------
|
||||
void evt_keyword(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, UINT32 pos, UINT32 len, UINT32 index)
|
||||
void evt_keyword(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, unsigned int pos, unsigned int len, unsigned int index)
|
||||
{
|
||||
CIndexer *indexer = (CIndexer *)(xmlparser->userData);
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "_syslog.h"
|
||||
|
||||
#include "trace_memory.h"
|
||||
#include "phrasea_clock_t.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
@@ -302,6 +303,7 @@ unsigned int CMysqlStmt::errNo()
|
||||
|
||||
int CMysqlStmt::execute()
|
||||
{
|
||||
CHRONO chrono;
|
||||
int r;
|
||||
if(this->connbas->crashed)
|
||||
{
|
||||
@@ -311,10 +313,12 @@ int CMysqlStmt::execute()
|
||||
}
|
||||
try
|
||||
{
|
||||
startChrono(chrono);
|
||||
if((r = mysql_stmt_execute(this->stmt)) != 0)
|
||||
{
|
||||
if(this->debug)
|
||||
zSyslog.log(CSyslog::LOGL_ERR, CSyslog::LOGC_SQLERR, "CMysqlStmt::execute : mysql_stmt_execute error (%d) : '%s', return(%d)", this->errNo(), this->error(), r);
|
||||
|
||||
switch(this->errNo())
|
||||
{
|
||||
// erreurs non fatales
|
||||
@@ -340,6 +344,11 @@ int CMysqlStmt::execute()
|
||||
// this->connbas->crashed = 1;
|
||||
return(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this->debug)
|
||||
zSyslog.log(CSyslog::LOGL_ERR, CSyslog::LOGC_SQLERR, "CMysqlStmt::execute : %s : %f sec", this->sql, stopChrono(chrono));
|
||||
}
|
||||
return(r);
|
||||
}
|
||||
catch(...)
|
||||
|
@@ -232,7 +232,7 @@ int CConnbas_dbox::updatePref_cterms(char *cterms, unsigned long cterms_size, ch
|
||||
// ---------------------------------------------------------------
|
||||
// SELECT CAST(value AS UNSIGNED), updated_on<created_on AS k FROM pref WHERE prop='indexes' LIMIT 1
|
||||
// ---------------------------------------------------------------
|
||||
int CConnbas_dbox::selectPrefsIndexes(long *value, long *toReindex)
|
||||
int CConnbas_dbox::selectPrefsIndexes(int *value, int *toReindex)
|
||||
{
|
||||
int ret = 0;
|
||||
if(this->cstmt_needReindex == NULL)
|
||||
@@ -250,8 +250,6 @@ int CConnbas_dbox::selectPrefsIndexes(long *value, long *toReindex)
|
||||
}
|
||||
if(this->cstmt_needReindex)
|
||||
{
|
||||
// long value, k;
|
||||
|
||||
this->cstmt_needReindex->bindo[0].buffer = value;
|
||||
this->cstmt_needReindex->bindo[1].buffer = toReindex;
|
||||
|
||||
@@ -652,7 +650,7 @@ unsigned int CConnbas_dbox::getID(const char *name, unsigned int n )
|
||||
this->cstmt_selectUid->bindi[0].buffer_length = lencpy;
|
||||
this->cstmt_selectUid->bindi[0].length = &lencpy;
|
||||
|
||||
unsigned long uid;
|
||||
unsigned int uid;
|
||||
this->cstmt_selectUid->bindo[0].buffer = (void *)(&uid);
|
||||
|
||||
if (this->cstmt_selectUid->bind_param() == 0)
|
||||
@@ -1151,8 +1149,8 @@ int CConnbas_dbox::scanRecords(void (*callBack)(CConnbas_dbox *connbas, unsigned
|
||||
unsigned int record_id;
|
||||
int ret = -1;
|
||||
|
||||
long prefsIndexes_value = 1;
|
||||
long prefsIndexes_toReindex = 0;
|
||||
int prefsIndexes_value = 1;
|
||||
int prefsIndexes_toReindex = 0;
|
||||
|
||||
//printf("-- 1\n");
|
||||
if(!this->cstmt_selectRecords)
|
||||
@@ -1238,290 +1236,6 @@ int CConnbas_dbox::scanRecords(void (*callBack)(CConnbas_dbox *connbas, unsigned
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
// ---------------------------------------------------------------
|
||||
// SELECT record_id, xml FROM record ORDER BY record_id
|
||||
// ---------------------------------------------------------------
|
||||
int CConnbas_dbox::scanRecords(void (*callBack)(CConnbas_dbox *connbas, unsigned long record_id, char *xml, unsigned long len), int *running )
|
||||
{
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id>=5313 LIMIT 10";
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id>=18573 LIMIT 50";
|
||||
static char *sql = "SELECT record_id, xml FROM record WHERE (status & 7) IN (4,5,6) ORDER BY record_id ASC"; // LIMIT 10";
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id=100077"; // LIMIT 10";
|
||||
MYSQL_STMT *stmt;
|
||||
unsigned long record_id;
|
||||
char *xml=NULL;
|
||||
unsigned long xmlbuffer_length = 0;
|
||||
|
||||
unsigned long xml_length;
|
||||
MYSQL_BIND bindo[2];
|
||||
int ret = 0;
|
||||
|
||||
if(!this->cstmt_selectRecords)
|
||||
{
|
||||
if(this->cstmt_selectRecords = this->newStmt("SELECT record_id, xml FROM record WHERE (status & 7) IN (4,5,6) ORDER BY record_id ASC", 0, 2))
|
||||
{
|
||||
this->cstmt_selectRecords->bindo[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
|
||||
this->cstmt_selectRecords->bindo[1].buffer_type = MYSQL_TYPE_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
if(this->cstmt_selectRecords)
|
||||
{
|
||||
this->cstmt_selectRecords->bindo[0].buffer = (void *)(&record_id);
|
||||
|
||||
this->cstmt_selectRecords->bindo[1].buffer = (void *)(&xml);
|
||||
this->cstmt_selectRecords->bindo[1].buffer_length = 150;
|
||||
this->cstmt_selectRecords->bindo[1].length = &xpath_length;
|
||||
|
||||
// static my_ulonglong last_numr = 123465;
|
||||
printf("-- 1\n");
|
||||
if( (xml = (char *)(_MALLOC_WHY(xmlbuffer_length = 4096, "connbas_dbox.cpp:scanRecords:xml"))) == NULL)
|
||||
{
|
||||
// malloc error
|
||||
return(2);
|
||||
}
|
||||
|
||||
if( (stmt = mysql_stmt_init(this->mysqlCnx)) != NULL)
|
||||
{
|
||||
printf("-- 2\n");
|
||||
if(mysql_stmt_prepare(stmt, sql, strlen(sql)) == 0)
|
||||
{
|
||||
printf("-- 3\n");
|
||||
if(mysql_stmt_execute(stmt) == 0)
|
||||
{
|
||||
printf("-- 4\n");
|
||||
memset(bindo, 0, sizeof(bindo));
|
||||
|
||||
bindo[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
bindo[0].buffer = (void *)(&record_id);
|
||||
// bind[0].length = ; // ignored for numeric types
|
||||
// bind[0].buffer_length = ; // ignored for numeric types
|
||||
bindo[0].is_null = (my_bool*)0; // data is always not null
|
||||
bindo[0].is_unsigned = 1;
|
||||
|
||||
bindo[1].buffer_type = MYSQL_TYPE_STRING;
|
||||
bindo[1].buffer = (void *)(xml);
|
||||
bindo[1].buffer_length = xmlbuffer_length;
|
||||
bindo[1].length = &xml_length;
|
||||
bindo[1].is_null = (my_bool*)0; // data is always not null
|
||||
// bind[1].is_unsigned = 1; // ignored for string type
|
||||
|
||||
// Bind the result buffers
|
||||
if(mysql_stmt_bind_result(stmt, bindo) == 0)
|
||||
{
|
||||
printf("-- 5\n");
|
||||
if(mysql_stmt_store_result(stmt) == 0)
|
||||
{
|
||||
int row_count = 0;
|
||||
// my_ulonglong num_rows = mysql_stmt_num_rows(stmt);
|
||||
// if(num_rows > 0 || last_numr != 0)
|
||||
printf("----------- scanRecords found %ld ---------\n", 666);
|
||||
//last_numr = num_rows;
|
||||
while(!this->crashed && *running && ret==0 && mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
// printf("rid=%ld, xml_length=%ld\n", record_id, xml_length);
|
||||
if(xml_length > xmlbuffer_length)
|
||||
{
|
||||
if(xml = (char *)_REALLOC((void *)xml, xmlbuffer_length = xml_length+1024))
|
||||
{
|
||||
bindo[1].buffer = (void *)(xml);
|
||||
bindo[1].buffer_length = xmlbuffer_length;
|
||||
mysql_stmt_bind_result(stmt, bindo);
|
||||
// printf("buffer reallocated to %ld\n", xmlbuffer_length);
|
||||
|
||||
mysql_stmt_data_seek(stmt, row_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
// realloc error
|
||||
ret = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("xml(%ld) read\n", xml_length);
|
||||
(*callBack)(this, record_id, xml, xml_length);
|
||||
row_count++;
|
||||
}
|
||||
// if(keyword_length > 64)
|
||||
// keyword_length = 64;
|
||||
// keyword[keyword_length] = '\0';
|
||||
}
|
||||
mysql_stmt_free_result(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_store_result error
|
||||
ret = 6;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_bind_result error
|
||||
ret = 5;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_execute error
|
||||
zSyslog.log(CSyslog::LOGL_ERR, CSyslog::LOGC_SQLERR, "%s", mysql_stmt_error(stmt));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_prepare error
|
||||
ret = 4;
|
||||
}
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_init error
|
||||
ret = 3;
|
||||
}
|
||||
//_FREE(xml);
|
||||
_FREE(xml);
|
||||
return(ret);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// ---------------------------------------------------------------
|
||||
// SELECT record_id, xml FROM record ORDER BY record_id
|
||||
// ---------------------------------------------------------------
|
||||
int CConnbas_dbox::scanRecords(void (*callBack)(CConnbas_dbox *connbas, unsigned long record_id, char *xml, unsigned long len), int *running )
|
||||
{
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id>=5313 LIMIT 10";
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id>=18573 LIMIT 50";
|
||||
static char *sql = "SELECT record_id, xml FROM record WHERE (status & 7) IN (4,5,6) ORDER BY record_id ASC"; // LIMIT 10";
|
||||
// static char *sql = "SELECT record_id, xml FROM record WHERE record_id=100077"; // LIMIT 10";
|
||||
MYSQL_STMT *stmt;
|
||||
unsigned long record_id;
|
||||
char *xml=NULL;
|
||||
unsigned long xmlbuffer_length = 0;
|
||||
|
||||
unsigned long xml_length;
|
||||
MYSQL_BIND bindo[2];
|
||||
int ret = 0;
|
||||
|
||||
// static my_ulonglong last_numr = 123465;
|
||||
printf("-- 1\n");
|
||||
if( (xml = (char *)(_MALLOC_WHY(xmlbuffer_length = 4096, "connbas_dbox.cpp:scanRecords:xml"))) == NULL)
|
||||
{
|
||||
// malloc error
|
||||
return(2);
|
||||
}
|
||||
|
||||
if( (stmt = mysql_stmt_init(this->mysqlCnx)) != NULL)
|
||||
{
|
||||
printf("-- 2\n");
|
||||
if(mysql_stmt_prepare(stmt, sql, strlen(sql)) == 0)
|
||||
{
|
||||
printf("-- 3\n");
|
||||
if(mysql_stmt_execute(stmt) == 0)
|
||||
{
|
||||
printf("-- 4\n");
|
||||
memset(bindo, 0, sizeof(bindo));
|
||||
|
||||
bindo[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
bindo[0].buffer = (void *)(&record_id);
|
||||
// bind[0].length = ; // ignored for numeric types
|
||||
// bind[0].buffer_length = ; // ignored for numeric types
|
||||
bindo[0].is_null = (my_bool*)0; // data is always not null
|
||||
bindo[0].is_unsigned = 1;
|
||||
|
||||
bindo[1].buffer_type = MYSQL_TYPE_STRING;
|
||||
bindo[1].buffer = (void *)(xml);
|
||||
bindo[1].buffer_length = xmlbuffer_length;
|
||||
bindo[1].length = &xml_length;
|
||||
bindo[1].is_null = (my_bool*)0; // data is always not null
|
||||
// bind[1].is_unsigned = 1; // ignored for string type
|
||||
|
||||
// Bind the result buffers
|
||||
if(mysql_stmt_bind_result(stmt, bindo) == 0)
|
||||
{
|
||||
printf("-- 5\n");
|
||||
if(mysql_stmt_store_result(stmt) == 0)
|
||||
{
|
||||
int row_count = 0;
|
||||
// my_ulonglong num_rows = mysql_stmt_num_rows(stmt);
|
||||
// if(num_rows > 0 || last_numr != 0)
|
||||
printf("----------- scanRecords found %ld ---------\n", 666);
|
||||
//last_numr = num_rows;
|
||||
while(!this->crashed && *running && ret==0 && mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
// printf("rid=%ld, xml_length=%ld\n", record_id, xml_length);
|
||||
if(xml_length > xmlbuffer_length)
|
||||
{
|
||||
if(xml = (char *)_REALLOC((void *)xml, xmlbuffer_length = xml_length+1024))
|
||||
{
|
||||
bindo[1].buffer = (void *)(xml);
|
||||
bindo[1].buffer_length = xmlbuffer_length;
|
||||
mysql_stmt_bind_result(stmt, bindo);
|
||||
// printf("buffer reallocated to %ld\n", xmlbuffer_length);
|
||||
|
||||
mysql_stmt_data_seek(stmt, row_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
// realloc error
|
||||
ret = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("xml(%ld) read\n", xml_length);
|
||||
(*callBack)(this, record_id, xml, xml_length);
|
||||
row_count++;
|
||||
}
|
||||
//if(keyword_length > 64)
|
||||
// keyword_length = 64;
|
||||
//keyword[keyword_length] = '\0';
|
||||
|
||||
}
|
||||
mysql_stmt_free_result(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_store_result error
|
||||
ret = 6;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_bind_result error
|
||||
ret = 5;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_execute error
|
||||
zSyslog.log(CSyslog::LOGL_ERR, CSyslog::LOGC_SQLERR, "%s", mysql_stmt_error(stmt));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_prepare error
|
||||
ret = 4;
|
||||
}
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mysql_stmt_init error
|
||||
ret = 3;
|
||||
}
|
||||
//_FREE(xml);
|
||||
_FREE(xml);
|
||||
return(ret);
|
||||
}
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// INSERT INTO thit (record_id, xpath_id, name, value, hitstart, hitlen) VALUES (?, ?, ?, ?, ?, ?)
|
||||
@@ -1703,121 +1417,11 @@ int CConnbas_dbox::updateRecord_unlock(unsigned int record_id)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
int CConnbas_dbox::lockRecord(unsigned int record_id)
|
||||
{
|
||||
this->parms_updateRecord_xlock.id = record_id;
|
||||
return(mysql_stmt_execute(this->stmt_updateRecord_lock));
|
||||
}
|
||||
|
||||
int CConnbas_dbox::unlockRecord(unsigned int record_id)
|
||||
{
|
||||
this->parms_updateRecord_xlock.id = record_id;
|
||||
return(mysql_stmt_execute(this->stmt_updateRecord_unlock));
|
||||
}
|
||||
|
||||
|
||||
int CConnbas_dbox::addTHit(unsigned int record_id, unsigned int xpath_id, unsigned char *name, unsigned char *value, unsigned int hitstart, unsigned int hitlen)
|
||||
{
|
||||
int ret;
|
||||
this->parms_insertTHit.record_id = record_id;
|
||||
this->parms_insertTHit.xpath_id = xpath_id;
|
||||
if( (this->parms_insertTHit.name_length = strlen((char *)name)) > 32)
|
||||
this->parms_insertTHit.name_length = 32;
|
||||
memcpy(this->parms_insertTHit.name, name, this->parms_insertTHit.name_length);
|
||||
if( (this->parms_insertTHit.value_length = strlen((char *)value)) > 100)
|
||||
this->parms_insertTHit.value_length = 100;
|
||||
memcpy(this->parms_insertTHit.value, value, this->parms_insertTHit.value_length);
|
||||
this->parms_insertTHit.hitstart = hitstart;
|
||||
this->parms_insertTHit.hitlen = hitlen;
|
||||
ret = mysql_stmt_execute(this->stmt_insertTHit);
|
||||
if(ret != 0)
|
||||
printf("%s \n", mysql_stmt_error(this->stmt_insertTHit) );
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int CConnbas_dbox::addProp(unsigned int record_id, unsigned int xpath_id, unsigned char *name, unsigned char *value)
|
||||
{
|
||||
this->parms_insertProp.record_id = record_id;
|
||||
this->parms_insertProp.xpath_id = xpath_id;
|
||||
if( (this->parms_insertProp.name_length = strlen((char *)name)) > 32)
|
||||
this->parms_insertProp.name_length = 32;
|
||||
memcpy(this->parms_insertProp.name, name, this->parms_insertProp.name_length);
|
||||
if( (this->parms_insertProp.value_length = strlen((char *)value)) > 100)
|
||||
this->parms_insertProp.value_length = 100;
|
||||
memcpy(this->parms_insertProp.value, value, this->parms_insertProp.value_length);
|
||||
return(mysql_stmt_execute(this->stmt_insertProp) == 0);
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void CConnbas_dbox::close()
|
||||
{
|
||||
this->isok = false;
|
||||
/*
|
||||
CMysqlStmt *stmt;
|
||||
while(stmt = this->firstStmt)
|
||||
{
|
||||
this->firstStmt = stmt->next;
|
||||
delete stmt;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if(this->cstmt_updatePref_cterms)
|
||||
{
|
||||
delete(this->cstmt_updatePref_cterms);
|
||||
this->cstmt_updatePref_cterms = NULL;
|
||||
}
|
||||
if(this->cstmt_selectPref_moddates)
|
||||
{
|
||||
delete(this->cstmt_selectPref_moddates);
|
||||
this->cstmt_selectPref_moddates = NULL;
|
||||
}
|
||||
if(this->cstmt_insertKword)
|
||||
{
|
||||
delete(this->cstmt_insertKword);
|
||||
this->cstmt_insertKword = NULL;
|
||||
}
|
||||
if(this->cstmt_selectKword)
|
||||
{
|
||||
delete(this->cstmt_selectKword);
|
||||
this->cstmt_selectKword = NULL;
|
||||
}
|
||||
if(this->cstmt_insertIdx)
|
||||
{
|
||||
delete(this->cstmt_insertIdx);
|
||||
this->cstmt_insertIdx = NULL;
|
||||
}
|
||||
if(this->cstmt_selectXPath)
|
||||
{
|
||||
delete(this->cstmt_selectXPath);
|
||||
this->cstmt_selectXPath = NULL;
|
||||
}
|
||||
if(this->cstmt_insertXPath)
|
||||
{
|
||||
delete(this->cstmt_insertXPath);
|
||||
this->cstmt_insertXPath = NULL;
|
||||
}
|
||||
if(this->cstmt_updateUids)
|
||||
{
|
||||
delete(this->cstmt_updateUids);
|
||||
this->cstmt_updateUids = NULL;
|
||||
}
|
||||
if(this->cstmt_selectUid)
|
||||
{
|
||||
delete(this->cstmt_selectUid);
|
||||
this->cstmt_selectUid = NULL;
|
||||
}
|
||||
if(this->cstmt_selectPrefs)
|
||||
{
|
||||
delete(this->cstmt_selectPrefs);
|
||||
this->cstmt_selectPrefs = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
if(this->struct_buffer)
|
||||
{
|
||||
_FREE(this->struct_buffer);
|
||||
@@ -1843,34 +1447,6 @@ void CConnbas_dbox::close()
|
||||
this->xml_buffer_size = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
if(this->stmt_insertTHit)
|
||||
{
|
||||
mysql_stmt_close(this->stmt_insertTHit);
|
||||
this->stmt_insertTHit = NULL;
|
||||
}
|
||||
if(this->stmt_insertProp)
|
||||
{
|
||||
mysql_stmt_close(this->stmt_insertProp);
|
||||
this->stmt_insertProp = NULL;
|
||||
}
|
||||
|
||||
|
||||
if(this->stmt_updateRecord_lock)
|
||||
{
|
||||
mysql_stmt_close(this->stmt_updateRecord_lock);
|
||||
this->stmt_updateRecord_lock = NULL;
|
||||
}
|
||||
|
||||
if(this->stmt_updateRecord_unlock)
|
||||
{
|
||||
mysql_stmt_close(this->stmt_updateRecord_unlock);
|
||||
this->stmt_updateRecord_unlock = NULL;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
CConnbas::close();
|
||||
}
|
||||
|
||||
|
@@ -185,7 +185,7 @@ class CConnbas_dbox:public CConnbas
|
||||
int updateRecord_unlock(unsigned int record_id);
|
||||
int updateRecord_unlock2(char *lrid, unsigned long lrid_len);
|
||||
|
||||
int selectPrefsIndexes(long *value, long *toReindex);
|
||||
int selectPrefsIndexes(int *value, int *toReindex);
|
||||
void reindexAll();
|
||||
// int sql_connect();
|
||||
// int getPrefsDates(unsigned long *struct_moddate, unsigned long *thesaurus_moddate, unsigned long *cterms_moddate);
|
||||
|
@@ -161,7 +161,7 @@ void XMLCALL CDOMDocument::charHandler(void *userData, const XML_Char *xmls, int
|
||||
{
|
||||
int i;
|
||||
unsigned char c0, c;
|
||||
UINT32 u, msk;
|
||||
unsigned int u, msk;
|
||||
unsigned char nBytes;
|
||||
unsigned char nLowBytes;
|
||||
unsigned char *s = (unsigned char *)xmls;
|
||||
@@ -219,14 +219,14 @@ void XMLCALL CDOMDocument::charHandler(void *userData, const XML_Char *xmls, int
|
||||
// 11xxxxxx : multi bytes character
|
||||
unsigned char flags = CFLAG_NORMALCHAR;
|
||||
_this->tokBin[_this->tokBinLen++] = c0;
|
||||
u = ((UINT32) c0) & 0x0000001F;
|
||||
u = ((unsigned int) c0) & 0x0000001F;
|
||||
msk = 0xFFFFFF7F;
|
||||
nBytes = 1;
|
||||
// read max 6 bytes
|
||||
while(len && ((c0 <<= 1) & 0x80) && (((c = *s) & 0xC0) == 0x80) && ++nBytes <= 6)
|
||||
{
|
||||
_this->tokBin[_this->tokBinLen++] = c;
|
||||
u = (u<<6 & (msk = (msk<<5) | 0x1F)) | (UINT32)(c & 0x3F);
|
||||
u = (u<<6 & (msk = (msk<<5) | 0x1F)) | (unsigned int)(c & 0x3F);
|
||||
len--;
|
||||
i++;
|
||||
s++;
|
||||
@@ -327,7 +327,7 @@ void XMLCALL CDOMDocument::charHandler(void *userData, const XML_Char *xmls, int
|
||||
// _this->currentNode->index_start = index+i;
|
||||
// _this->currentNode->index_end = index+i;
|
||||
}
|
||||
u = (UINT32) c0;
|
||||
u = (unsigned int) c0;
|
||||
nLowBytes = nBytes = 1;
|
||||
|
||||
}
|
||||
@@ -390,84 +390,10 @@ CDOMDocument::CDOMDocument()
|
||||
XML_SetElementHandler(this->parser, this->start, this->end );
|
||||
XML_SetCharacterDataHandler(this->parser, this->charHandler);
|
||||
XML_SetCdataSectionHandler(this->parser, this->startCdata, this->endCdata);
|
||||
/*
|
||||
// unsigned char t[] = "\t\r\n !\"#$%&'()+,-./:;<=>@[\\]^_`{|}~<7E><><EFBFBD><EFBFBD>" ;
|
||||
unsigned char t[] = "\t\r\n !\"#$%&'()+,-./:;=@[\\]^_`{|}~<7E><><EFBFBD><EFBFBD>" ;
|
||||
size_t i;
|
||||
for(i=0; i<256; i++)
|
||||
{
|
||||
this->charFlags[i] = 0;
|
||||
}
|
||||
for(i=0; i<strlen((const char *)t); i++)
|
||||
{
|
||||
this->charFlags[t[i]] |= 1;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
/*
|
||||
bool CDOMDocument::load(char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
long filesize;
|
||||
int bytes_read;
|
||||
void *buff;
|
||||
bool ret = TRUE;
|
||||
|
||||
if(!this->parser)
|
||||
return(FALSE);
|
||||
|
||||
if( fp=fopen(filename, "rb" ) )
|
||||
{
|
||||
fseek(fp, 0, SEEK_END);
|
||||
filesize = ftell(fp);
|
||||
rewind(fp);
|
||||
|
||||
this->depth = -1;
|
||||
this->State = CDOMDocument::INTO_UNKNOWN;
|
||||
this->indexStart = 0;
|
||||
this->indexEnd = 0;
|
||||
this->tokBinLen = 0;
|
||||
this->lowtokBinLen = 0;
|
||||
this->wordIndex = 0;
|
||||
this->parseText = true;
|
||||
|
||||
buff = XML_GetBuffer(this->parser, filesize);
|
||||
|
||||
if (buff != NULL)
|
||||
{
|
||||
bytes_read = fread(buff, 1, filesize, fp);
|
||||
if (bytes_read > 0)
|
||||
{
|
||||
if(XML_ParseBuffer(this->parser, bytes_read, TRUE) != XML_STATUS_ERROR)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle parse error
|
||||
zSyslog.log(CSyslog::LOGL_WARNING, CSyslog::LOGC_XMLERR, "Parse error at line %u:\n%s\n",
|
||||
XML_GetCurrentLineNumber(this->parser),
|
||||
XML_ErrorString(XML_GetErrorCode(this->parser)));
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle error
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle error
|
||||
ret = FALSE;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
*/
|
||||
bool CDOMDocument::loadXML(char *xml, unsigned long len)
|
||||
{
|
||||
bool ret = TRUE;
|
||||
|
@@ -33,7 +33,6 @@ typedef unsigned long XML_Size;
|
||||
#include "lownodiacritics_utf8.h"
|
||||
|
||||
/*
|
||||
*/
|
||||
#ifndef UINT8
|
||||
#define UINT8 unsigned char
|
||||
#endif
|
||||
@@ -41,8 +40,9 @@ typedef unsigned long XML_Size;
|
||||
#define UINT16 unsigned short
|
||||
#endif
|
||||
#ifndef UINT32
|
||||
#define UINT32 unsigned long
|
||||
#define UINT32 unsigned int
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
@@ -327,7 +327,7 @@ class CDOMDocument
|
||||
bool load(char *filename);
|
||||
bool loadXML(char *xml, unsigned long len);
|
||||
void dump();
|
||||
void (*onKeyword)(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, UINT32 pos, UINT32 len, UINT32 idx);
|
||||
void (*onKeyword)(CDOMDocument *xmlparser, const char *lowKeyword, unsigned int lowKeywordLen, unsigned int pos, unsigned int len, unsigned int idx);
|
||||
void (*onStart)(CDOMDocument *xmlparser, const char *name, const char *path, const char *upath);
|
||||
void (*onEnd)(CDOMDocument *xmlparser);
|
||||
void *userData; // to pass/get data to/from callback
|
||||
@@ -361,9 +361,9 @@ class CDOMDocument
|
||||
int freepathoffset;
|
||||
int freeupathoffset;
|
||||
|
||||
UINT32 indexStart;
|
||||
UINT32 indexEnd;
|
||||
UINT32 wordIndex;
|
||||
unsigned int indexStart;
|
||||
unsigned int indexEnd;
|
||||
unsigned int wordIndex;
|
||||
char tokBin[400+4];
|
||||
int tokBinLen;
|
||||
|
||||
|
@@ -149,7 +149,7 @@ void CIndexer::flush()
|
||||
if(nNewXPath > 0)
|
||||
{
|
||||
// there is some unknown, we get a uid and we write
|
||||
unsigned long xpath_new_uid;
|
||||
unsigned int xpath_new_uid;
|
||||
xpath_new_uid = this->connbas->getID("XPATH", nNewXPath);
|
||||
|
||||
for(xp = this->tXPaths; !this->connbas->crashed && xp; xp = xp->next)
|
||||
@@ -256,7 +256,7 @@ void CIndexer::flush()
|
||||
|
||||
|
||||
// --------------------------------------------------- flush kword and idx
|
||||
unsigned long kword_new_uid = 0;
|
||||
unsigned int kword_new_uid = 0;
|
||||
if(this->nNewKeywords > 0)
|
||||
kword_new_uid = this->connbas->getID("KEYWORDS", this->nNewKeywords);
|
||||
|
||||
|
@@ -463,13 +463,13 @@ class CIndexer
|
||||
CStructField *tStructField; // table of fields in the structure
|
||||
|
||||
CKword *tKeywords[KWORD_HASHSIZE]; // chained list(s) of keywords
|
||||
unsigned long nNewKeywords; // number of NEW (unknown id) keywords in this list
|
||||
unsigned int nNewKeywords; // number of NEW (unknown id) keywords in this list
|
||||
|
||||
CXPath *tXPaths; // chained liste of xpath
|
||||
CXPath *tXPaths; // chained list of xpath
|
||||
CXPath *current_xpath;
|
||||
|
||||
unsigned int current_rid; // current record_id
|
||||
unsigned long nrecsIndexed; // nbr of records treated by this indexer
|
||||
unsigned int nrecsIndexed; // nbr of records treated by this indexer
|
||||
|
||||
|
||||
// dates of the first changing of prefs
|
||||
|
@@ -113,57 +113,6 @@ CSyslog zSyslog; // , LOG_PID, LOG_DAEMON);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void dumpk()
|
||||
{
|
||||
CKword *k;
|
||||
// CHit *h;
|
||||
for(unsigned int hash=0; hash<1024; hash++)
|
||||
{
|
||||
int nk=0;
|
||||
for(k=tKeywords[hash]; k; k=k->next)
|
||||
{
|
||||
// printf("%s : ", k->kword);
|
||||
// for(h=k->firsthit; h; h=h->next)
|
||||
// printf("[%ld, %ld, %ld, %ld] ", h->record_id, h->pos, h->len, h->index);
|
||||
// printf("\r\n");
|
||||
nk++;
|
||||
}
|
||||
printf("tKeywords[%i] = %i\n", hash, nk);
|
||||
}
|
||||
}
|
||||
void freek()
|
||||
{
|
||||
CKword *k;
|
||||
CHit *h;
|
||||
for(unsigned int hash=0; hash<1024; hash++)
|
||||
{
|
||||
while( (k = tKeywords[hash]) )
|
||||
{
|
||||
while( (h = k->firsthit) )
|
||||
{
|
||||
k->firsthit = h->next;
|
||||
delete h;
|
||||
}
|
||||
tKeywords[hash] = k->next;
|
||||
delete k;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// callback appel<65>e par fetchAllKWords, <20> chaque kword
|
||||
void callbackKWord(unsigned long kword_id, char *keyword)
|
||||
{
|
||||
// printf("keyword %ld : '%s'\n", kword_id, keyword);
|
||||
// t_keywords[keyword]["kword_id"] = kword_id;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
//===================================================================================================================
|
||||
// MAIN
|
||||
//===================================================================================================================
|
||||
@@ -1149,7 +1098,7 @@ void cbScanXpaths(CConnbas_dbox *connbas, unsigned int xpath_id, char *xpath, un
|
||||
THREAD_ENTRYPOINT thread_index(void *parm)
|
||||
{
|
||||
CSbas *sbas = (CSbas *)parm;
|
||||
long prefsIndexes_value, prefsIndexes_toReindex=0;
|
||||
int prefsIndexes_value, prefsIndexes_toReindex=0;
|
||||
|
||||
zSyslog.log(CSyslog::LOGL_INFO, CSyslog::LOGC_THREAD_START, "#%ld : thread_index START (%s:%ld:%s)", sbas->sbas_id, sbas->host, sbas->port, sbas->dbname);
|
||||
|
||||
|
@@ -1,37 +1,44 @@
|
||||
#include <memory.h>
|
||||
#include <sys/time.h>
|
||||
#include "phrasea_clock_t.h"
|
||||
|
||||
/*
|
||||
#ifndef WIN32
|
||||
void phrasea_get_ticks ( clock_t *nbticks )
|
||||
|
||||
# ifdef PHP_WIN32
|
||||
|
||||
void startChrono(CHRONO &chrono)
|
||||
{
|
||||
*nbticks = clock();
|
||||
chrono = GetTickCount();
|
||||
}
|
||||
double stopChrono(CHRONO &chrono)
|
||||
{
|
||||
return((double)(GetTickCount()-chrono) / 1000.0);
|
||||
}
|
||||
|
||||
int phrasea_getclockinterval ( clock_t * timestart, clock_t * timeend )
|
||||
|
||||
# else
|
||||
|
||||
void startChrono(CHRONO &chrono)
|
||||
{
|
||||
return (int)(((double)( *timeend - *timestart ) / CLOCKS_PER_SEC ) * 1000 );
|
||||
gettimeofday(&chrono, NULL);
|
||||
return;
|
||||
}
|
||||
float stopChrono(CHRONO &chrono)
|
||||
{
|
||||
struct timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
t.tv_sec -= chrono.tv_sec;
|
||||
t.tv_usec -= chrono.tv_usec;
|
||||
if(t.tv_usec < 0)
|
||||
{
|
||||
t.tv_sec--;
|
||||
t.tv_usec += 1000000;
|
||||
}
|
||||
return((float)(t.tv_sec) + ((float)(t.tv_usec))/1000000);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int millisec_diff(PHRASEA_TIMEB *timestart, PHRASEA_TIMEB *timeend)
|
||||
{
|
||||
// time_t t;
|
||||
return((1000 * (timeend->time - timestart->time)) + (timeend->millitm - timestart->millitm));
|
||||
}
|
||||
|
||||
void resetclock(PHRASEA_TIMEB * timeref)
|
||||
{
|
||||
timeref->time = timeref->millitm = 0;
|
||||
}
|
||||
|
||||
|
||||
# ifndef WIN32
|
||||
void resetclock(clock_t * timeref)
|
||||
{
|
||||
*timeref = 0;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
char *_strupr( char *string )
|
||||
|
@@ -1,35 +1,30 @@
|
||||
/* d<>finition portable des structures syst<73>me <20> d<>nomination variable */
|
||||
#ifndef PHRASEA_CLOCK_T__INCLUDED
|
||||
#define PHRASEA_CLOCK_T__INCLUDED 1
|
||||
/*
|
||||
* phrasea_clock_t.h
|
||||
*
|
||||
* Created on: 4 mars 2010
|
||||
* Author: gaulier
|
||||
*/
|
||||
|
||||
#ifndef PHRASEA_CLOCK_T_H_
|
||||
#define PHRASEA_CLOCK_T_H_
|
||||
|
||||
|
||||
#include <sys/timeb.h>
|
||||
|
||||
/*
|
||||
#ifndef PHRASEA_TIMEB
|
||||
//# ifdef WIN32
|
||||
# define PHRASEA_TIMEB struct _timeb
|
||||
# define PHRASEA_FTIME ftime
|
||||
# define PHRASEA_GET_MS millisec_diff
|
||||
//# else
|
||||
//# define PHRASEA_TIMEB clock_t
|
||||
//# define PHRASEA_FTIME phrasea_get_ticks
|
||||
//# define PHRASEA_GET_MS phrasea_getclockinterval
|
||||
// ******* tosee : ligne mise en remarque pour warning win32
|
||||
//void PHRASEA_FTIME(PHRASEA_TIMEB *);
|
||||
//# endif
|
||||
#ifdef PHP_WIN32
|
||||
typedef DWORD CHRONO;
|
||||
#else
|
||||
typedef struct timeval CHRONO;
|
||||
#endif
|
||||
|
||||
void startChrono(CHRONO &chrono);
|
||||
float stopChrono(CHRONO &chrono);
|
||||
|
||||
|
||||
int PHRASEA_GET_MS(PHRASEA_TIMEB *, PHRASEA_TIMEB *);
|
||||
// ******* tosee : resetclock est impl<70>ment<6E> en void
|
||||
void resetclock(PHRASEA_TIMEB *);
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
char *_strupr( char *string );
|
||||
#endif
|
||||
|
||||
#endif // PHRASEA_CLOCK_T__INCLUDED
|
||||
#endif /* PHRASEA_CLOCK_T_H_ */
|
||||
|
||||
|
||||
|
@@ -18,8 +18,8 @@ require_once __DIR__ . '/version.inc';
|
||||
require_once __DIR__ . '/../config/_GV.php';
|
||||
|
||||
spl_autoload_register('phrasea_autoload');
|
||||
phrasea::start();
|
||||
$session = session::getInstance();
|
||||
//phrasea::start(); // done in schedtask.php and runtask.exe.php
|
||||
//$session = session::getInstance(); // done in schedtask.php and runtask.exe.php
|
||||
|
||||
if(defined('GV_timezone'))
|
||||
date_default_timezone_set(GV_timezone);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -483,7 +483,8 @@ class export
|
||||
$name = mb_substr($name, 0, $max_length);
|
||||
|
||||
$n = 1;
|
||||
while (in_array($name, $file_names))
|
||||
|
||||
while (in_array(mb_strtolower($name), $file_names))
|
||||
{
|
||||
$n++;
|
||||
$suffix = "-" . $n; // pour diese si besoin
|
||||
@@ -494,7 +495,8 @@ class export
|
||||
else
|
||||
$name = $name . $suffix;
|
||||
}
|
||||
$file_names[] = $name;
|
||||
|
||||
$file_names[] = mb_strtolower($name);
|
||||
$files[$id]["export_name"] = $name;
|
||||
|
||||
$files[$id]["export_name"] = noaccent_utf8($files[$id]["export_name"], UNPARSED);
|
||||
|
@@ -270,7 +270,7 @@ class p4file
|
||||
}
|
||||
|
||||
|
||||
public static function check_file_error($filename, $sbas_id)
|
||||
public static function check_file_error($filename, $sbas_id, $originalname='')
|
||||
{
|
||||
require_once GV_RootPath.'lib/index_utils2.php';
|
||||
$infos = giveMimeExt($filename);
|
||||
@@ -295,6 +295,23 @@ class p4file
|
||||
{
|
||||
switch($name)
|
||||
{
|
||||
case 'name':
|
||||
$fn = $originalname;
|
||||
// fn can contain single quotes, but NO doubles
|
||||
// if( count($fn=explode('"', $fn)) == 1)
|
||||
// $fn = '\\"' . $fn[0] . '\\"';
|
||||
// else
|
||||
// $fn = 'concat(\\"' . implode('\\",\'\\"\',\\"', $fn) . '\\")';
|
||||
$fn = '\\"'.str_replace('"', '"', $fn).'\\"'; // in fact xquey does LITERAL search on attributes, so '"' does REALLY MEANS """ !
|
||||
$connbas = connection::getInstance($sbas_id);
|
||||
$sql = 'SELECT record_id FROM record WHERE EXTRACTVALUE(xml, "count(/record/doc[@originalname='.$fn.'])")>0 LIMIT 1';
|
||||
if( ($rs=$connbas->query($sql)) )
|
||||
{
|
||||
if($connbas->num_rows($rs)>0)
|
||||
$errors[] = sprintf(_('Le fichier \'%s\' existe deja'), $originalname);
|
||||
$connbas->free_result($rs);
|
||||
}
|
||||
break;
|
||||
case 'size':
|
||||
$min = min($datas['Image Height'], $datas['Image Width']);
|
||||
if($min < (int)$value)
|
||||
|
@@ -1793,7 +1793,7 @@ class task_archive extends phraseatask
|
||||
|
||||
$uuid = $file_uuid->write_uuid($uuid);
|
||||
|
||||
$error_file = p4file::check_file_error($path.'/'.$file, $sbas_id);
|
||||
$error_file = p4file::check_file_error($path.'/'.$file, $sbas_id, $file);
|
||||
$status = status::or_operation($stat0, $stat1);
|
||||
|
||||
if($meta['status'])
|
||||
|
@@ -589,7 +589,7 @@ class task_ftp extends phraseatask
|
||||
if ($loop > 2 || memory_get_usage() >> 20 >= 15)
|
||||
{
|
||||
$conn->close();
|
||||
unset($conn);
|
||||
$conn = null;
|
||||
sleep(20);
|
||||
$ret = 'torestart';
|
||||
$running = false;
|
||||
|
@@ -2770,10 +2770,24 @@ function make_mp4_progressive($mp4_file)
|
||||
{
|
||||
if ($debug)
|
||||
echo "\nmp4 box OK, doing it\n";
|
||||
|
||||
$cmd = GV_mp4box . ' -inter 0.5 ' . escapeshellarg($mp4_file);
|
||||
$tmp_file = $mp4_file . 'non-inter.mp4';
|
||||
rename($mp4_file, $tmp_file);
|
||||
$cmd = GV_mp4box . ' -inter 0.5 ' . escapeshellarg($tmp_file) . ' -out ' . escapeshellarg($mp4_file);
|
||||
$errArr = '';
|
||||
|
||||
if ($debug)
|
||||
echo $cmd . "\n\n ";
|
||||
|
||||
@exec($cmd, $errArr);
|
||||
if (is_file($mp4_file) && filesize($mp4_file) > 0)
|
||||
{
|
||||
unlink($tmp_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
rename($tmp_file, $mp4_file);
|
||||
}
|
||||
|
||||
|
||||
$ret = true;
|
||||
}
|
||||
|
@@ -1,2 +1,2 @@
|
||||
<?php
|
||||
define('GV_version','3.1.17');
|
||||
define('GV_version','3.1.19');
|
||||
|
@@ -68,7 +68,7 @@ function sylk($tableau,$nomfic,$typ="SYLK")
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
header("Content-Type: text/plain");
|
||||
header("Content-Type: text/csv");
|
||||
header("Cache-Control: max-age=3600, must-revalidate ");
|
||||
header("Content-Disposition: attachment; filename=export.csv;");
|
||||
|
||||
|
@@ -88,6 +88,9 @@ else
|
||||
|
||||
}
|
||||
|
||||
$conn = connection::getInstance();
|
||||
$conn->close();
|
||||
|
||||
|
||||
function my_syslog($level, $msg)
|
||||
{
|
||||
|
@@ -336,6 +336,7 @@ phrasea::headers();
|
||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.4.4.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.password.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.login.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php
|
||||
@@ -363,6 +364,7 @@ phrasea::headers();
|
||||
$msg .= ' ,equalTo: "'._('forms::les mots de passe ne correspondent pas').'"';
|
||||
if($ar == 'form_email')
|
||||
$msg .= ',email:"'.(str_replace('"','\"',_('forms::l\'email semble invalide'))).'"';
|
||||
$msg .= ',login:"'.(str_replace('"','\"',_('login invalide (8 caracteres sans accents ni espaces)'))).'"';
|
||||
|
||||
$msg .= '}';
|
||||
}
|
||||
@@ -397,9 +399,11 @@ phrasea::headers();
|
||||
|
||||
$('#form_email').rules("add",{email:true});
|
||||
|
||||
$('#form_login').rules("add",{
|
||||
minlength: 5
|
||||
});
|
||||
// $('#form_login').rules("add",{
|
||||
// minlength: 5
|
||||
// });
|
||||
|
||||
$('#form_login').rules("add",{login : true});
|
||||
|
||||
$('#form_password').rules("add",{password: "#form_login"});
|
||||
$('#form_password_confirm').rules("add",{equalTo: "#form_password"});
|
||||
|
@@ -1788,10 +1788,13 @@ function preset_load(preset_id)
|
||||
{
|
||||
if(p4.edit.T_fields[f].multi)
|
||||
{
|
||||
p4.edit.T_records[r].fields[""+f] = {
|
||||
"value":p4.edit.T_fields[f].preset,
|
||||
"dirty":true
|
||||
};
|
||||
p4.edit.T_records[r].fields[""+f] = {value:[], dirty:true};// = {
|
||||
var n = 0;
|
||||
for(val in p4.edit.T_fields[f].preset)
|
||||
{
|
||||
p4.edit.T_records[r].fields[""+f].value[n] = p4.edit.T_fields[f].preset[val];
|
||||
n++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once dirname( __FILE__ ) . "/../../lib/bootstrap.php";
|
||||
require_once dirname(__FILE__) . "/../../lib/bootstrap.php";
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
|
||||
@@ -16,40 +16,38 @@ $parm = $request->get_parms(
|
||||
, 'piv'
|
||||
, "id"
|
||||
, 't'
|
||||
, 'dlk' // supprimer les liens des champs (tbranch)
|
||||
, 'rdx' // r�indexer apr�s
|
||||
, 'dlg'
|
||||
);
|
||||
);
|
||||
|
||||
set_time_limit(300);
|
||||
|
||||
$imported = false;
|
||||
$err = '';
|
||||
|
||||
if($parm["bid"] !== null)
|
||||
if ($parm["bid"] !== null)
|
||||
{
|
||||
$loaded = false;
|
||||
$connbas = connection::getInstance($parm['bid']);
|
||||
if($connbas)
|
||||
if ($connbas)
|
||||
{
|
||||
$sql = "SELECT value AS xml FROM pref WHERE prop='thesaurus'";
|
||||
if($rsbas = $connbas->query($sql))
|
||||
if ($rsbas = $connbas->query($sql))
|
||||
{
|
||||
if($rowbas = $connbas->fetch_assoc($rsbas))
|
||||
if ($rowbas = $connbas->fetch_assoc($rsbas))
|
||||
{
|
||||
$xml = trim($rowbas["xml"]);
|
||||
|
||||
$dom = new DOMDocument();
|
||||
$dom->formatOutput = true;
|
||||
$dom->preserveWhiteSpace = false;
|
||||
if(($dom->loadXML($xml)))
|
||||
if (($dom->loadXML($xml)))
|
||||
{
|
||||
$err = '';
|
||||
if($parm['id'] == '')
|
||||
if ($parm['id'] == '')
|
||||
{
|
||||
// on importe un th�saurus entier
|
||||
$node = $dom->documentElement;
|
||||
while($node->firstChild)
|
||||
while ($node->firstChild)
|
||||
$node->removeChild($node->firstChild);
|
||||
|
||||
$err = importFile($dom, $node);
|
||||
@@ -60,7 +58,7 @@ if($parm["bid"] !== null)
|
||||
$err = 'not implemented';
|
||||
}
|
||||
|
||||
if(!$err)
|
||||
if (!$err)
|
||||
{
|
||||
$imported = true;
|
||||
$dom->documentElement->setAttribute('modification_date', date("YmdHis"));
|
||||
@@ -69,62 +67,56 @@ if($parm["bid"] !== null)
|
||||
$connbas->query($sql);
|
||||
|
||||
$cache_abox = cache_appbox::getInstance();
|
||||
$cache_abox->delete('thesaurus_'.$parm['bid']);
|
||||
$cache_abox->delete('thesaurus_' . $parm['bid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$connbas->free_result($rsbas);
|
||||
}
|
||||
|
||||
if(!$err)
|
||||
{
|
||||
if($parm['dlk']) // delete links from fields to thesaurus ('tbranch')
|
||||
if (!$err)
|
||||
{
|
||||
$sql = 'SELECT value AS struct FROM pref WHERE prop="structure"';
|
||||
if( ($rsbas = $connbas->query($sql)) )
|
||||
if (($rsbas = $connbas->query($sql)))
|
||||
{
|
||||
if( ($rowbas = $connbas->fetch_assoc($rsbas)) )
|
||||
if (($rowbas = $connbas->fetch_assoc($rsbas)))
|
||||
{
|
||||
if(($dom = @DOMDocument::loadXML($rowbas["struct"])))
|
||||
if (($dom = @DOMDocument::loadXML($rowbas["struct"])))
|
||||
{
|
||||
$xp = new DOMXPath($dom);
|
||||
$fields = $xp->query("/record/description/*");
|
||||
for($i=0; $i<$fields->length; $i++)
|
||||
for ($i = 0; $i < $fields->length; $i++)
|
||||
{
|
||||
$fields->item($i)->removeAttribute('tbranch');
|
||||
$fields->item($i)->removeAttribute('newterm');
|
||||
}
|
||||
$dom->documentElement->setAttribute('modification_date', date("YmdHis")) ;
|
||||
$dom->documentElement->setAttribute('modification_date', date("YmdHis"));
|
||||
|
||||
$sql = 'UPDATE pref SET value=\'' . $connbas->escape_string($dom->saveXML()) . '\' WHERE prop="structure"';
|
||||
$connbas->query($sql);
|
||||
|
||||
$cache_appbox = cache_appbox::getInstance();
|
||||
$cache_appbox->delete('list_bases');
|
||||
cache_databox::update($parm['bid'],'structure');
|
||||
cache_databox::update($parm['bid'], 'structure');
|
||||
}
|
||||
}
|
||||
$connbas->free_result($rsbas);
|
||||
}
|
||||
}
|
||||
|
||||
if($parm['rdx']) // reindex
|
||||
{
|
||||
// clear cterms
|
||||
$sql = 'SELECT value AS cterms FROM pref WHERE prop="cterms"';
|
||||
if( ($rsbas = $connbas->query($sql)) )
|
||||
if (($rsbas = $connbas->query($sql)))
|
||||
{
|
||||
if( ($rowbas = $connbas->fetch_assoc($rsbas)) )
|
||||
if (($rowbas = $connbas->fetch_assoc($rsbas)))
|
||||
{
|
||||
$dom = new DOMDocument();
|
||||
$dom->formatOutput = true;
|
||||
$dom->preserveWhiteSpace = false;
|
||||
if(($dom->loadXML($rowbas["cterms"])))
|
||||
if (($dom->loadXML($rowbas["cterms"])))
|
||||
{
|
||||
$node = $dom->documentElement;
|
||||
while($node->firstChild)
|
||||
while ($node->firstChild)
|
||||
$node->removeChild($node->firstChild);
|
||||
$dom->documentElement->setAttribute('modification_date', date("YmdHis")) ;
|
||||
$dom->documentElement->setAttribute('modification_date', date("YmdHis"));
|
||||
|
||||
$sql = 'UPDATE pref SET value=\'' . $connbas->escape_string($dom->saveXML()) . '\' WHERE prop="cterms"';
|
||||
$connbas->query($sql);
|
||||
@@ -138,10 +130,9 @@ if($parm["bid"] !== null)
|
||||
$connbas->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($parm["dlg"])
|
||||
if ($parm["dlg"])
|
||||
{
|
||||
$opener = "window.dialogArguments.win";
|
||||
}
|
||||
@@ -149,28 +140,24 @@ else
|
||||
{
|
||||
$opener = "opener";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html lang="<?php echo $session->usr_i18n;?>">
|
||||
<body onload='parent.importDone("<?php print(p4string::MakeString($err, 'js'));?>");'>
|
||||
<html lang="<?php echo $session->usr_i18n; ?>">
|
||||
<body onload='parent.importDone("<?php print(p4string::MakeString($err, 'js')); ?>");'>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
function checkEncoding ( $string, $string_encoding )
|
||||
function checkEncoding($string, $string_encoding)
|
||||
{
|
||||
$fs = $string_encoding == 'UTF-8' ? 'UTF-32' : $string_encoding;
|
||||
|
||||
$ts = $string_encoding == 'UTF-32' ? 'UTF-8' : $string_encoding;
|
||||
|
||||
return $string === mb_convert_encoding ( mb_convert_encoding ( $string, $fs, $ts ), $ts, $fs );
|
||||
return $string === mb_convert_encoding(mb_convert_encoding($string, $fs, $ts), $ts, $fs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function importFile($dom, $node)
|
||||
{
|
||||
global $parm;
|
||||
@@ -178,25 +165,25 @@ function importFile($dom, $node)
|
||||
|
||||
$cbad = array();
|
||||
$cok = array();
|
||||
for($i=0; $i<32; $i++)
|
||||
for ($i = 0; $i < 32; $i++)
|
||||
{
|
||||
$cbad[] = chr($i);
|
||||
$cok[] = '_';
|
||||
}
|
||||
|
||||
if( ($fp = fopen($_FILES['fil']['tmp_name'], 'rb')) )
|
||||
if (($fp = fopen($_FILES['fil']['tmp_name'], 'rb')))
|
||||
{
|
||||
$iline = 0;
|
||||
$curdepth = -1;
|
||||
$tid = array(-1=>-1, 0=>-1);
|
||||
while(!$err && !feof($fp) && ($line=fgets($fp)) !== FALSE )
|
||||
$tid = array(-1 => -1, 0 => -1);
|
||||
while (!$err && !feof($fp) && ($line = fgets($fp)) !== FALSE)
|
||||
{
|
||||
$iline++;
|
||||
if(trim($line) == '')
|
||||
if (trim($line) == '')
|
||||
continue;
|
||||
for($depth=0; $line!='' && $line[0]=="\t"; $depth++)
|
||||
$line=substr($line, 1);
|
||||
if($depth > $curdepth+1)
|
||||
for ($depth = 0; $line != '' && $line[0] == "\t"; $depth++)
|
||||
$line = substr($line, 1);
|
||||
if ($depth > $curdepth + 1)
|
||||
{
|
||||
$err = sprintf(_("over-indent at line %s"), $iline);
|
||||
continue;
|
||||
@@ -204,33 +191,33 @@ function importFile($dom, $node)
|
||||
|
||||
$line = trim($line);
|
||||
|
||||
if(!checkEncoding($line, 'UTF-8'))
|
||||
if (!checkEncoding($line, 'UTF-8'))
|
||||
{
|
||||
$err = sprintf(_("bad encoding at line %s"), $iline);
|
||||
continue;
|
||||
}
|
||||
|
||||
$line = str_replace($cbad, $cok, ($oldline = $line));
|
||||
if($line != $oldline)
|
||||
if ($line != $oldline)
|
||||
{
|
||||
$err = sprintf(_("bad character at line %s"), $iline);
|
||||
continue;
|
||||
}
|
||||
|
||||
while($curdepth >= $depth)
|
||||
while ($curdepth >= $depth)
|
||||
{
|
||||
$curdepth--;
|
||||
$node = $node->parentNode;
|
||||
}
|
||||
$curdepth = $depth;
|
||||
|
||||
$nid = (int)($node->getAttribute('nextid'));
|
||||
$nid = (int) ($node->getAttribute('nextid'));
|
||||
$id = $node->getAttribute('id') . '.' . $nid;
|
||||
$pid = $node->getAttribute('id');
|
||||
|
||||
$te_id = ($pid ? ($pid.'.'):'T') . $nid ;
|
||||
$te_id = ($pid ? ($pid . '.') : 'T') . $nid;
|
||||
|
||||
$node->setAttribute('nextid', (string)($nid+1));
|
||||
$node->setAttribute('nextid', (string) ($nid + 1));
|
||||
|
||||
$te = $node->appendChild($dom->createElement('te'));
|
||||
$te->setAttribute('id', $te_id);
|
||||
@@ -239,49 +226,49 @@ function importFile($dom, $node)
|
||||
|
||||
$tsy = explode(';', $line);
|
||||
$nsy = 0;
|
||||
foreach($tsy as $syn)
|
||||
foreach ($tsy as $syn)
|
||||
{
|
||||
$lng = $parm['piv'];
|
||||
$hit = '';
|
||||
$kon = '';
|
||||
|
||||
if( ($ob=strpos($syn, '[')) !== false)
|
||||
if (($ob = strpos($syn, '[')) !== false)
|
||||
{
|
||||
if( ($cb=strpos($syn, ']', $ob)) !== false)
|
||||
if (($cb = strpos($syn, ']', $ob)) !== false)
|
||||
{
|
||||
$lng = trim(substr($syn, $ob+1, $cb-$ob-1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb+1);
|
||||
$lng = trim(substr($syn, $ob + 1, $cb - $ob - 1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lng = trim(substr($syn, $ob+1));
|
||||
$syn = substr($syn, 0, $ob) ;
|
||||
$lng = trim(substr($syn, $ob + 1));
|
||||
$syn = substr($syn, 0, $ob);
|
||||
}
|
||||
|
||||
if( ($ob=strpos($syn, '[')) !== false)
|
||||
if (($ob = strpos($syn, '[')) !== false)
|
||||
{
|
||||
if( ($cb=strpos($syn, ']', $ob)) !== false)
|
||||
if (($cb = strpos($syn, ']', $ob)) !== false)
|
||||
{
|
||||
$hit = trim(substr($syn, $ob+1, $cb-$ob-1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb+1);
|
||||
$hit = trim(substr($syn, $ob + 1, $cb - $ob - 1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$hit = trim(substr($syn, $ob+1));
|
||||
$hit = trim(substr($syn, $ob + 1));
|
||||
$syn = substr($syn, 0, $ob);
|
||||
}
|
||||
}
|
||||
}
|
||||
if( ($ob=strpos($syn, '(')) !== false)
|
||||
if (($ob = strpos($syn, '(')) !== false)
|
||||
{
|
||||
if( ($cb=strpos($syn, ')', $ob)) !== false)
|
||||
if (($cb = strpos($syn, ')', $ob)) !== false)
|
||||
{
|
||||
$kon = trim(substr($syn, $ob+1, $cb-$ob-1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb+1);
|
||||
$kon = trim(substr($syn, $ob + 1, $cb - $ob - 1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$kon = trim(substr($syn, $ob+1));
|
||||
$kon = trim(substr($syn, $ob + 1));
|
||||
$syn = substr($syn, 0, $ob);
|
||||
}
|
||||
}
|
||||
@@ -289,21 +276,21 @@ function importFile($dom, $node)
|
||||
$syn = trim($syn);
|
||||
|
||||
$sy = $node->appendChild($dom->createElement('sy'));
|
||||
$sy->setAttribute('id' , $te_id.'.'.$nsy);
|
||||
$v = $syn ;
|
||||
if($kon)
|
||||
$sy->setAttribute('id', $te_id . '.' . $nsy);
|
||||
$v = $syn;
|
||||
if ($kon)
|
||||
$v .= ' (' . $kon . ')';
|
||||
$sy->setAttribute('v' , $v);
|
||||
$sy->setAttribute('w', noaccent_utf8($syn, PARSED) );
|
||||
if($kon)
|
||||
$sy->setAttribute('k', noaccent_utf8($kon, PARSED) );
|
||||
$sy->setAttribute('v', $v);
|
||||
$sy->setAttribute('w', noaccent_utf8($syn, PARSED));
|
||||
if ($kon)
|
||||
$sy->setAttribute('k', noaccent_utf8($kon, PARSED));
|
||||
|
||||
$sy->setAttribute('lng', $lng);
|
||||
|
||||
$nsy++;
|
||||
}
|
||||
|
||||
$te->setAttribute('nextid', (string)$nsy );
|
||||
$te->setAttribute('nextid', (string) $nsy);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
@@ -311,7 +298,6 @@ function importFile($dom, $node)
|
||||
return($err);
|
||||
}
|
||||
|
||||
|
||||
function no_dof($dom, $node)
|
||||
{
|
||||
global $parm;
|
||||
@@ -325,57 +311,57 @@ function no_dof($dom, $node)
|
||||
$tlig = explode('£', $t);
|
||||
|
||||
$mindepth = 999999;
|
||||
foreach($tlig as $lig)
|
||||
foreach ($tlig as $lig)
|
||||
{
|
||||
// echo('.');
|
||||
// flush();
|
||||
|
||||
if(trim($lig)=='')
|
||||
if (trim($lig) == '')
|
||||
continue;
|
||||
for($depth=0; $lig!='' && $lig[$depth]=="\t"; $depth++)
|
||||
for ($depth = 0; $lig != '' && $lig[$depth] == "\t"; $depth++)
|
||||
;
|
||||
if($depth < $mindepth)
|
||||
if ($depth < $mindepth)
|
||||
$mindepth = $depth;
|
||||
}
|
||||
|
||||
$curdepth = -1;
|
||||
$tid = array(-1=>-1, 0=>-1);
|
||||
foreach($tlig as $lig)
|
||||
$tid = array(-1 => -1, 0 => -1);
|
||||
foreach ($tlig as $lig)
|
||||
{
|
||||
// echo('-');
|
||||
// flush();
|
||||
|
||||
$lig = substr($lig, $mindepth);
|
||||
if(trim($lig)=='')
|
||||
if (trim($lig) == '')
|
||||
continue;
|
||||
for($depth=0; $lig!='' && $lig[0]=="\t"; $depth++)
|
||||
for ($depth = 0; $lig != '' && $lig[0] == "\t"; $depth++)
|
||||
$lig = substr($lig, 1);
|
||||
|
||||
// printf("curdepth=%s, depth=%s : %s\n", $curdepth, $depth, $lig);
|
||||
|
||||
if($depth > $curdepth+1)
|
||||
if ($depth > $curdepth + 1)
|
||||
{
|
||||
// error
|
||||
// print('<span style="color:#ff0000">error over-indent at</span> \'' . $lig . "'\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
while($curdepth >= $depth)
|
||||
while ($curdepth >= $depth)
|
||||
{
|
||||
$curdepth--;
|
||||
$node = $node->parentNode;
|
||||
}
|
||||
$curdepth = $depth;
|
||||
|
||||
$nid = (int)($node->getAttribute('nextid'));
|
||||
$nid = (int) ($node->getAttribute('nextid'));
|
||||
$id = $node->getAttribute('id') . '.' . $nid;
|
||||
$pid = $node->getAttribute('id');
|
||||
|
||||
// print("pid=".$pid);
|
||||
|
||||
$te_id = ($pid ? ($pid.'.'):'T') . $nid ;
|
||||
$te_id = ($pid ? ($pid . '.') : 'T') . $nid;
|
||||
|
||||
$node->setAttribute('nextid', (string)($nid+1));
|
||||
$node->setAttribute('nextid', (string) ($nid + 1));
|
||||
|
||||
$te = $node->appendChild($dom->createElement('te'));
|
||||
$te->setAttribute('id', $te_id);
|
||||
@@ -384,54 +370,54 @@ function no_dof($dom, $node)
|
||||
|
||||
$tsy = explode(';', $lig);
|
||||
$nsy = 0;
|
||||
foreach($tsy as $syn)
|
||||
foreach ($tsy as $syn)
|
||||
{
|
||||
$lng = $parm['piv'];
|
||||
$hit = '';
|
||||
$kon = '';
|
||||
|
||||
if( ($ob=strpos($syn, '[')) !== false)
|
||||
if (($ob = strpos($syn, '[')) !== false)
|
||||
{
|
||||
if( ($cb=strpos($syn, ']', $ob)) !== false)
|
||||
if (($cb = strpos($syn, ']', $ob)) !== false)
|
||||
{
|
||||
$lng = trim(substr($syn, $ob+1, $cb-$ob-1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb+1);
|
||||
$lng = trim(substr($syn, $ob + 1, $cb - $ob - 1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lng = trim(substr($syn, $ob+1));
|
||||
$syn = substr($syn, 0, $ob) ;
|
||||
$lng = trim(substr($syn, $ob + 1));
|
||||
$syn = substr($syn, 0, $ob);
|
||||
}
|
||||
|
||||
if( ($ob=strpos($syn, '[')) !== false)
|
||||
if (($ob = strpos($syn, '[')) !== false)
|
||||
{
|
||||
if( ($cb=strpos($syn, ']', $ob)) !== false)
|
||||
if (($cb = strpos($syn, ']', $ob)) !== false)
|
||||
{
|
||||
$hit = trim(substr($syn, $ob+1, $cb-$ob-1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb+1);
|
||||
$hit = trim(substr($syn, $ob + 1, $cb - $ob - 1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$hit = trim(substr($syn, $ob+1));
|
||||
$hit = trim(substr($syn, $ob + 1));
|
||||
$syn = substr($syn, 0, $ob);
|
||||
}
|
||||
}
|
||||
}
|
||||
if( ($ob=strpos($syn, '(')) !== false)
|
||||
if (($ob = strpos($syn, '(')) !== false)
|
||||
{
|
||||
if( ($cb=strpos($syn, ')', $ob)) !== false)
|
||||
if (($cb = strpos($syn, ')', $ob)) !== false)
|
||||
{
|
||||
$kon = trim(substr($syn, $ob+1, $cb-$ob-1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb+1);
|
||||
$kon = trim(substr($syn, $ob + 1, $cb - $ob - 1));
|
||||
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$kon = trim(substr($syn, $ob+1));
|
||||
$kon = trim(substr($syn, $ob + 1));
|
||||
$syn = substr($syn, 0, $ob);
|
||||
}
|
||||
}
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
$syn = trim($syn);
|
||||
|
||||
// for($id='T',$i=0; $i<=$curdepth; $i++)
|
||||
@@ -439,32 +425,30 @@ function no_dof($dom, $node)
|
||||
// $id = '?';
|
||||
// printf("depth=%s (%s) ; sy='%s', kon='%s', lng='%s', hit='%s' \n", $depth, $id, $syn, $kon, $lng, $hit);
|
||||
|
||||
/*
|
||||
/*
|
||||
$nid = (int)($node->getAttribute('nextid'));
|
||||
$pid = $node->getAttribute('id');
|
||||
|
||||
$id = ($pid ? ($pid.'.'):'T') . $nid ;
|
||||
$node->setAttribute('nextid', (string)($nid+1));
|
||||
|
||||
*/
|
||||
*/
|
||||
$sy = $node->appendChild($dom->createElement('sy'));
|
||||
$sy->setAttribute('id' , $te_id.'.'.$nsy);
|
||||
$v = $syn ;
|
||||
if($kon)
|
||||
$sy->setAttribute('id', $te_id . '.' . $nsy);
|
||||
$v = $syn;
|
||||
if ($kon)
|
||||
$v .= ' (' . $kon . ')';
|
||||
$sy->setAttribute('v' , $v);
|
||||
$sy->setAttribute('w', noaccent_utf8($syn, PARSED) );
|
||||
if($kon)
|
||||
$sy->setAttribute('k', noaccent_utf8($kon, PARSED) );
|
||||
$sy->setAttribute('v', $v);
|
||||
$sy->setAttribute('w', noaccent_utf8($syn, PARSED));
|
||||
if ($kon)
|
||||
$sy->setAttribute('k', noaccent_utf8($kon, PARSED));
|
||||
|
||||
$sy->setAttribute('lng', $lng);
|
||||
|
||||
$nsy++;
|
||||
|
||||
}
|
||||
|
||||
$te->setAttribute('nextid', (string)$nsy );
|
||||
|
||||
$te->setAttribute('nextid', (string) $nsy);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -413,7 +413,7 @@ if (count($avBases) == 0)
|
||||
<li><a id="quarantine-tab" href="/upload/uploadFeedback.php?action=get_lazaret_html"><?php echo _('Quarantaine'); ?><span id="quarantine_size">(<?php echo (int) $count; ?>)</span></a></li>
|
||||
</ul>
|
||||
<div id="manager">
|
||||
<form id="form1" action="upload.php" method="post" enctype="multipart/form-data" onsubmit="return false;" target="classic_upload">
|
||||
<form id="form1" action="upload.php" method="post" enctype="multipart/form-data" target="classic_upload">
|
||||
<div style="height:60px;margin:20px 0;">
|
||||
<div id="step1" style="cursor:pointer;xwidth:800px;height:30px;"><span id="spanButtonPlaceHolder"></span>
|
||||
<div>
|
||||
|
@@ -113,6 +113,15 @@ function do_global_action()
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#form1').bind('submit', function(event){
|
||||
var classic = !!$('#step2classic').is(':visible');
|
||||
if(!classic)
|
||||
{
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.each($('#status_wrapper .slider_status'),function(){
|
||||
activeSliders(this);
|
||||
});
|
||||
|
@@ -136,9 +136,9 @@ try
|
||||
|
||||
$uuid = $file_uuid->write_uuid($uuid);
|
||||
|
||||
$error_file = p4file::check_file_error($_FILES['Filedata']["tmp_name"], $sbas_id);
|
||||
$error_file = p4file::check_file_error($_FILES['Filedata']["tmp_name"], $sbas_id, $_FILES['Filedata']["name"]);
|
||||
$status_2 = status::and_operation($mask_oui,$mask_non);
|
||||
if(($uuid !== false && !$file_uuid->is_new_in_base(phrasea::sbasFromBas($base_id))) || count($error_file) > 0)
|
||||
if( ($uuid !== false && !$file_uuid->is_new_in_base(phrasea::sbasFromBas($base_id))) || count($error_file) > 0)
|
||||
{
|
||||
if(!lazaretFile::move_uploaded_to_lazaret($_FILES['Filedata']["tmp_name"], $base_id, $_FILES['Filedata']["name"], $uuid, $sha256, implode("\n",$error_file), $status_2))
|
||||
{
|
||||
|
Reference in New Issue
Block a user