Skip to content

Commit

Permalink
Rename MAIN_USE_FULL_TEXT_INDEXATION into MAIN_SAVE_FILE_CONTENT_AS_TEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 12, 2024
1 parent 5283a67 commit 062c769
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions htdocs/core/class/html.formfile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ public function form_attach_new_file($url, $title = '', $addcancel = 0, $section
$menudolibarrsetupmax = $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Security");

$tooltiptext = $langs->trans("ThisLimitIsDefinedInSetupAt", $menudolibarrsetupmax, $max, $maxphptoshowparam, $maxphptoshow);
if (getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION')) {
$tooltiptext .= '<br><br>Option to extract the file content in text to save it in database is ON <span class="opacitymedium">('.getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION').')</span>';
if (getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT')) {
$tooltiptext .= '<br><br>Option to extract the file content in text to save it in database is ON <span class="opacitymedium">('.getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT').')</span>';
}

$out .= ' ';
Expand Down
10 changes: 5 additions & 5 deletions htdocs/core/lib/files.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2181,11 +2181,11 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
}

// Use a convertisser Doc to Text
$useFullTextIndexation = getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION');
$useFullTextIndexation = getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT');
if (empty($useFullTextIndexation) && $forceFullTextIndexation == '1') {
if (getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION_PDFTOTEXT')) {
if (getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT_PDFTOTEXT')) {
$useFullTextIndexation = 'pdftotext';
} elseif (getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION_DOCLING')) {
} elseif (getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT_DOCLING')) {
$useFullTextIndexation = 'docling';
}
}
Expand Down Expand Up @@ -2213,7 +2213,7 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo

// We also exclude '/temp/' dir and 'documents/admin/documents'
// We make escapement here and call executeCLI without escapement because we don't want to have the '*.log' escaped.
$cmd = getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION_PDFTOTEXT', 'pdftotext')." -htmlmeta '".escapeshellcmd($filetoprocess)."' - ";
$cmd = getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT_PDFTOTEXT', 'pdftotext')." -htmlmeta '".escapeshellcmd($filetoprocess)."' - ";
$resultexec = $utils->executeCLI($cmd, $outputfile, 0, null, 1);

if (!$resultexec['error']) {
Expand All @@ -2239,7 +2239,7 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo

// We also exclude '/temp/' dir and 'documents/admin/documents'
// We make escapement here and call executeCLI without escapement because we don't want to have the '*.log' escaped.
$cmd = getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION_DOCLING', 'docling')." --from pdf --to text '".escapeshellcmd($filetoprocess)."'";
$cmd = getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT_DOCLING', 'docling')." --from pdf --to text '".escapeshellcmd($filetoprocess)."'";
$resultexec = $utils->executeCLI($cmd, $outputfile, 0, null, 1);

if (!$resultexec['error']) {
Expand Down
16 changes: 8 additions & 8 deletions htdocs/ecm/class/ecmfiles.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class EcmFiles extends CommonObject
'fullpath_orig' => array('type' => 'varchar(750)', 'label' => 'FullPathOrig', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "full path of original filename, when file is uploaded from a local computer"),
'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => 0, 'position' => 110),
'keywords' => array('type' => 'varchar(750)', 'label' => 'Keywords', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "list of keywords, separated with comma. Must be limited to most important keywords."),
'content' => array('type' => 'html', 'label' => 'Content', 'enabled' => 'getDolGlobalString("MAIN_USE_FULL_TEXT_INDEXATION")', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax200', 'help' => "Text content of file", 'showoncombobox' => 2, 'validate' => 1,'comment' => "Text content if option to store txt content was set."),
'content' => array('type' => 'html', 'label' => 'Content', 'enabled' => 'getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax200', 'help' => "Text content of file", 'showoncombobox' => 2, 'validate' => 1,'comment' => "Text content if option to store txt content was set."),
'cover' => array('type' => 'text', 'label' => 'Cover', 'enabled' => 1, 'visible' => 0, 'position' => 130, 'comment' => "is this file a file to use for a cover"),
'position' => array('type' => 'integer', 'label' => 'Position', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 140, 'index' => 1, 'comment' => "position of file among others"),
'gen_or_uploaded' => array('type' => 'varchar(12)', 'label' => 'GenOrUpload', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "'generated' or 'uploaded'"),
Expand Down Expand Up @@ -317,7 +317,7 @@ public function create(User $user, $notrigger = 0)
$sql .= 'fullpath_orig,';
$sql .= 'description,';
$sql .= 'keywords,';
if (getDolGlobalString("MAIN_USE_FULL_TEXT_INDEXATION")) {
if (getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")) {
$sql .= 'content,';
}
$sql .= 'cover,';
Expand All @@ -341,7 +341,7 @@ public function create(User $user, $notrigger = 0)
$sql .= ' '.(!isset($this->fullpath_orig) ? 'NULL' : "'".$this->db->escape($this->fullpath_orig)."'").',';
$sql .= ' '.(!isset($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").',';
$sql .= ' '.(!isset($this->keywords) ? 'NULL' : "'".$this->db->escape($this->keywords)."'").',';
if (getDolGlobalString("MAIN_USE_FULL_TEXT_INDEXATION")) {
if (getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")) {
$sql .= ' '.(!isset($this->content) ? 'NULL' : "'".$this->db->escape($this->content)."'").',';
}
$sql .= ' '.(!isset($this->cover) ? 'NULL' : "'".$this->db->escape($this->cover)."'").',';
Expand Down Expand Up @@ -426,7 +426,7 @@ public function fetch($id, $ref = '', $relativepath = '', $hashoffile = '', $has
$sql .= " t.fullpath_orig,";
$sql .= " t.description,";
$sql .= " t.keywords,";
if (getDolGlobalString("MAIN_USE_FULL_TEXT_INDEXATION")) {
if (getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")) {
$sql .= " t.content,";
}
$sql .= " t.cover,";
Expand Down Expand Up @@ -507,7 +507,7 @@ public function fetch($id, $ref = '', $relativepath = '', $hashoffile = '', $has
$this->fullpath_orig = $obj->fullpath_orig;
$this->description = $obj->description;
$this->keywords = $obj->keywords;
if (getDolGlobalString("MAIN_USE_FULL_TEXT_INDEXATION")) {
if (getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")) {
$this->content = $obj->content;
}
$this->cover = $obj->cover;
Expand Down Expand Up @@ -571,7 +571,7 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset =
$sql .= " t.fullpath_orig,";
$sql .= " t.description,";
$sql .= " t.keywords,";
if (getDolGlobalString("MAIN_USE_FULL_TEXT_INDEXATION")) {
if (getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")) {
$sql .= " t.content,";
}
$sql .= " t.cover,";
Expand Down Expand Up @@ -646,7 +646,7 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset =
$line->fullpath_orig = $obj->fullpath_orig;
$line->description = $obj->description;
$line->keywords = $obj->keywords;
if (getDolGlobalString("MAIN_USE_FULL_TEXT_INDEXATION")) {
if (getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")) {
$line->content = $obj->content;
}
$line->cover = $obj->cover;
Expand Down Expand Up @@ -751,7 +751,7 @@ public function update(User $user, $notrigger = 0)
$sql .= ' fullpath_orig = '.(isset($this->fullpath_orig) ? "'".$this->db->escape($this->fullpath_orig)."'" : "null").',';
$sql .= ' description = '.(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").',';
$sql .= ' keywords = '.(isset($this->keywords) ? "'".$this->db->escape($this->keywords)."'" : "null").',';
if (getDolGlobalString("MAIN_USE_FULL_TEXT_INDEXATION")) {
if (getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")) {
$sql .= ' content = '.(isset($this->content) ? "'".$this->db->escape($this->content)."'" : "null").',';
}
$sql .= ' cover = '.(isset($this->cover) ? "'".$this->db->escape($this->cover)."'" : "null").',';
Expand Down

0 comments on commit 062c769

Please sign in to comment.