diff --git a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php index 5e336f95835e599551abccc46b1d984e9f7f9e75..69fb18808c47f2401c083e93c2a06cac2eae4bfa 100755 --- a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php +++ b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php @@ -180,7 +180,6 @@ abstract class business_app_tools_Abstract extends Database 'script_search' => (string) $col->script_search, 'script_search_result' => (string) $col->script_search_result, 'script_details' => (string) $col->script_details, - 'path_to_lucene_index' => (string) $col->path_to_lucene_index, 'extensions' => $tab, ); @@ -210,7 +209,6 @@ abstract class business_app_tools_Abstract extends Database 'script_search' => (string) $col->script_search, 'script_search_result' => (string) $col->script_search_result, 'script_details' => (string) $col->script_details, - 'path_to_lucene_index' => (string) $col->path_to_lucene_index, 'extensions' => $tab, ); } diff --git a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml index a8cc98c5d8874e2b38d17d28eed54d2a6f29a485..f555c50a61669cef7a843991772325a46b0c8b28 100755 --- a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml +++ b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml @@ -565,7 +565,6 @@ <xi:include href="../../../../modules/entities/xml/IVS/requests_definitions.xml"/> <xi:include href="../../../../modules/fileplan/xml/IVS/requests_definitions.xml"/> <xi:include href="../../../../modules/folder/xml/IVS/requests_definitions.xml"/> - <xi:include href="../../../../modules/full_text/xml/IVS/requests_definitions.xml"/> <xi:include href="../../../../modules/ldap/xml/IVS/requests_definitions.xml"/> <xi:include href="../../../../modules/life_cycle/xml/IVS/requests_definitions.xml"/> <xi:include href="../../../../modules/notes/xml/IVS/requests_definitions.xml"/> @@ -596,7 +595,6 @@ <xi:include href="../../../../modules/entities/xml/IVS/validation_rules.xml"/> <xi:include href="../../../../modules/fileplan/xml/IVS/validation_rules.xml"/> <xi:include href="../../../../modules/folder/xml/IVS/validation_rules.xml"/> - <xi:include href="../../../../modules/full_text/xml/IVS/validation_rules.xml"/> <xi:include href="../../../../modules/ldap/xml/IVS/validation_rules.xml"/> <xi:include href="../../../../modules/life_cycle/xml/IVS/validation_rules.xml"/> <xi:include href="../../../../modules/notes/xml/IVS/validation_rules.xml"/> @@ -627,7 +625,6 @@ <xi:include href="../../../../modules/entities/xml/IVS/data_types.xml"/> <xi:include href="../../../../modules/fileplan/xml/IVS/data_types.xml"/> <xi:include href="../../../../modules/folder/xml/IVS/data_types.xml"/> - <xi:include href="../../../../modules/full_text/xml/IVS/data_types.xml"/> <xi:include href="../../../../modules/ldap/xml/IVS/data_types.xml"/> <xi:include href="../../../../modules/life_cycle/xml/IVS/data_types.xml"/> <xi:include href="../../../../modules/notes/xml/IVS/data_types.xml"/> diff --git a/apps/maarch_entreprise/xml/config.xml.default b/apps/maarch_entreprise/xml/config.xml.default index 872734880dd16c71e8b0b5ac8b8c254d392f3623..21e1b8731690117a488cb8ad808591884bb7b0ec 100755 --- a/apps/maarch_entreprise/xml/config.xml.default +++ b/apps/maarch_entreprise/xml/config.xml.default @@ -55,7 +55,6 @@ <extensions> <table>mlb_coll_ext</table> </extensions> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> <categories> <category> <id>incoming</id> @@ -95,7 +94,6 @@ <extensions> <table/> </extensions> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> <categories> <category> <id>incoming</id> @@ -119,7 +117,6 @@ <extensions> <table/> </extensions> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_version_coll/</path_to_lucene_index> <categories> <category> <id>incoming</id> @@ -256,10 +253,6 @@ <moduleid>folder</moduleid> <comment>_FOLDERS_COMMENT</comment> </MODULES> - <MODULES> - <moduleid>full_text</moduleid> - <comment>_FULL_TEXT</comment> - </MODULES> <MODULES> <moduleid>notes</moduleid> <comment>_NOTES_COMMENT</comment> diff --git a/install/class/Class_Install.php b/install/class/Class_Install.php index d4894bf4d6a24767f9e3109a58bd3f73e476798d..fbd885e3ff137b462814eede1992235f18a220b7 100755 --- a/install/class/Class_Install.php +++ b/install/class/Class_Install.php @@ -349,16 +349,6 @@ class Install extends functions $cheminCustomMaarchCourrierModulesLdapScript = realpath('.')."/custom/cs_$databasename/modules/ldap/script"; mkdir($cheminCustomMaarchCourrierModulesLdapScript, 0755); - - /** Création répertoire fulltext dans le custom **/ - $cheminCustomMaarchCourrierModulesFullText = realpath('.')."/custom/cs_$databasename/modules/full_text"; - mkdir($cheminCustomMaarchCourrierModulesFullText, 0755); - - $cheminCustomMaarchCourrierModulesFullTextXml = realpath('.')."/custom/cs_$databasename/modules/full_text/xml"; - mkdir($cheminCustomMaarchCourrierModulesFullTextXml, 0755); - - $cheminCustomMaarchCourrierModulesFullTextScripts = realpath('.')."/custom/cs_$databasename/modules/full_text/scripts"; - mkdir($cheminCustomMaarchCourrierModulesFullTextScripts, 0755); } if (is_dir(realpath('.')."/custom/cs_$databasename/modules/")) { @@ -393,19 +383,6 @@ class Install extends functions $cheminCustomMaarchCourrierModulesLdapScript = realpath('.')."/custom/cs_$databasename/modules/ldap/script"; mkdir($cheminCustomMaarchCourrierModulesLdapScript, 0755); } - - if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/full_text/")) { - $cheminCustomMaarchCourrierModulesFullText = realpath('.')."/custom/cs_$databasename/modules/full_text"; - mkdir($cheminCustomMaarchCourrierModulesFullText, 0755); - } - if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/full_text/xml")) { - $cheminCustomMaarchCourrierModulesFullTextXml = realpath('.')."/custom/cs_$databasename/modules/full_text/xml"; - mkdir($cheminCustomMaarchCourrierModulesFullTextXml, 0755); - } - if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/full_text/scripts")) { - $cheminCustomMaarchCourrierModulesFullTextScripts = realpath('.')."/custom/cs_$databasename/modules/full_text/scripts"; - mkdir($cheminCustomMaarchCourrierModulesFullTextScripts, 0755); - } } //Création du lien symbolique sous linux @@ -539,15 +516,6 @@ class Install extends functions $cheminCustomMaarchCourrierModulesLdapScript = realpath('.')."/custom/cs_$databasename/modules/ldap/script"; mkdir($cheminCustomMaarchCourrierModulesLdapScript, 0755); - /** Création répertoire fulltext dans le custom **/ - $cheminCustomMaarchCourrierModulesFullText = realpath('.')."/custom/cs_$databasename/modules/full_text"; - mkdir($cheminCustomMaarchCourrierModulesFullText, 0755); - - $cheminCustomMaarchCourrierModulesFullTextXml = realpath('.')."/custom/cs_$databasename/modules/full_text/xml"; - mkdir($cheminCustomMaarchCourrierModulesFullTextXml, 0755); - - $cheminCustomMaarchCourrierModulesFullTextScripts = realpath('.')."/custom/cs_$databasename/modules/full_text/scripts"; - mkdir($cheminCustomMaarchCourrierModulesFullTextScripts, 0755); // exit; //Création du lien symbolique sous linux @@ -567,94 +535,6 @@ class Install extends functions return true; } - public function updateDocserverForXml($docserverPath) - { - $xmlconfig = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/config.xml'); - //$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default'; - $COLLECTION_1 = $xmlconfig->COLLECTION[0]; - $COLLECTION_1->path_to_lucene_index = $docserverPath.'/indexes/letterbox_coll/'; - - $COLLECTION_2 = $xmlconfig->COLLECTION[1]; - $COLLECTION_2->path_to_lucene_index = $docserverPath.'/indexes/attachments_coll/'; - - $COLLECTION_3 = $xmlconfig->COLLECTION[2]; - $COLLECTION_3->path_to_lucene_index = $docserverPath.'/indexes/version_attachments_coll/'; - - $res = $xmlconfig->asXML(); - // $fp = @fopen("apps/maarch_entreprise/xml/config.xml", "w+"); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/config.xml', 'w+'); - if (!$fp) { - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - //configuration du chemin dans config_batch_letterbox.xml - $xmlconfig2 = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_letterbox.xml'); - //$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default'; - $CONFIG = $xmlconfig2->CONFIG; - - $CONFIG->INDEX_FILE_DIRECTORY = $docserverPath.'/indexes/letterbox_coll/'; - - $res = $xmlconfig2->asXML(); - // $fp = @fopen("apps/maarch_entreprise/xml/config.xml", "w+"); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_letterbox.xml', 'w+'); - if (!$fp) { - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - - //configuration du chemin dans config_batch_attachments.xml - $xmlconfig3 = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_attachments.xml'); - //$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default'; - $CONFIG = $xmlconfig3->CONFIG; - - $CONFIG->INDEX_FILE_DIRECTORY = $docserverPath.'/indexes/attachments_coll/'; - - $res = $xmlconfig3->asXML(); - // $fp = @fopen("apps/maarch_entreprise/xml/config.xml", "w+"); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_attachments.xml', 'w+'); - if (!$fp) { - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - - //configuration du chemin dans config_batch_version_attachments.xml - $xmlconfig4 = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_version_attachments.xml'); - //$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default'; - $CONFIG = $xmlconfig4->CONFIG; - - $CONFIG->INDEX_FILE_DIRECTORY = $docserverPath.'/indexes/version_attachments_coll/'; - - $res = $xmlconfig4->asXML(); - // $fp = @fopen("apps/maarch_entreprise/xml/config.xml", "w+"); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_version_attachments.xml', 'w+'); - if (!$fp) { - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - - return true; - } - public function verificationDatabase($databasename) { $connect = 'host='.$_SESSION['config']['databaseserver'].' '; @@ -737,16 +617,6 @@ class Install extends functions exit; } - if (!$this->setConfig_fulltext()) { - return false; - exit; - } - - if (!$this->setScript_full_text()) { - return false; - exit; - } - if (!$this->setConfig_batch_XmlNotifications()) { return false; exit; @@ -839,16 +709,6 @@ class Install extends functions exit; } - if (!$this->setConfig_fulltext()) { - return false; - exit; - } - - if (!$this->setScript_full_text()) { - return false; - exit; - } - if (!$this->setConfig_batch_XmlNotifications()) { return false; exit; @@ -918,11 +778,6 @@ class Install extends functions 10 12 * * 0 rm -Rf '.realpath('.').'/modules/notifications/batch/logs/process_event_stack/*.log 11 12 * * 0 rm -Rf '.realpath('.').'/modules/notifications/batch/logs/process_email_stack/*.log - -######################fulltext################################################### - -*/5 5-21 * * 1-5 '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/scripts/launch_fulltext.sh -20 12 * * 0 rm -Rf '.realpath('.').'/modules/full_text/log/*/*.log '; fwrite($file, $cron); fclose($file); @@ -1092,247 +947,6 @@ class Install extends functions return true; } - private function setConfig_fulltext() - { - //configuration du config_batch_letterbox.xml - $xmlconfig = simplexml_load_file('modules/full_text/xml/config_batch_letterbox.xml.default'); - //$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default'; - - $CONFIG = $xmlconfig->CONFIG; - $CONFIG->MAARCH_DIRECTORY = realpath('.'); - $CONFIG->MAARCH_TOOLS_PATH = realpath('.').'/apps/maarch_entreprise/tools/'; - - $CONFIG_BASE = $xmlconfig->CONFIG_BASE; - $CONFIG_BASE->databaseserver = $_SESSION['config']['databaseserver']; - $CONFIG_BASE->databaseserverport = $_SESSION['config']['databaseserverport']; - $CONFIG_BASE->databasename = $_SESSION['config']['databasename']; - $CONFIG_BASE->databaseuser = $_SESSION['config']['databaseuser']; - $CONFIG_BASE->databasepassword = $_SESSION['config']['databasepassword']; - - $LOG4PHP = $xmlconfig->LOG4PHP; - $LOG4PHP->Log4PhpConfigPath = realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/log4php.xml'; - - $res = $xmlconfig->asXML(); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_letterbox.xml', 'w+'); - if (!$fp) { - var_dump('fp error'); - - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - var_dump('write error'); - - return false; - exit; - } - - //configuration du config_batch_attachments.xml - $xmlconfigattachments = simplexml_load_file('modules/full_text/xml/config_batch_attachments.xml.default'); - //$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default'; - - $CONFIG = $xmlconfigattachments->CONFIG; - $CONFIG->MAARCH_DIRECTORY = realpath('.'); - $CONFIG->MAARCH_TOOLS_PATH = realpath('.').'/apps/maarch_entreprise/tools/'; - - $CONFIG_BASE = $xmlconfigattachments->CONFIG_BASE; - $CONFIG_BASE->databaseserver = $_SESSION['config']['databaseserver']; - $CONFIG_BASE->databaseserverport = $_SESSION['config']['databaseserverport']; - $CONFIG_BASE->databasename = $_SESSION['config']['databasename']; - $CONFIG_BASE->databaseuser = $_SESSION['config']['databaseuser']; - $CONFIG_BASE->databasepassword = $_SESSION['config']['databasepassword']; - - $LOG4PHP = $xmlconfigattachments->LOG4PHP; - $LOG4PHP->Log4PhpConfigPath = realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/log4php.xml'; - - $res = $xmlconfigattachments->asXML(); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_attachments.xml', 'w+'); - if (!$fp) { - var_dump('fp error'); - - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - var_dump('write error'); - - return false; - exit; - } - - //configuration du config_batch_version_attachments.xml - $xmlconfigversionattachments = simplexml_load_file('modules/full_text/xml/config_batch_version_attachments.xml.default'); - //$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default'; - - $CONFIG = $xmlconfigversionattachments->CONFIG; - $CONFIG->MAARCH_DIRECTORY = realpath('.'); - $CONFIG->MAARCH_TOOLS_PATH = realpath('.').'/apps/maarch_entreprise/tools/'; - - $CONFIG_BASE = $xmlconfigversionattachments->CONFIG_BASE; - $CONFIG_BASE->databaseserver = $_SESSION['config']['databaseserver']; - $CONFIG_BASE->databaseserverport = $_SESSION['config']['databaseserverport']; - $CONFIG_BASE->databasename = $_SESSION['config']['databasename']; - $CONFIG_BASE->databaseuser = $_SESSION['config']['databaseuser']; - $CONFIG_BASE->databasepassword = $_SESSION['config']['databasepassword']; - - $LOG4PHP = $xmlconfigversionattachments->LOG4PHP; - $LOG4PHP->Log4PhpConfigPath = realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/log4php.xml'; - - $res = $xmlconfigversionattachments->asXML(); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_version_attachments.xml', 'w+'); - if (!$fp) { - var_dump('fp error'); - - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - var_dump('write error'); - - return false; - exit; - } - - return true; - } - - private function setScript_full_text() - { - if (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') { - //configuration du lauch_fulltext.sh - $res = '#!/bin/bash'; - $res .= "\n"; - //$res .= "file='".realpath('.')."/modules/full_text/lucene_full_text_engine.php'"; - $res .= "\n"; - $res .= 'cd '.realpath('.').'/modules/full_text/'; - $res .= "\n"; - $res .= 'php '.realpath('.').'/modules/full_text/lucene_full_text_engine.php '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_letterbox.xml'; - $res .= "\n"; - - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/scripts/launch_fulltext.sh', 'w+'); - if (!$fp) { - var_dump('false error dans setScript_full_text()'); - - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - - //configuration du lauch_fulltext_attachments.sh - $res2 = '#!/bin/bash'; - $res2 .= "\n"; - //$res .= "file='".realpath('.')."/modules/full_text/lucene_full_text_engine.php'"; - $res2 .= "\n"; - $res2 .= 'cd '.realpath('.').'/modules/full_text/'; - $res2 .= "\n"; - $res2 .= 'php '.realpath('.').'/modules/full_text/lucene_full_text_engine.php '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_attachments.xml'; - $res2 .= "\n"; - - $fp2 = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/scripts/launch_fulltext_attachments.sh', 'w+'); - if (!$fp2) { - var_dump('false error dans setScript_full_text()'); - - return false; - exit; - } - $write2 = fwrite($fp2, $res2); - if (!$write2) { - return false; - exit; - } - - //configuration du lauch_fulltext_version_attachments.sh - $res3 = '#!/bin/bash'; - $res3 .= "\n"; - //$res .= "file='".realpath('.')."/modules/full_text/lucene_full_text_engine.php'"; - $res3 .= "\n"; - $res3 .= 'cd '.realpath('.').'/modules/full_text/'; - $res3 .= "\n"; - $res3 .= 'php '.realpath('.').'/modules/full_text/lucene_full_text_engine.php '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/xml/config_batch_version_attachments.xml'; - $res3 .= "\n"; - - $fp3 = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/scripts/launch_fulltext_version_attachments.sh', 'w+'); - if (!$fp3) { - var_dump('false error dans setScript_full_text()'); - - return false; - exit; - } - $write3 = fwrite($fp3, $res3); - if (!$write3) { - return false; - exit; - } - - return true; - } elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - //configuration du lauch_fulltext.sh - $res = 'cd '.realpath('.')."\modules\\full_text\\"; - $res .= "\n"; - $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\full_text\lucene_full_text_engine.php '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'\modules\full_text\xml\config_batch_letterbox.xml'; - $res .= "\n"; - - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/scripts/launch_fulltext.bat', 'w+'); - if (!$fp) { - var_dump('false error dans setScript_full_text()'); - - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - - //configuration du lauch_fulltext_attachments.sh - $res = 'cd '.realpath('.')."\modules\\full_text\\"; - $res .= "\n"; - $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\full_text\lucene_full_text_engine.php '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'\modules\full_text\xml\config_batch_attachments.xml'; - $res .= "\n"; - - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/scripts/launch_fulltext_attachments.bat', 'w+'); - if (!$fp) { - var_dump('false error dans setScript_full_text()'); - - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - //configuration du lauch_fulltext_version_attachments.sh - $res = 'cd '.realpath('.')."\modules\\full_text\\"; - $res .= "\n"; - $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\full_text\lucene_full_text_engine.php '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'\modules\full_text\xml\config_batch_version_attachments.xml'; - $res .= "\n"; - - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/full_text/scripts/launch_fulltext_version_attachments.bat', 'w+'); - if (!$fp) { - var_dump('false error dans setScript_full_text()'); - - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - - return true; - } - } - private function setScript_syn_LDAP_sh() { $res = '#!/bin/bash'; @@ -1353,7 +967,7 @@ class Install extends functions $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/ldap/script/syn_ldap.sh', 'w+'); if (!$fp) { - var_dump('false error dans setScript_full_text()'); + var_dump('false error dans setScript_syn_LDAP_sh()'); return false; exit; diff --git a/install/scripts/docservers.php b/install/scripts/docservers.php index 9e13b64269cfda8423e41cfb05f7fb33b0a368a3..80c08c8a382dda4d4e785fc5571880cf473e3df8 100755 --- a/install/scripts/docservers.php +++ b/install/scripts/docservers.php @@ -63,7 +63,6 @@ if (!$Class_Install->createDocservers($_REQUEST['docserverRoot'])) { $updateDocserversDB = $Class_Install->updateDocserversDB( $_REQUEST['docserverRoot'] ); -$Class_Install->updateDocserverForXml($_REQUEST['docserverRoot']); $return['status'] = 1; $return['text'] = ''; diff --git a/install/view/config_view.php b/install/view/config_view.php index 511fbee289c3635d9154e060d5340de77c9233bb..d1d67c4a85e0ad3d2acfb83c80004bf0fe037bd8 100755 --- a/install/view/config_view.php +++ b/install/view/config_view.php @@ -45,8 +45,6 @@ if (file_exists($filename)) { $applicationname = $CONFIG->applicationname; // var_dump((string) $CONFIG->applicationname); // var_dump($applicationname); - $COLLECTION = $xmlconfig->COLLECTION; - $path_to_lucene_index = (string) $COLLECTION->path_to_lucene_index; $xmlconfigSMTP = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/config/config.xml'); @@ -279,11 +277,6 @@ if (file_exists($filename)) { <td>:</td> <td><input type="text" name="applicationname" id="applicationname" value="<?php echo (string) $_SESSION['config']['databasename']; ?> "/></td> </tr> - <tr> - <td><?php echo _PATH_TO_DOCSERVER;?></td> - <td>:</td> - <td><input type="text" name="smtpPassword" id="smtpPassword" disabled="disabled" value=<?php echo $path_to_lucene_index; ?> /></td> - </tr> <tr> <td></td> <td></td> diff --git a/migration/19.10/migrateFullText.php b/migration/19.10/migrateFullText.php index 5bb294f938ceacf8bcc0d39ea54d2e08c23edb14..1d8feb2a542592468daf873eded59fa351aa4a09 100644 --- a/migration/19.10/migrateFullText.php +++ b/migration/19.10/migrateFullText.php @@ -37,6 +37,18 @@ foreach ($customs as $custom) { ]); } + foreach ($xmlfile->MODULES as $key => $module) { + if ((string)$module->moduleid == 'full_text') { + unset($xmlfile->MODULES[$key]); + } + } + + $res = $xmlfile->asXML(); + $fp = fopen($path, "w+"); + if ($fp) { + fwrite($fp, $res); + } + $migrated++; } } diff --git a/modules/full_text/LoggerLog4php.php b/modules/full_text/LoggerLog4php.php deleted file mode 100755 index 900b13489c94f5e461aa96db89b1a0808cfffa6a..0000000000000000000000000000000000000000 --- a/modules/full_text/LoggerLog4php.php +++ /dev/null @@ -1,314 +0,0 @@ -<?php - -/** Logger class - * - * @author Laurent Giovannoni <dev@maarch.org> - **/ - -class Logger4Php -{ - - /** - * Array of errors levels - * - * @protected - **/ - protected $error_levels = array('DEBUG' => 0, 'INFO' => 1, 'NOTICE' => 2, 'WARNING' => 3, 'ERROR' => 4); - - /** - * Maps each handler with its log threshold. - * - * @protected - **/ - protected $mapping; - - /** - * Minimum log level - * - * @protected - **/ - protected $threshold_level; - - /** - * Path to log4Php library - * - * @protected - **/ - protected $log4PhpLibrary; - - /** - * Name of the logger - * - * @protected - **/ - protected $log4PhpLogger; - - /** - * Name of the business code - * - * @protected - **/ - protected $log4PhpBusinessCode; - - /** - * Path of the param of log4php - * - * @protected - **/ - protected $log4PhpConfigPath; - - /** - * Name of the batch - * - * @protected - **/ - protected $log4PhpBatchName; - - /** Class constructor - * - * Inits the threshold level - * - * @param $threshold_level (string) Threshold level (set to 'INFO' by default) - **/ - function __construct($threshold_level = 'WARNING') - { - $this->threshold_level = $threshold_level; - $this->mapping = array_fill(0, count($this->error_levels), array()); - } - - /** Writes error message in current handlers - * - * writes only if the error level is greater or equal the threshold level - * - * @param $msg (string) Error message - * @param $error_level (string) Error level (set to 'INFO' by default) - * @param $error_code (integer) Error code (set to 0 by default) - **/ - public function write($msg, $error_level = 'INFO', $error_code = 0, $other_params = array()) - { - if (!array_key_exists($error_level, $this->error_levels)) { - $error_level = 'INFO'; - } - $foundLogger = false; - if ($this->error_levels[$error_level] >= $this->error_levels[$this->threshold_level]) { - for ($i=$this->error_levels[$error_level];$i>=0;$i--) { - foreach ($this->mapping[$i] as $handler) { - $handler->write($msg, $error_level, $error_code, $other_params); - if ( - get_class($handler) == 'FileHandler' - && (isset($this->log4PhpLibrary) - && !empty($this->log4PhpLibrary)) - ) { - if ($error_code == 0) { - $result = 'OK'; - } else { - $result = 'KO'; - $msg = '%error_code:' . $error_code . '% ' . $msg; - } - require_once($this->log4PhpLibrary); - $remote_ip = '127.0.0.1'; - Logger::configure($this->log4PhpConfigPath); - $logger = Logger::getLogger($this->log4PhpLogger); - $searchPatterns = array('%ACCESS_METHOD%', - '%RESULT%', - '%BUSINESS_CODE%', - '%HOW%', - '%WHAT%', - '%REMOTE_IP%', - '%BATCH_NAME%' - ); - $replacePatterns = array('Script', - $result, - $this->log4PhpBusinessCode, - 'UP', - $msg, - $remote_ip, - $this->log4PhpBatchName - ); - $logLine = str_replace($searchPatterns, - $replacePatterns, - '[%ACCESS_METHOD%][%RESULT%]' - . '[%BUSINESS_CODE%][%HOW%][%WHAT%][%BATCH_NAME%]' - ); - $this->writeLog4php($logger, $logLine, $error_level); - } - } - } - } - } - - /** - * - * write a log entry with a specific log level - * @param object $logger Log4php logger - * @param string $logLine Line we want to trace - * @param enum $level Log level - */ - function writeLog4php($logger, $logLine, $level) { - switch ($level) { - case 'DEBUG': - $logger->debug($logLine); - break; - case 'INFO': - $logger->info($logLine); - break; - case 'WARNING': - $logger->warn($logLine); - break; - case 'ERROR': - $logger->error($logLine); - break; - case 'FATAL': - $logger->fatal($logLine); - break; - } - } - - /** Adds a new handler in the current handlers array - * - * @param $handler (object) Handler object - **/ - public function add_handler(&$handler, $error_level = NULL) - { - if(!isset($handler)) - return false; - - if(!isset($error_level) || !array_key_exists($error_level, $this->error_levels)) - { - $error_level = $this->threshold_level; - } - - $this->mapping[$this->error_levels[$error_level]][] = $handler; - return true; - } - - /** Adds a new handler in the current handlers array - * - * @param $handler (object) Handler object - **/ - public function change_handler_log_level(&$handler, $log_level ) - { - if (!isset($handler) || !isset($log_level)) - return false; - - if (!array_key_exists($log_level, $this->error_levels)) { - return false; - } - - for ($i=0; $i<count($this->mapping);$i++) { - for($j=0;$j<count($this->mapping[$i]);$j++) { - if($handler == $this->mapping[$i][$j]) { - unset($this->mapping[$i][$j]); - } - } - } - $this->mapping = array_values($this->mapping); - $this->mapping[$this->error_levels[$log_level]][] = $handler; - return true; - } - - /** Sets treshold level - * - * @param $treshold (string) treshold level - **/ - public function set_threshold_level($treshold) - { - if (isset($treshold) && array_key_exists($treshold, $this->error_levels)) { - $this->threshold_level = $treshold; - return true; - } - $this->threshold_level = 'WARNING'; - return false; - } - - /** Sets log4Php library path - * - * @param $log4PhpLibrary (string) path - **/ - public function set_log4PhpLibrary($log4PhpLibrary) - { - if (isset($log4PhpLibrary) && !empty($log4PhpLibrary)) { - if (file_exists($log4PhpLibrary)) { - $this->log4PhpLibrary = $log4PhpLibrary; - return true; - } else { - return false; - } - } - return false; - } - - /** Sets log4php logger name - * - * @param $log4PhpLogger (string) logger name - **/ - public function set_log4PhpLogger($log4PhpLogger) - { - if (isset($log4PhpLogger) && !empty($log4PhpLogger)) { - $this->log4PhpLogger = $log4PhpLogger; - return true; - } - $this->log4PhpLogger = 'loggerTechnique'; - return false; - } - - /** Sets log4php path to log4php xml config - * - * @param $log4PhpPath (string) path to log4php xml config - **/ - public function set_log4PhpConfigPath($log4PhpConfigPath) - { - if (isset($log4PhpConfigPath) && !empty($log4PhpConfigPath)) { - if (file_exists($log4PhpConfigPath)) { - $this->log4PhpConfigPath = $log4PhpConfigPath; - return true; - } else { - return false; - } - } - return false; - } - - /** Sets log4php business code - * - * @param $log4PhpBusinessCode (string) business code - **/ - public function set_log4PhpBusinessCode($log4PhpBusinessCode) - { - if (isset($log4PhpBusinessCode) && !empty($log4PhpBusinessCode)) { - $this->log4PhpBusinessCode = $log4PhpBusinessCode; - return true; - } - $this->log4PhpBusinessCode = 'Maarch'; - return false; - } - - /** Sets log4php batch name - * - * @param $log4PhpBatchName (string) BatchName - **/ - public function set_log4PhpBatchName($log4PhpBatchName) - { - if (isset($log4PhpBatchName) && !empty($log4PhpBatchName)) { - $this->log4PhpBatchName = $log4PhpBatchName; - return true; - } - $this->log4PhpBatchName = 'MaarchBatch'; - return false; - } - - /** Class destructor - * - * Calls handlers destructors - **/ - function __destruct() - { - for($i=0; $i<count($this->mapping);$i++) - { - foreach($this->mapping[$i] as $handler) - { - unset($handler); - } - } - } -} diff --git a/modules/full_text/batch_tools.php b/modules/full_text/batch_tools.php deleted file mode 100755 index beeb021c259cb5f0bf23a9d6b13fdfa74d857222..0000000000000000000000000000000000000000 --- a/modules/full_text/batch_tools.php +++ /dev/null @@ -1,155 +0,0 @@ -<?php - -/* - * Copyright 2008-2015 Maarch - * - * This file is part of Maarch Framework. - * - * Maarch Framework 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 3 of the License, or - * (at your option) any later version. - * - * Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>. - */ - -/** - * @brief API to manage batchs - * - * @file - * @author Laurent Giovannoni - * @date $date$ - * @version $Revision$ - * @ingroup core - */ - -/** - * Execute a sql query - * - * @param object $dbConn connection object to the database - * @param string $queryTxt path of the file to include - * @param boolean $transaction for rollback if error - * @return true if ok, exit if ko and rollback if necessary - */ -function Bt_doQuery($dbConn, $queryTxt, $param=array(), $transaction=false) -{ - if (count($param) > 0) { - $stmt = $dbConn->query($queryTxt, $param); - } else { - $stmt = $dbConn->query($queryTxt); - } - - if (!$stmt) { - if ($transaction) { - $_ENV['logger']->write('ROLLBACK', 'INFO'); - $dbConn->query('ROLLBACK'); - } - Bt_exitBatch( - 104, 'SQL Query error:' . $queryTxt - ); - } - $_ENV['logger']->write('SQL query:' . $queryTxt, 'DEBUG'); - return $stmt; -} - -/** - * Exit the batch with a return code, message in the log and - * in the database if necessary - * - * @param int $returnCode code to exit (if > O error) - * @param string $message message to the log and the DB - * @return nothing exit the program - */ -function Bt_exitBatch($returnCode, $message='') -{ - if (file_exists($_ENV['lckFile'])) { - unlink($_ENV['lckFile']); - } - if ($returnCode > 0) { - $_ENV['totalProcessedResources']--; - if ($_ENV['totalProcessedResources'] == -1) { - $_ENV['totalProcessedResources'] = 0; - } - if($returnCode < 100) { - if (file_exists($_ENV['errorLckFile'])) { - unlink($_ENV['errorLckFile']); - } - $semaphore = fopen($_ENV['errorLckFile'], "a"); - fwrite($semaphore, '1'); - fclose($semaphore); - } - $_ENV['logger']->write($message, 'ERROR', $returnCode); - Bt_logInDataBase($_ENV['totalProcessedResources'], 1, $message.' (return code: '. $returnCode.')'); - } elseif ($message <> '') { - $_ENV['logger']->write($message, 'INFO', $returnCode); - Bt_logInDataBase($_ENV['totalProcessedResources'], 0, $message.' (return code: '. $returnCode.')'); - } - Bt_updateWorkBatch(); - exit($returnCode); -} - -/** -* Insert in the database the report of the batch -* @param long $totalProcessed total of resources processed in the batch -* @param long $totalErrors total of errors in the batch -* @param string $info message in db -*/ -function Bt_logInDataBase($totalProcessed=0, $totalErrors=0, $info='') -{ - $query = "INSERT INTO history_batch (module_name, batch_id, event_date, " - . "total_processed, total_errors, info) values(?, ?, CURRENT_TIMESTAMP, ?, ?, ?)"; - $arrayPDO = array($_ENV['batchName'], $_ENV['wb'], $totalProcessed, $totalErrors, substr(str_replace('\\', '\\\\', str_replace("'", "`", $info)), 0, 999)); - $_ENV['db']->query($query, $arrayPDO); -} - -/** - * Get the batch if of the batch - * - * @return nothing - */ -function Bt_getWorkBatch() -{ - $req = "SELECT param_value_int FROM parameters WHERE id = ? "; - $stmt = $_ENV['db']->query($req, array($_ENV['batchName']."_id")); - - while ($reqResult = $stmt->fetchObject()) { - $_ENV['wb'] = $reqResult->param_value_int + 1; - } - if ($_ENV['wb'] == '') { - $req = "INSERT INTO parameters(id, param_value_int) VALUES (?, 1)"; - $_ENV['db']->query($req, array($_ENV['batchName']."_id")); - $_ENV['wb'] = 1; - } -} - -/** - * Update the database with the new batch id of the batch - * - * @return nothing - */ -function Bt_updateWorkBatch() -{ - $req = "UPDATE parameters SET param_value_int = ? WHERE id = ?"; - $_ENV['db']->query($req, array($_ENV['wb'], $_ENV['batchName']."_id")); -} - -/** - * Include the file requested if exists - * - * @param string $file path of the file to include - * @return nothing - */ -function Bt_myInclude($file) -{ - if (file_exists($file)) { - include_once ($file); - } else { - throw new IncludeFileError($file); - } -} diff --git a/modules/full_text/class/class_modules_tools.php b/modules/full_text/class/class_modules_tools.php deleted file mode 100755 index f3ddd50ad95e451140c6755d921aede551369491..0000000000000000000000000000000000000000 --- a/modules/full_text/class/class_modules_tools.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class full_text -{ - function __construct() - { - - } - - public function build_modules_tables() - { - - } - -} - diff --git a/modules/full_text/lang/en.php b/modules/full_text/lang/en.php deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/modules/full_text/lang/fr.php b/modules/full_text/lang/fr.php deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/modules/full_text/lang/nl.php b/modules/full_text/lang/nl.php deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/modules/full_text/log/.gitkeep b/modules/full_text/log/.gitkeep deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/modules/full_text/lucene_full_text_engine.php b/modules/full_text/lucene_full_text_engine.php deleted file mode 100755 index 399b26c8f989cc25ee80ad5e39737a7e45308ec1..0000000000000000000000000000000000000000 --- a/modules/full_text/lucene_full_text_engine.php +++ /dev/null @@ -1,518 +0,0 @@ -<?php - -/** - * Copyright Maarch since 2008 under licence GPLv3. - * See LICENCE.txt file at the root folder for more details. - * This file is part of Maarch software. - * - */ - -/** - * @brief Extraction of information on PDF / HTML / TXT with lucene functions of Zend Framework - * @author dev@maarch.org - * @ingroup full_text - * - * A user exit code is stored in fulltext_result column of the document in - * "res_letterbox" or "res_attachments" or "res_version_attachments": - * 1 : Full Text extraction successfull - * -1 : No file found - * -2 : File extension not allowed for lucene - * 2 : no result for this extraction - * - * You can use "--debugMode" in command to display more process informations (/!\ log might be heavy !) - * You can use "--noLimit" in command to process all documents in one batch (be carefull !) - * You can use "--limit {n}" in command to process {n} documents in one batch - * You can use "--failed" in command to re analyse documents with -1 result - */ - -try { - include('Maarch_CLITools/ArgsParser.php'); - include('LoggerLog4php.php'); - include('Maarch_CLITools/FileHandler.php'); - include('Maarch_CLITools/ConsoleHandler.php'); -} catch (IncludeFileError $e) { - echo 'Maarch_CLITools required ! \n (pear.maarch.org)\n'; - exit(106); -} - -// Load tools -$_ENV['batchName'] = 'fulltext'; -$_ENV['wb'] = ''; -$_ENV['lckFile'] = ''; -$_ENV['totalProcessedResources'] = 0; - -include('batch_tools.php'); - -// Open Logger -$_ENV['logger'] = new Logger4Php(); - -$logLevel = array_search('--debugMode', $argv); -if ($logLevel > 0) { - $_ENV['logger']->set_threshold_level('DEBUG'); -} else { - $_ENV['logger']->set_threshold_level('INFO'); -} - -// global vars of the program -/** - * Name of the config (usefull for multi instance) - */ -$_ENV['config_name'] = ""; -/** - * Path to the log file - */ -$_ENV['log'] = ""; -/** - * User exit of the program, contains 1 if any problem appears - */ -$_ENV['ErrorLevel'] = 0; - -/** - * Managing of errors - * @param $errMsg string text of the error - */ -function errorHandler($errMsg) -{ - $_ENV['logger']->write($errMsg, 'ERROR'); - $_ENV['ErrorLevel'] = 1; -} - -/** - * Check if a folder is empty - * @param $dir string path of the directory to chek - * @return boolean true if the directory exists - */ -function isDirEmpty($dir) -{ - $dir = opendir($dir); - $isEmpty = true; - while (($entry = readdir($dir)) !== false) { - if ($entry !== '.' && $entry !== '..') { - $isEmpty = false; - break; - } - } - closedir($dir); - return $isEmpty; -} - -/** - * Launch the lucene engine if it's a pdf / html / txt file - * @param $pathToFile string path of the file to index - * @param $indexFileDirectory string directory of the lucene index - * @param $format string format of the document to index - * @param $id integer id of the document to index - * @return integer user exit code stored in fulltext_result column of the - * document in "res_letterbox" or "res_attachments" or "res_version_attachments" - */ -function indexFullText($pathToFile, $indexFileDirectory, $format, $Id) -{ - $result = -1; - - $fh = @fopen($pathToFile, 'r'); - - if (!$fh && strstr(error_get_last()['message'], 'Permission denied') !== false) { - errorHandler("{$pathToFile} permission denied!"); - } elseif (!$fh && strstr(error_get_last()['message'], 'No such file or directory') !== false) { - errorHandler("{$pathToFile} not found!"); - } else { - fclose($fh); - switch (strtoupper($format)) { - case "PDF": - $result = prepareIndexFullTextPdf($pathToFile, $indexFileDirectory, $Id); - break; - case "HTML": - libxml_use_internal_errors(true); - $result = prepareIndexFullTextHtml($pathToFile, $indexFileDirectory, $Id); - break; - case "MAARCH": - $result = prepareIndexFullTextHtml($pathToFile, $indexFileDirectory, $Id); - break; - case "TXT": - $result = prepareIndexFullTextTxt($pathToFile, $indexFileDirectory, $Id); - break; - default: - $_ENV['logger']->write(strtoupper($format) . " not allowed for lucene"); - $result = -2; - } - } - return $result; -} - -/** - * Remove word less than two chars and extra white spaces - * @param $fileContent text content - - * @return string cleaned text content - * - */ -function cleanFileContent($fileContent) -{ - $func = new functions(); - - $fileContent = $func->normalize($fileContent); - - $fileContent = preg_replace('/[[:cntrl:]]/', ' ', $fileContent); - - - $fileContent = trim(preg_replace('/[[:punct:]]/', ' ', $fileContent)); - - - - $tmpArrFileContent = explode(' ', $fileContent); - $arrFileContent = []; - - foreach ($tmpArrFileContent as $key => $value) { - if (strlen($value) > 2) { - array_push($arrFileContent, $value); - } - } - - $fileContent = implode(' ', $arrFileContent); - - return $fileContent; -} - -function prepareIndexFullTextPdf($pathToFile, $indexFileDirectory, $Id) -{ - if (is_file($pathToFile)) { - $tmpFile = $_ENV["base_directory"] . "tmp" - . DIRECTORY_SEPARATOR . basename($pathToFile) . ".ftx"; - - $_ENV['logger']->write("pdftotext " . escapeshellarg($pathToFile) . " " . escapeshellarg($tmpFile), 'DEBUG'); - $resultExtraction = exec("pdftotext " . escapeshellarg($pathToFile) - . " " . escapeshellarg($tmpFile).' 2>&1', $output, $return); - - if (in_array("Syntax Error: Couldn't read xref table", $output)) { - errorHandler("{$pathToFile} is corrupted !"); - $result = 2; - } else if (!empty($output)) { - errorHandler("Extract text of document failed : " . implode(' ', $output)); - $result = 2; - } else { - $fileContent = readFileF($tmpFile); - $fileContent = cleanFileContent($fileContent); - - - $_ENV['logger']->write("content file : " . $fileContent, 'DEBUG'); - if (is_file($tmpFile)) { - unlink($tmpFile); - } - - if (empty($fileContent)) { - $_ENV['logger']->write("it is not an OCR pdf"); - $result = 2; - } else { - $result = launchIndexFullText($fileContent, $indexFileDirectory, $Id); - } - } - } else { - errorHandler("{$pathToFile} not found !"); - $result = -1; - } - return $result; -} - -function prepareIndexFullTextHtml($pathToFile, $indexFileDirectory, $Id) -{ - if (is_file($pathToFile)) { - $fileContent = trim(readFileF($pathToFile)); - - $fileContent = convert_html_to_text($fileContent); - - $fileContent = cleanFileContent($fileContent); - - $_ENV['logger']->write("content file : " . $fileContent, 'DEBUG'); - $result = launchIndexFullText($fileContent, $indexFileDirectory, $Id); - } else { - $result = -1; - } - return $result; -} - -function prepareIndexFullTextTxt($pathToFile, $indexFileDirectory, $Id) -{ - if (is_file($pathToFile)) { - $fileContent = trim(readFileF($pathToFile)); - $fileContent = cleanFileContent($fileContent); - $_ENV['logger']->write("content file : " . $fileContent, 'DEBUG'); - $result = launchIndexFullText($fileContent, $indexFileDirectory, $Id); - } else { - $result = -1; - } - return $result; -} - -/** - * Retrieve the text of a pdftext and launch the lucene engine - * @param $pathToFile string path of the file to index - * @param $indexFileDirectory string directory of the lucene index - * @param $id integer id of the document to index - * @return integer user exit code is stored in fulltext_result column of the - * document in "res_x" - */ -function launchIndexFullText($fileContent, $tempIndexFileDirectory, $Id) // $IndexFileDirectory is replace by tempIndexFileDirectory -{ - $indexFileDirectory = (string)$tempIndexFileDirectory; // with version 1.12, we need a string, not an XML element - $result = -1; - $luceneErr = false; - if (strlen($fileContent) > 20) { - if (!is_dir($indexFileDirectory)) { - $_ENV['logger']->write($indexFileDirectory . " will be created !", "DEBUG"); - try { - $index = @Zend_Search_Lucene::create($indexFileDirectory); - } catch (Exception $e) { - $luceneErr = true; - errorHandler($e->getMessage()); - } - } else { - if (isDirEmpty($indexFileDirectory)) { - $_ENV['logger']->write('lucene files in ' . $indexFileDirectory . " will be created !", "DEBUG"); - try { - $index = @Zend_Search_Lucene::create($indexFileDirectory); - } catch (Exception $e) { - $luceneErr = true; - errorHandler($e->getMessage()); - } - } else { - $_ENV['logger']->write('open lucene files in ' . $indexFileDirectory, "DEBUG"); - try { - $index = @Zend_Search_Lucene::open($indexFileDirectory); - } catch (Exception $e) { - $luceneErr = true; - errorHandler($e->getMessage()); - } - } - } - if ($luceneErr === false) { - try { - $index->setFormatVersion(Zend_Search_Lucene::FORMAT_2_3); // we set the lucene format to 2.3 - Zend_Search_Lucene_Analysis_Analyzer::setDefault( - new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive() // we need utf8 for accents - ); - $term = new Zend_Search_Lucene_Index_Term($Id, 'Id'); - foreach ($index->termDocs($term) as $id) { - $index->delete($id); - } - $doc = new Zend_Search_Lucene_Document(); - $doc->addField(Zend_Search_Lucene_Field::UnIndexed('Id', $Id)); - $doc->addField(Zend_Search_Lucene_Field::UnStored( - 'contents', - $fileContent - )); - $index->addDocument($doc); - $index->commit(); - $_ENV['logger']->write('link res_id to lucene indexes', "DEBUG"); - - $result = 1; - } catch (Exception $e) { - errorHandler($e->getMessage()); - } - } - } else { - $result = 2; - $_ENV['logger']->write('Content has too few characters (<20)'); - } - return $result; -} - -/** - * Read a txt file - * @param $file string path of the file to read - * @return string contents of the file - */ -function readFileF($file) -{ - $result = ""; - if (is_file($file)) { - $fp = fopen($file, "r"); - $result = fread($fp, filesize($file)); - fclose($fp); - } - return $result; -} - -// Begin -date_default_timezone_set('Europe/Paris'); - -if ($argc < 2) { - echo "You must specify the configuration file " . $argc . "\n\n"; - exit; -} - -$conf = $argv[1]; -$xmlconfig = @simplexml_load_file($conf); - -if ($xmlconfig == false) { - echo "\nError on loading config file: " . $conf . "\n\n"; - exit(103); -} - -foreach ($xmlconfig->CONFIG as $CONFIG) { - $_ENV['config_name'] = $CONFIG->CONFIG_NAME; - $maarch_directory = $CONFIG->MAARCH_DIRECTORY; - $_ENV['maarch_directory'] = $maarch_directory; - $_ENV['base_directory'] = $_ENV['maarch_directory'] . '/modules/full_text/'; - $indexFileDirectory = $CONFIG->INDEX_FILE_DIRECTORY; - $_ENV['tablename'] = $CONFIG->TABLE_NAME; - $_ENV['max_batch_size'] = $CONFIG->MAX_BATCH_SIZE; -} - -$_ENV['maarch_tools_path'] = $_ENV['maarch_directory'] . '/apps/maarch_entreprise/tools/'; - -if (!file_exists('log/'.$_ENV['tablename']. '/')) { - mkdir('log/'.$_ENV['tablename']. '/'); -} - -$_ENV['logFile'] = 'log/'.$_ENV['tablename']. '/' .$_ENV['config_name'].'_'. date('Y-m-d_H-i-s'); - -$file = new FileHandler($_ENV['logFile'] . '.log'); -$_ENV['logger']->add_handler($file); - -if (array_search('--noLimit', $argv) > 0) { - $limit = ''; -} else if (array_search('--limit', $argv) > 0) { - $cmdLimit = array_search('--limit', $argv); - $limit = ' LIMIT ' . $argv[$cmdLimit+1]; -} else { - $limit = ' LIMIT ' . $_ENV['max_batch_size']; -} - -$log4phpParams = $xmlconfig->LOG4PHP; -if ((string)$log4phpParams->enabled == 'true') { - $_ENV['logger']->set_log4PhpLibrary( - $_ENV['maarch_directory'] . 'apps/maarch_entreprise/tools/log4php/Logger.php' - ); - $_ENV['logger']->set_log4PhpLogger((string)$log4phpParams->Log4PhpLogger); - $_ENV['logger']->set_log4PhpBusinessCode((string)$log4phpParams->Log4PhpBusinessCode); - $_ENV['logger']->set_log4PhpConfigPath((string)$log4phpParams->Log4PhpConfigPath); - $_ENV['logger']->set_log4PhpBatchName('full_text'); -} - -$_ENV['logger']->write("Loading the xml config file : " . $conf, 'DEBUG'); - -$_ENV['logger']->write("Config name : " . $_ENV['config_name']); - -$_ENV['logger']->write("Full text engine launched for table : " . $_ENV['tablename']); - -if (array_search('--failed', $argv) > 0) { - $_ENV['logger']->write("RE ANALYZE FAILED DOCUMENTS MODE"); - $fulltextTarget = "fulltext_result = '-1'"; -} else { - $fulltextTarget = "(fulltext_result IN ('0', '') or fulltext_result is null)"; -} - -require("../../core/class/class_functions.php"); -require("../../core/class/class_db_pdo.php"); - -// Storing text in lucene index -set_include_path($_ENV['maarch_tools_path'] . DIRECTORY_SEPARATOR - . PATH_SEPARATOR . get_include_path()); -require_once('Zend/Search/Lucene.php'); -include_once('html2text/html2text.php'); - -$_ENV['db'] = new Database($conf); - -Bt_getWorkBatch(); - -$docServers = "SELECT docserver_id, path_template FROM docservers"; - -$stmt = $_ENV['db']->query($docServers); - -$err = 0; -$errInfo = ''; - -while ($queryResult = $stmt->fetch(PDO::FETCH_NUM)) { - $pathToDocServer[$queryResult[0]] = $queryResult[1]; -} -if ($_ENV['tablename'] == 'res_attachments' || $_ENV['tablename'] == 'res_version_attachments') { - $_ENV['logger']->write("docServers " . $_ENV['tablename'] . " found !", 'DEBUG'); - - $queryIndexFullText = "SELECT res_id, docserver_id, path, filename, format FROM " - . $_ENV['tablename'] . " WHERE ".$fulltextTarget - . " AND lower(format) = 'pdf' AND attachment_type <> 'print_folder' AND status NOT IN ('DEL','OBS','TMP')" - . " GROUP BY res_id ORDER BY res_id ASC" . $limit; -} else { - $_ENV['logger']->write("docServers " . $_ENV['tablename'] . " found !", 'DEBUG'); - - $queryIndexFullText = "SELECT res_id, docserver_id, path, filename, format FROM " - . $_ENV['tablename'] . " WHERE ".$fulltextTarget - . " AND (source <> 'with_empty_file' or source is null) AND status NOT IN ('DEL')" - . " GROUP BY res_id ORDER BY res_id ASC" . $limit; -} - -$_ENV['logger']->write($queryIndexFullText, 'DEBUG'); - -$stmt = $_ENV['db']->query($queryIndexFullText); -$queryResult = $stmt->fetchAll(); - -$nbResToFulltext = count($queryResult); - -if ($nbResToFulltext === 0) { - Bt_exitBatch(0, 'No document to process'); -} else { - $_ENV['logger']->write($nbResToFulltext . ' document(s) to proceed'); -} - -$converted_doc = 0; - -foreach ($queryResult as $docNum => $data) { - $pathToFile = $pathToDocServer[$data["docserver_id"]] - . str_replace("#", DIRECTORY_SEPARATOR, $data["path"]) - . DIRECTORY_SEPARATOR . $data["filename"]; - - if (!empty(pathinfo($pathToFile, PATHINFO_EXTENSION))) { - $extension = pathinfo($pathToFile, PATHINFO_EXTENSION); - } else { - $extension = $data["format"]; - } - - - $_ENV['logger']->write("processing of document " . ($docNum + 1) . "/" . $nbResToFulltext . " (RES_ID => " . $data["res_id"] . ", FORMAT => " . $extension . ", FILE => " . $pathToFile . ")"); - - $result = indexFullText( - $pathToFile, - $indexFileDirectory, - $extension, - $data["res_id"] - ); - - $_ENV['logger']->write("result : " . $result); - - $updateDoc = "UPDATE " . $_ENV['tablename'] . " SET fulltext_result = ? WHERE res_id = ?"; - - $_ENV['logger']->write("UPDATE " . $_ENV['tablename'] . " SET fulltext_result = '" . $result . "' WHERE res_id = '" . $data["res_id"] . "'", 'DEBUG'); - - $_ENV['db']->query($updateDoc, array($result, $data["res_id"])); - - if ($result == 1) { - $converted_doc++; - } -} - -$_ENV['logger']->write($converted_doc . ' document(s) with fulltext'); - -Bt_logInDataBase( - $docNum+1, - $err, - $converted_doc . ' document(s) with fulltext' . $errInfo -); - -Bt_updateWorkBatch(); - -$_ENV['logger']->write('Optimize Lucene index'); -try { - $index = @Zend_Search_Lucene::open((string)$indexFileDirectory); - $index->optimize(); -} catch (Exception $e) { - $luceneErr = true; - errorHandler($e->getMessage()); -} - - -$_ENV['logger']->write("End of application !"); - -if ($_ENV['ErrorLevel'] > 0) { - rename($_ENV['logFile'] . ".log", $_ENV['logFile'] . "_ERR.log"); -} -exit($_ENV['ErrorLevel']); diff --git a/modules/full_text/scripts/launch_fulltext.sh.default b/modules/full_text/scripts/launch_fulltext.sh.default deleted file mode 100644 index 07bb45ae0d8ba3bb0f6d84c6f5046f9447163485..0000000000000000000000000000000000000000 --- a/modules/full_text/scripts/launch_fulltext.sh.default +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# You can use "--debugMode" in command to display more process informations (/!\ log might be heavy !) -# You can use "--noLimit" in command to process all documents in one batch (be carefull !) -# You can use "--limit {n}" in command to process {n} documents in one batch -# You can use "--failed" in command to re analyse documents with -1 result - -file='/var/www/html/MaarchCourrier/modules/full_text/lucene_full_text_engine.php' - -cd /var/www/html/MaarchCourrier/modules/full_text/ - -php $file /var/www/html/MaarchCourrier/modules/full_text/xml/config_batch_letterbox.xml diff --git a/modules/full_text/scripts/launch_fulltext_attachments.sh.default b/modules/full_text/scripts/launch_fulltext_attachments.sh.default deleted file mode 100644 index 118fbcf7f0ee381b118a493765ee5d5bd4c47f36..0000000000000000000000000000000000000000 --- a/modules/full_text/scripts/launch_fulltext_attachments.sh.default +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# You can use "--debugMode" in command to display more process informations (/!\ log might be heavy !) -# You can use "--noLimit" in command to process all documents in one batch (be carefull !) -# You can use "--limit {n}" in command to process {n} documents in one batch -# You can use "--failed" in command to re analyse documents with -1 result - -file='/var/www/html/MaarchCourrier/modules/full_text/lucene_full_text_engine.php' - -cd /var/www/html/MaarchCourrier/modules/full_text/ - -php $file /var/www/html/MaarchCourrier/modules/full_text/xml/config_batch_attachments.xml \ No newline at end of file diff --git a/modules/full_text/scripts/launch_fulltext_version_attachments.sh.default b/modules/full_text/scripts/launch_fulltext_version_attachments.sh.default deleted file mode 100644 index 7140023718d29d93c23b09ea40fd2db73c4ab84a..0000000000000000000000000000000000000000 --- a/modules/full_text/scripts/launch_fulltext_version_attachments.sh.default +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# You can use "--debugMode" in command to display more process informations (/!\ log might be heavy !) -# You can use "--noLimit" in command to process all documents in one batch (be carefull !) -# You can use "--limit {n}" in command to process {n} documents in one batch -# You can use "--failed" in command to re analyse documents with -1 result - -file='/var/www/html/MaarchCourrier/modules/full_text/lucene_full_text_engine.php' - -cd /var/www/html/MaarchCourrier/modules/full_text/ - -php $file /var/www/html/MaarchCourrier/modules/full_text/xml/config_batch_version_attachments.xml \ No newline at end of file diff --git a/modules/full_text/tmp/.gitkeep b/modules/full_text/tmp/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/modules/full_text/xml/IVS/data_types.xml b/modules/full_text/xml/IVS/data_types.xml deleted file mode 100755 index 710b3b566515c85e605bd4166463e16613cbb609..0000000000000000000000000000000000000000 --- a/modules/full_text/xml/IVS/data_types.xml +++ /dev/null @@ -1,3 +0,0 @@ -<dataTypes> - -</dataTypes> \ No newline at end of file diff --git a/modules/full_text/xml/IVS/requests_definitions.xml b/modules/full_text/xml/IVS/requests_definitions.xml deleted file mode 100755 index d45cdc97cacfb004c4e920b0058fbd1d406ac3f2..0000000000000000000000000000000000000000 --- a/modules/full_text/xml/IVS/requests_definitions.xml +++ /dev/null @@ -1,3 +0,0 @@ -<requestDefinitions> - -</requestDefinitions> \ No newline at end of file diff --git a/modules/full_text/xml/IVS/validation_rules.xml b/modules/full_text/xml/IVS/validation_rules.xml deleted file mode 100755 index 07950313a35e2a1052c593b81f32fed890c8347e..0000000000000000000000000000000000000000 --- a/modules/full_text/xml/IVS/validation_rules.xml +++ /dev/null @@ -1,3 +0,0 @@ -<validationRules> - -</validationRules> \ No newline at end of file diff --git a/modules/full_text/xml/config.xml b/modules/full_text/xml/config.xml deleted file mode 100755 index 02857e73869362907293d339733d9efda0e6ec27..0000000000000000000000000000000000000000 --- a/modules/full_text/xml/config.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> -</ROOT> diff --git a/modules/full_text/xml/config_batch_attachments.xml.default b/modules/full_text/xml/config_batch_attachments.xml.default deleted file mode 100755 index e5ced03400085e7caf9936c03e6ebcf16d428239..0000000000000000000000000000000000000000 --- a/modules/full_text/xml/config_batch_attachments.xml.default +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <CONFIG_NAME>MaarchCourrier</CONFIG_NAME> <!-- usefull for multi customs --> - <MAARCH_DIRECTORY>/var/www/html/MaarchCourrier/</MAARCH_DIRECTORY> <!-- Path to full text module --> - <INDEX_FILE_DIRECTORY>/opt/maarch/docservers/indexes/attachments_coll/</INDEX_FILE_DIRECTORY> <!-- Path to the indexes dir of the collection --> - <TABLE_NAME>res_attachments</TABLE_NAME> - <MAX_BATCH_SIZE>500</MAX_BATCH_SIZE> - </CONFIG> - <CONFIG_BASE> - <databaseserver>127.0.0.1</databaseserver> - <databaseserverport>5432</databaseserverport> - <databasetype>POSTGRESQL</databasetype> - <databasename>MaarchCourrier</databasename> - <databaseuser>maarch</databaseuser> - <databasepassword>maarch</databasepassword> - </CONFIG_BASE> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>full_text</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> diff --git a/modules/full_text/xml/config_batch_letterbox.xml.default b/modules/full_text/xml/config_batch_letterbox.xml.default deleted file mode 100755 index d01fa4525cf5b41246a22775f53c4fbd99b04f2f..0000000000000000000000000000000000000000 --- a/modules/full_text/xml/config_batch_letterbox.xml.default +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <CONFIG_NAME>MaarchCourrier</CONFIG_NAME> <!-- usefull for multi customs --> - <MAARCH_DIRECTORY>/var/www/html/MaarchCourrier/</MAARCH_DIRECTORY> <!-- Path to full text module --> - <INDEX_FILE_DIRECTORY>/opt/maarch/docservers/indexes/letterbox_coll/</INDEX_FILE_DIRECTORY> <!-- Path to the indexes dir of the collection --> - <TABLE_NAME>res_letterbox</TABLE_NAME> - <MAX_BATCH_SIZE>500</MAX_BATCH_SIZE> - </CONFIG> - <CONFIG_BASE> - <databaseserver>127.0.0.1</databaseserver> - <databaseserverport>5432</databaseserverport> - <databasetype>POSTGRESQL</databasetype> - <databasename>MaarchCourrier</databasename> - <databaseuser>maarch</databaseuser> - <databasepassword>maarch</databasepassword> - </CONFIG_BASE> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>full_text</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> diff --git a/modules/full_text/xml/config_batch_version_attachments.xml.default b/modules/full_text/xml/config_batch_version_attachments.xml.default deleted file mode 100755 index 9cb61a2c87c6a952de36feda8794f70a8b74432b..0000000000000000000000000000000000000000 --- a/modules/full_text/xml/config_batch_version_attachments.xml.default +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <CONFIG_NAME>MaarchCourrier</CONFIG_NAME> <!-- usefull for multi customs --> - <MAARCH_DIRECTORY>/var/www/html/MaarchCourrier/</MAARCH_DIRECTORY> <!-- Path to full text module --> - <INDEX_FILE_DIRECTORY>/opt/maarch/docservers/indexes/version_attachments_coll/</INDEX_FILE_DIRECTORY> <!-- Path to the indexes dir of the collection --> - <TABLE_NAME>res_version_attachments</TABLE_NAME> - <MAX_BATCH_SIZE>500</MAX_BATCH_SIZE> - </CONFIG> - <CONFIG_BASE> - <databaseserver>127.0.0.1</databaseserver> - <databaseserverport>5432</databaseserverport> - <databasetype>POSTGRESQL</databasetype> - <databasename>MaarchCourrier</databasename> - <databaseuser>maarch</databaseuser> - <databasepassword>maarch</databasepassword> - </CONFIG_BASE> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>full_text</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> diff --git a/modules/full_text/xml/services.xml b/modules/full_text/xml/services.xml deleted file mode 100755 index 125decc2e671a238ebc1f0789f0546595a468ca0..0000000000000000000000000000000000000000 --- a/modules/full_text/xml/services.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> -</root> diff --git a/src/core/lang/lang-en.php b/src/core/lang/lang-en.php index 2b5a00068f2e92825ce433bd67e6a3d981178c56..01bd3cc975f08f4326b836e7b9ebe684c30c90d7 100755 --- a/src/core/lang/lang-en.php +++ b/src/core/lang/lang-en.php @@ -233,7 +233,6 @@ define('_CASES_COMMENT', 'Cases'); define('_ENTITIES_COMMENT', 'Departments'); define('_FILEPLAN_COMMENT', 'Organizational file plan'); define('_FOLDERS_COMMENT', 'Folders'); -define('_FULL_TEXT', 'Full text'); define('_NOTES_COMMENT', 'Notes'); define('_NOTIFICATIONS_COMMENT', 'Notifications'); define('_TEMPLATES_COMMENT', 'Templates'); diff --git a/src/core/lang/lang-fr.php b/src/core/lang/lang-fr.php index 7a98fed877c1ccc93963cae0f655c0fab8414322..976ea096551bf3b14623a03dd5fa1581144a8e0a 100755 --- a/src/core/lang/lang-fr.php +++ b/src/core/lang/lang-fr.php @@ -233,7 +233,6 @@ define('_CASES_COMMENT', 'Affaires'); define('_ENTITIES_COMMENT', 'Entités'); define('_FILEPLAN_COMMENT', 'Plan de classement organisationnel'); define('_FOLDERS_COMMENT', 'Dossiers'); -define('_FULL_TEXT', 'Plein texte'); define('_NOTES_COMMENT', 'Annotations'); define('_NOTIFICATIONS_COMMENT', 'Notifications'); define('_TEMPLATES_COMMENT', 'Modèles de document'); diff --git a/src/core/lang/lang-nl.php b/src/core/lang/lang-nl.php index 5520946a164e80906eb890bed0578da7a7e84602..a03bd75e1232248d603c4219cb6e91cc0ed239ee 100755 --- a/src/core/lang/lang-nl.php +++ b/src/core/lang/lang-nl.php @@ -232,7 +232,6 @@ define('_CASES_COMMENT', 'Zaken'); define('_ENTITIES_COMMENT', 'Eenheden'); define('_FILEPLAN_COMMENT', 'Organisatorisch klasseringsplan'); define('_FOLDERS_COMMENT', 'Mappen'); -define('_FULL_TEXT', 'Volle tekst'); define('_NOTES_COMMENT', 'Opmerkingen'); define('_NOTIFICATIONS_COMMENT', 'Meldingen'); define('_TEMPLATES_COMMENT', 'Documentmodellen');