From 062c769cc3fcf88b61118cb713d6ea7e49b6b4b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2024 00:01:18 +0100 Subject: [PATCH] Rename MAIN_USE_FULL_TEXT_INDEXATION into MAIN_SAVE_FILE_CONTENT_AS_TEXT --- htdocs/core/class/html.formfile.class.php | 4 ++-- htdocs/core/lib/files.lib.php | 10 +++++----- htdocs/ecm/class/ecmfiles.class.php | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 941b1f72e0498..0a457bedfad21 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -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 .= '

Option to extract the file content in text to save it in database is ON ('.getDolGlobalString('MAIN_USE_FULL_TEXT_INDEXATION').')'; + if (getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT')) { + $tooltiptext .= '

Option to extract the file content in text to save it in database is ON ('.getDolGlobalString('MAIN_SAVE_FILE_CONTENT_AS_TEXT').')'; } $out .= ' '; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index cda577554b94c..61e3ce361a28f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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'; } } @@ -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']) { @@ -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']) { diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 6f92db937c325..45a2736602853 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -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'"), @@ -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,'; @@ -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)."'").','; @@ -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,"; @@ -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; @@ -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,"; @@ -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; @@ -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").',';