From 949d270d8ceff8c6e305c5c65ae1f5da1ed9a31e Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Mon, 20 May 2019 10:19:28 +0200 Subject: [PATCH] FEAT #10525 TIME 1:00 Clean useless code --- .../xml/IVS/requests_definitions.xml | 6 - .../Controllers/ProcessConvertController.php | 430 ------------ .../Controllers/ProcessFulltextController.php | 626 ------------------ .../ProcessManageConvertController.php | 224 ------- .../ProcessThumbnailsController.php | 343 ---------- .../convert/Models/ProcessConvertModel.php | 21 - .../Models/ProcessConvertModelAbstract.php | 218 ------ .../convert/Models/ProcessFulltextModel.php | 21 - .../Models/ProcessFulltextModelAbstract.php | 246 ------- .../convert/Models/ProcessThumbnailsModel.php | 21 - .../Models/ProcessThumbnailsModelAbstract.php | 240 ------- modules/convert/Test/ProcessConvertTest.php | 117 ---- modules/convert/Test/ProcessFulltextTest.php | 53 -- .../convert/Test/ProcessManageConvertTest.php | 373 ----------- .../convert/Test/ProcessThumbnailsTest.php | 52 -- modules/convert/Test/Samples/test.html | 8 - modules/convert/Test/Samples/test.odt | Bin 8726 -> 0 bytes modules/convert/Test/Samples/test.pdf | Bin 7945 -> 0 bytes modules/convert/Test/Samples/test.txt | 1 - modules/convert/ajax_convert.php | 35 - modules/convert/batch/LoggerLog4php.php | 321 --------- modules/convert/batch/batch_tools.php | 291 -------- modules/convert/batch/config/config.xml | 65 -- .../convert/batch/config/config.xml.default | 65 -- .../config/config_only_convert.xml.default | 67 -- .../config/config_only_indexes.xml.default | 67 -- .../config/parallel/config_0.xml.default | 65 -- .../config/parallel/config_1.xml.default | 65 -- .../config/parallel/config_2.xml.default | 65 -- .../config/parallel/config_3.xml.default | 65 -- .../config/parallel/config_4.xml.default | 65 -- modules/convert/batch/fill_stack.php | 247 ------- modules/convert/batch/load_fill_stack.php | 383 ----------- modules/convert/batch/process_stack.php | 233 ------- .../launch_convert_all_coll.sh.default | 15 - .../launch_convert_attachments.sh.default | 6 - .../launch_convert_letterbox.sh.default | 6 - .../launch_fulltext_all_coll.sh.default | 15 - .../launch_fulltext_attachments.sh.default | 9 - .../launch_fulltext_letterbox.sh.default | 9 - .../convert/batch/scripts/mywkhtmltoimage.sh | 2 - .../convert/batch/scripts/mywkhtmltopdf.sh | 2 - .../launch_convert_letterbox_0.sh.default | 8 - .../launch_convert_letterbox_1.sh.default | 8 - .../launch_convert_letterbox_2.sh.default | 8 - .../launch_convert_letterbox_3.sh.default | 8 - .../launch_convert_letterbox_4.sh.default | 8 - .../batch/scripts/parallel/param_cron.txt | 6 - modules/convert/batch/verif_index.php | 23 - modules/convert/class/class_modules_tools.php | 101 --- modules/convert/class/ws.php | 5 - modules/convert/css/module.css | 0 modules/convert/js/functions.js | 1 - modules/convert/lang/en.php | 22 - modules/convert/lang/fr.php | 22 - modules/convert/lang/nl.php | 7 - modules/convert/optimizeLuceneIndex.php | 70 -- modules/convert/test_convert.php | 106 --- modules/convert/xml/IVS/data_types.xml | 2 - .../convert/xml/IVS/requests_definitions.xml | 2 - modules/convert/xml/IVS/validation_rules.xml | 2 - modules/convert/xml/config.xml | 15 - modules/convert/xml/menu.xml | 3 - modules/convert/xml/services.xml | 3 - modules/entities/admin_entities.php | 91 --- modules/entities/choose_tree.php | 48 -- modules/entities/redirect.php | 2 +- modules/entities/show_trees.php | 152 ----- modules/entities/view_tree_entities.php | 57 -- .../entities/xml/IVS/requests_definitions.xml | 9 - modules/entities/xml/IVS/validation_rules.xml | 4 - modules/folder/get_folder_view_stats_val.php | 2 +- .../controllers/FullTextController.php | 39 +- 73 files changed, 23 insertions(+), 5974 deletions(-) delete mode 100755 modules/convert/Controllers/ProcessConvertController.php delete mode 100755 modules/convert/Controllers/ProcessFulltextController.php delete mode 100755 modules/convert/Controllers/ProcessManageConvertController.php delete mode 100755 modules/convert/Controllers/ProcessThumbnailsController.php delete mode 100755 modules/convert/Models/ProcessConvertModel.php delete mode 100755 modules/convert/Models/ProcessConvertModelAbstract.php delete mode 100755 modules/convert/Models/ProcessFulltextModel.php delete mode 100755 modules/convert/Models/ProcessFulltextModelAbstract.php delete mode 100755 modules/convert/Models/ProcessThumbnailsModel.php delete mode 100755 modules/convert/Models/ProcessThumbnailsModelAbstract.php delete mode 100755 modules/convert/Test/ProcessConvertTest.php delete mode 100755 modules/convert/Test/ProcessFulltextTest.php delete mode 100755 modules/convert/Test/ProcessManageConvertTest.php delete mode 100755 modules/convert/Test/ProcessThumbnailsTest.php delete mode 100755 modules/convert/Test/Samples/test.html delete mode 100755 modules/convert/Test/Samples/test.odt delete mode 100755 modules/convert/Test/Samples/test.pdf delete mode 100755 modules/convert/Test/Samples/test.txt delete mode 100755 modules/convert/ajax_convert.php delete mode 100755 modules/convert/batch/LoggerLog4php.php delete mode 100755 modules/convert/batch/batch_tools.php delete mode 100755 modules/convert/batch/config/config.xml delete mode 100755 modules/convert/batch/config/config.xml.default delete mode 100755 modules/convert/batch/config/config_only_convert.xml.default delete mode 100755 modules/convert/batch/config/config_only_indexes.xml.default delete mode 100755 modules/convert/batch/config/parallel/config_0.xml.default delete mode 100755 modules/convert/batch/config/parallel/config_1.xml.default delete mode 100755 modules/convert/batch/config/parallel/config_2.xml.default delete mode 100755 modules/convert/batch/config/parallel/config_3.xml.default delete mode 100755 modules/convert/batch/config/parallel/config_4.xml.default delete mode 100755 modules/convert/batch/fill_stack.php delete mode 100755 modules/convert/batch/load_fill_stack.php delete mode 100755 modules/convert/batch/process_stack.php delete mode 100755 modules/convert/batch/scripts/launch_convert_all_coll.sh.default delete mode 100755 modules/convert/batch/scripts/launch_convert_attachments.sh.default delete mode 100755 modules/convert/batch/scripts/launch_convert_letterbox.sh.default delete mode 100755 modules/convert/batch/scripts/launch_fulltext_all_coll.sh.default delete mode 100755 modules/convert/batch/scripts/launch_fulltext_attachments.sh.default delete mode 100755 modules/convert/batch/scripts/launch_fulltext_letterbox.sh.default delete mode 100755 modules/convert/batch/scripts/mywkhtmltoimage.sh delete mode 100755 modules/convert/batch/scripts/mywkhtmltopdf.sh delete mode 100755 modules/convert/batch/scripts/parallel/launch_convert_letterbox_0.sh.default delete mode 100755 modules/convert/batch/scripts/parallel/launch_convert_letterbox_1.sh.default delete mode 100755 modules/convert/batch/scripts/parallel/launch_convert_letterbox_2.sh.default delete mode 100755 modules/convert/batch/scripts/parallel/launch_convert_letterbox_3.sh.default delete mode 100755 modules/convert/batch/scripts/parallel/launch_convert_letterbox_4.sh.default delete mode 100755 modules/convert/batch/scripts/parallel/param_cron.txt delete mode 100755 modules/convert/batch/verif_index.php delete mode 100755 modules/convert/class/class_modules_tools.php delete mode 100755 modules/convert/class/ws.php delete mode 100755 modules/convert/css/module.css delete mode 100755 modules/convert/js/functions.js delete mode 100755 modules/convert/lang/en.php delete mode 100755 modules/convert/lang/fr.php delete mode 100644 modules/convert/lang/nl.php delete mode 100755 modules/convert/optimizeLuceneIndex.php delete mode 100755 modules/convert/test_convert.php delete mode 100755 modules/convert/xml/IVS/data_types.xml delete mode 100755 modules/convert/xml/IVS/requests_definitions.xml delete mode 100755 modules/convert/xml/IVS/validation_rules.xml delete mode 100755 modules/convert/xml/config.xml delete mode 100755 modules/convert/xml/menu.xml delete mode 100755 modules/convert/xml/services.xml delete mode 100755 modules/entities/admin_entities.php delete mode 100755 modules/entities/choose_tree.php delete mode 100755 modules/entities/show_trees.php delete mode 100755 modules/entities/view_tree_entities.php diff --git a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml index bc1edd1b0ae..a8cc98c5d88 100755 --- a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml +++ b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml @@ -17,12 +17,6 @@ </requestDefinition> <!-- Admin architecture --> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="admin_architecture" > - <parameter name="admin" value="architecture"/> - <parameter name="page" value="choose_tree"/> - <parameter name="display" value="true"/> - <parameter name="tree_id"/> - </requestDefinition> <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_structure" > <parameter name="page" value="structure_up"/> <parameter name="display" value="true"/> diff --git a/modules/convert/Controllers/ProcessConvertController.php b/modules/convert/Controllers/ProcessConvertController.php deleted file mode 100755 index 6c7af694ac8..00000000000 --- a/modules/convert/Controllers/ProcessConvertController.php +++ /dev/null @@ -1,430 +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 process convert class -* -* <ul> -* <li>Services to process the convertion of resources</li> -* </ul> -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup convert -*/ - -namespace Convert\Controllers; - -use Attachment\models\AttachmentModel; -use Docserver\controllers\DocserverController; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Resource\models\ResModel; -use Respect\Validation\Validator; -use Convert\Models\ProcessConvertModel; -use Docserver\models\DocserverModel; -use Docserver\models\ResDocserverModel; -use SrcCore\controllers\LogsController; - -class ProcessConvertController -{ - protected $libreOfficeExecutable; - - //public function __construct($libreOfficeExecutable = 'cloudooo') - public function __construct($libreOfficeExecutable = 'soffice') - //public function __construct($libreOfficeExecutable = 'unoconv') - { - $this->libreOfficeExecutable = $libreOfficeExecutable; - } - - public function create(RequestInterface $request, ResponseInterface $response) - { - $data = $request->getParams(); - - $check = Validator::notEmpty()->validate($data['collId']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['resTable']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['adrTable']); - $check = $check && Validator::intType()->notEmpty()->validate($data['resId']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['tmpDir']); - if (!$check) { - return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); - } - - $return = ProcessConvertController::convert($data); - - if (empty($return) || !empty($return['errors'])) { - return $response->withStatus(500)->withJson(['errors' => '[ProcessConvertController create] ' . $return['errors']]); - } - - return $response->withJson($return); - } - - /** - * Ask for conversion - * - * @param string $collId collection - * @param string $resTable resource table - * @param string $adrTable adr table - * @param long $resId res_id - * @param string $tmpDir path to tmp - * @param array $tgtfmt array of target format - * @return array $returnArray the result - */ - public function convert(array $args=[]) - { - $timestart = microtime(true); - // LogsController::info(['message'=>'debut convert', 'code'=>111, ]); - $returnArray = array(); - if (empty($args['collId'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'collId empty', - ); - return $returnArray; - } else { - $collId = $args['collId']; - } - if (empty($args['resTable'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'resTable empty', - ); - return $returnArray; - } else { - $resTable = $args['resTable']; - } - if (empty($args['adrTable'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'adrTable empty', - ); - return $returnArray; - } else { - $adrTable = $args['adrTable']; - } - if (empty($args['resId'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'resId empty', - ); - return $returnArray; - } else { - $resId = $args['resId']; - } - - if (!isset($args['tmpDir']) || $args['tmpDir'] == '') { - $tmpDir = $_SESSION['config']['tmppath']; - } else { - $tmpDir = $args['tmpDir']; - } - - if ($args['resTable'] == 'res_letterbox') { - $res = ResModel::getById(['resId' => $resId]); - } elseif ($args['resTable'] == 'res_attachments') { - $res = AttachmentModel::getById(['id' => $resId, 'isVersion' => 'false']); - } else { - $res = AttachmentModel::getById(['id' => $resId, 'isVersion' => 'true']); - } - - if ($res['res_id'] <> '') { - $resourcePath = ResDocserverModel::getSourceResourcePath( - [ - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $res['res_id'], - 'adrType' => 'DOC' - ] - ); - } - if (!file_exists($resourcePath)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'file not exists : ' . $resourcePath, - ); - ProcessConvertModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - //copy the resource on tmp directory - $fileNameOnTmp = $tmpDir . rand() . rand(); - if (!copy($resourcePath, $fileNameOnTmp)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'copy on tmp failed', - ); - ProcessConvertModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - //now do the conversion ! - if (strtoupper($res['format']) <> 'PDF') { - $resultOfConversion = $this->launchConvert( - $fileNameOnTmp, - 'pdf', - $tmpDir, - pathinfo($resourcePath, PATHINFO_EXTENSION) - ); - } else { - copy($fileNameOnTmp, $fileNameOnTmp . '.pdf'); - $resultOfConversion = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - } - if ($resultOfConversion['status'] <> '0') { - ProcessConvertModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $resultOfConversion; - } - //copy the result on docserver - // LogsController::info(['message'=>'avant cp ds', 'code'=>1112, ]); - $storeResult = DocserverController::storeResourceOnDocServer([ - 'collId' => $collId, - 'fileInfos' => [ - 'tmpDir' => $tmpDir, - 'tmpFileName' => pathinfo($fileNameOnTmp, PATHINFO_FILENAME) . '.pdf', - ], - 'docserverTypeId' => 'CONVERT' - ]); - - if (empty($storeResult)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'Ds of collection and ds type not found for convert:' - . $collId . ' CONVERT', - ); - ProcessConvertModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - - if (!empty($storeResult['errors'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => $storeResult['errors'] . ' error for convert:' - . $fileNameOnTmp, - ); - ProcessConvertModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - - $targetDs = DocserverModel::getByDocserverId(['docserverId' => $storeResult['docserver_id']]); - - // LogsController::info(['message'=>'avant update', 'code'=>19, ]); - //update the \Database - $resultOfUpDb = ProcessConvertModel::updateDatabase( - [ - 'collId' => $collId, - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $resId, - 'docserver' => $targetDs, - 'path' => $storeResult['destination_dir'], - 'fileName' => $storeResult['file_destination_name'] - ] - ); - // LogsController::info(['message'=>var_export($resultOfUpDb, true), 'code'=>111111, ]); - // LogsController::info(['message'=>$collId, 'code'=>2, ]); - // LogsController::info(['message'=>$resTable, 'code'=>3, ]); - // LogsController::info(['message'=>$adrTable, 'code'=>4, ]); - // LogsController::info(['message'=>$resId, 'code'=>5, ]); - // LogsController::info(['message'=>'apres res_id', 'code'=>6, ]); - // LogsController::info(['message'=>$targetDs, 'code'=>6, ]); - // LogsController::info(['message'=>var_export($resultCopyDs, true), 'code'=>7, ]); - - if ($resultOfUpDb['status'] <> '0') { - ProcessConvertModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $resultOfUpDb; - } - - unlink($fileNameOnTmp); - unlink($fileNameOnTmp . '.pdf'); - - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ProcessConvertAbstract_Service::convert' - ); - return $returnArray; - } - - /** - * Launch the conversion - * - * @param string $srcfile source file - * @param string $tgtfmt target format - * @param string $tgtdir target dir - * @param string $srcfmt source format - * @return array $returnArray the result - */ - public function launchConvert( - $srcfile, - $tgtfmt, - $tgtdir=false, - $srcfmt=null - ) { - $timestart=microtime(true); - - $processHtml = false; - $executable=''; - - // LogsController::info(['message'=>'[TIMER] Debut Convert_ProcessConvertAbstract_Service::launchConvert']); - if (strtoupper($srcfmt) == 'MAARCH' || strtoupper($srcfmt) == 'HTML') { - $processHtml = true; - // LogsController::info(['message'=>'[TIMER] srcfmt ' . $srcfmt]); - copy($srcfile, str_ireplace('.maarch', '.', $srcfile) . '.html'); - if (file_exists('/usr/bin/mywkhtmltopdf')) { - $command = "mywkhtmltopdf " - . escapeshellarg(str_ireplace('.maarch', '.', $srcfile) . '.html') . " " - . escapeshellarg($tgtdir . basename(str_ireplace('.maarch', '.', $srcfile)) . '.pdf'); - } else { - $envVar = "export DISPLAY=FRPAROEMINT:0.0 ; "; - $command = $envVar . "wkhtmltopdf " - . escapeshellarg(str_ireplace('.maarch', '.', $srcfile) . '.html') . " " - . escapeshellarg($tgtdir . basename(str_ireplace('.maarch', '.', $srcfile)) . '.pdf'); - } - $executable='wkhtmltopdf'; - } else { - $executable='soffice'; - // LogsController::info(['message'=>'[TIMER] let LO do it ' . $this->libreOfficeExecutable]); - if ($this->libreOfficeExecutable == "cloudooo") { - $serverAddress = "http://192.168.21.40:8011"; - $tokens = array(); - require_once 'apps/maarch_entreprise/tools/phpxmlrpc/lib/xmlrpc.inc'; - require_once 'apps/maarch_entreprise/tools/phpxmlrpc/lib/xmlrpcs.inc'; - require_once 'apps/maarch_entreprise/tools/phpxmlrpc/lib/xmlrpc_wrappers.inc'; - $fileContent = file_get_contents($srcfile, FILE_BINARY); - $encodedContent = base64_encode($fileContent); - $params = array(); - array_push($params, new PhpXmlRpc\Value($encodedContent)); - array_push($params, new PhpXmlRpc\Value($srcfmt)); - array_push($params, new PhpXmlRpc\Value($tgtfmt)); - array_push($params, new PhpXmlRpc\Value(false)); - $v = new PhpXmlRpc\Value($params, "array"); - } elseif ($this->libreOfficeExecutable == "unoconv") { - $tokens = array('"' . $this->libreOfficeExecutable . '"'); - $tokens[] = "-f"; - $tokens[] = $tgtfmt; - $tokens[] = '-o "' . $srcfile . '.' . $tgtfmt . '"'; - $tokens[] = '"' . $srcfile . '"'; - } else { - $tokens = array('"' . $this->libreOfficeExecutable . '"'); - $tokens[] = "--headless"; - $tokens[] = "--convert-to"; - $tokens[] = $tgtfmt; - $tokens[] = '"' . $srcfile . '"'; - if (!$tgtdir) { - $tgtdir = dirname($srcfile); - } - $tokens[] = '--outdir "' . $tgtdir . '"'; - } - - if (!$srcfmt) { - $tokens[] = $srcfmt; - } - - $command = implode(' ', $tokens); - - $output = array(); - $return = null; - $this->errors = array(); - } - //echo $command . '<br />';exit; - if ($this->libreOfficeExecutable == "cloudooo" && !$processHtml) { - // LogsController::info(['message'=>'[TIMER] commande : cloudooo url ' . $serverAddress]); - // LogsController::info(['message'=>'[TIMER] Debut Convert_ProcessConvertAbstract_Service::launchConvert__exec']); - $req = new PhpXmlRpc\Request('convertFile', $v); - //LogsController::info(['message'=>'[TIMER] commande : cloudooo url ' . $serverAddress]); - // LogsController::info(['message'=>'[TIMER] Fin Convert_ProcessConvertAbstract_Service::launchConvert__exec']); - $client = new PhpXmlRpc\Client($serverAddress); - $resp = $client->send($req); - if (!$resp->faultCode()) { - $encoder = new PhpXmlRpc\Encoder(); - $value = $encoder->decode($resp->value()); - $theFile = fopen($srcfile . '.' . $tgtfmt, 'w+'); - fwrite($theFile, base64_decode($value)); - fclose($theFile); - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - } else { - //print "An error occurred: "; - //print "Code: " . htmlspecialchars($resp->faultCode()) - // . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n"; - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => "Code: " . htmlspecialchars($resp->faultCode()) - . " Reason: '" . htmlspecialchars($resp->faultString()), - ); - } - } else { - $timestart_command = microtime(true); - exec("timeout -k 5m 3m " . $command, $output, $return); - // LogsController::debug(['message'=>'[TIMER] commande : ' . $command]); - LogsController::executionTimeLog($timestart_command, '', 'info', '[TIMER] ' . $executable . ' - Convert_ProcessConvertAbstract_Service::launchConvert__exec'); - if ($return === 0) { - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - } else { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => $return . $output, - ); - } - } - if (strtoupper($srcfmt) == 'MAARCH' || strtoupper($srcfmt) == 'HTML') { - $returnArray = array(); - unlink(str_ireplace('.maarch', '.', $srcfile) . '.html'); - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - } - LogsController::executionTimeLog( - $timestart, - '', - 'info', - '[TIMER] Fin Convert_ProcessConvertAbstract_Service::launchConvert' - ); - return $returnArray; - } -} diff --git a/modules/convert/Controllers/ProcessFulltextController.php b/modules/convert/Controllers/ProcessFulltextController.php deleted file mode 100755 index 36ec2f73262..00000000000 --- a/modules/convert/Controllers/ProcessFulltextController.php +++ /dev/null @@ -1,626 +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 process fulltext class -* -* <ul> -* <li>Services to process the fulltext of resources</li> -* </ul> -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup convert -*/ - -namespace Convert\Controllers; - -use Attachment\models\AttachmentModel; -use Docserver\controllers\DocserverController; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Resource\models\ResModel; -use Respect\Validation\Validator; -use Convert\Models\ProcessFulltextModel; -use Docserver\models\DocserverModel; -use Docserver\models\ResDocserverModel; -use SrcCore\controllers\LogsController; -use SrcCore\models\TextFormatModel; - - -class ProcessFulltextController -{ - protected $pdftotext; - - public function __construct($pdftotext = 'pdftotext') - { - // Storing text in lucene index - set_include_path('apps/maarch_entreprise/tools/' - . PATH_SEPARATOR . get_include_path() - ); - - //if(!@include('Zend/Search/Lucene.php')) { - set_include_path($GLOBALS['MaarchDirectory'] - . 'apps/maarch_entreprise/tools/' - . PATH_SEPARATOR . get_include_path() - ); - - require_once("Zend/Search/Lucene.php"); - //} - - $this->pdftotext = $pdftotext; - } - - public function create(RequestInterface $request, ResponseInterface $response) - { - $data = $request->getParams(); - - $check = Validator::notEmpty()->validate($data['collId']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['resTable']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['adrTable']); - $check = $check && Validator::intType()->notEmpty()->validate($data['resId']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['tmpDir']); - if (!$check) { - return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); - } - - if ($data['createZendIndex']) { - $countColl = count($_SESSION['collections']); - for ($i=0;$i<$countColl;$i++) { - if ($_SESSION['collections'][$i]['id'] == 'letterbox_coll') { - $pathToLucene = $_SESSION['collections'][$i]['path_to_lucene_index']; - } - } - - $data['zendIndex'] = ProcessFulltextController::createZendIndexObject( - $pathToLucene - ); - } - - $return = ProcessFulltextController::fulltext($data); - - if (empty($return) || !empty($return['errors'])) { - return $response->withStatus(500)->withJson(['errors' => '[ProcessFulltextController create] ' . $return['errors']]); - } - - return $response->withJson($return); - } - - /** - * Ask for fulltext - * - * @param string $collId collection - * @param string $resTable resource table - * @param string $adrTable adr table - * @param long $resId res_id - * @param string $tmpDir path to tmp - * @param array $tgtfmt array of target format - * @return array $returnArray the result - */ - public function fulltext(array $args=[]) - { - $timestart = microtime(true); - $returnArray = array(); - if (empty($args['collId'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'collId empty for fulltext', - ); - return $returnArray; - } else { - $collId = $args['collId']; - } - if (empty($args['resTable'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'resTable empty for fulltext', - ); - return $returnArray; - } else { - $resTable = $args['resTable']; - } - if (empty($args['adrTable'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'adrTable empty for fulltext', - ); - return $returnArray; - } else { - $adrTable = $args['adrTable']; - } - if (empty($args['resId'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'resId empty for fulltext', - ); - return $returnArray; - } else { - $resId = $args['resId']; - } - - if (!isset($args['tmpDir']) || $args['tmpDir'] == '') { - $tmpDir = $_SESSION['config']['tmppath']; - } else { - $tmpDir = $args['tmpDir']; - } - - if (isset($args['path_to_lucene']) && !empty($args['path_to_lucene'])) { - $indexFileDirectory = $args['path_to_lucene']; - } else { - $countColl = count($_SESSION['collections']); - for ($i=0;$i<$countColl;$i++) { - if ($_SESSION['collections'][$i]['id'] == $collId) { - $indexFileDirectory - = $_SESSION['collections'][$i]['path_to_lucene_index']; - } - } - } - if ($args['createZendIndex']) { - $countColl = count($_SESSION['collections']); - for ($i=0;$i<$countColl;$i++) { - if ($_SESSION['collections'][$i]['id'] == 'letterbox_coll') { - $pathToLucene = $_SESSION['collections'][$i]['path_to_lucene_index']; - } - } - - $args['zendIndex'] = ProcessFulltextController::createZendIndexObject( - $pathToLucene - ); - } - - if ($args['resTable'] == 'res_letterbox') { - $res = ResModel::getById(['resId' => $resId]); - } elseif ($args['resTable'] == 'res_attachments') { - $res = AttachmentModel::getById(['id' => $resId, 'isVersion' => 'false']); - } else { - $res = AttachmentModel::getById(['id' => $resId, 'isVersion' => 'true']); - } - - if ($res['res_id'] <> '') { - $resourcePath = ResDocserverModel::getSourceResourcePath( - [ - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $res['res_id'], - 'adrType' => 'CONV' - ] - ); - } - if (!file_exists($resourcePath)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'file not already converted in pdf for fulltext. path :' - . $resourcePath . ", adrType : CONV, adr_table : " . $adrTable, - ); - ProcessFulltextController::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - - //copy the resource on tmp directory - $fileNameOnTmp = $tmpDir . rand() . rand(); - if (!copy($resourcePath, $fileNameOnTmp)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'copy on tmp failed for fulltext. Copy ' . $resourcePath . ' to ' . $fileNameOnTmp, - ); - ProcessFulltextController::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - - //now do the fulltext ! - if (!empty($args['zendIndex'])) { - $resultOfConversion = $this->launchFulltext( - $fileNameOnTmp, - $resId, - $indexFileDirectory, - $tmpDir, - $args['zendIndex'] - ); - } else { - $resultOfConversion = $this->launchFulltext( - $fileNameOnTmp, - $resId, - $indexFileDirectory, - $tmpDir - ); - } - - if ($resultOfConversion['status'] <> '0') { - ProcessFulltextController::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ProcessFulltextAbstract_Service::fulltext aucunContenuAIndexer' - ); - return $resultOfConversion; - } - - //copy the result on docserver - // LogsController::info(['message'=>'avant cp ds', 'code'=>1112, ]); - $storeResult = DocserverController::storeResourceOnDocServer([ - 'collId' => $collId, - 'fileInfos' => [ - 'tmpDir' => $tmpDir, - 'tmpFileName' => pathinfo($fileNameOnTmp, PATHINFO_FILENAME) . '.txt', - ], - 'docserverTypeId' => 'FULLTEXT' - ]); - - if (empty($storeResult)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'Ds of collection and ds type not found for fulltext:' - . $collId . ' FULLTEXT', - ); - ProcessFulltextController::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - - $targetDs = DocserverModel::getByDocserverId(['docserverId' => $storeResult['docserver_id']]); - - // LogsController::info(['message'=>'avant update', 'code'=>19, ]); - //update the Database - $resultOfUpDb = ProcessFulltextModel::updateDatabase( - [ - 'collId' => $collId, - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $resId, - 'docserver' => $targetDs, - 'path' => $storeResult['destination_dir'], - 'fileName' => $storeResult['file_destination_name'], - 'zendIndex' => $args['zendIndex'] - ] - ); - - if ($resultOfUpDb['status'] <> '0') { - ProcessFulltextModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $resultOfUpDb; - } - - unlink($fileNameOnTmp); - unlink($fileNameOnTmp . '.txt'); - - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ProcessFulltextAbstract_Service::fulltext' - ); - return $returnArray; - } - - /** - * Launch the fulltext process - * - * @param string $srcfile source file - * @param string $tgtdir target dir - * @param string $srcfmt source format - * @return array $returnArray the result - */ - private function launchFulltext( - $srcfile, - $resId, - $indexFileDirectory, - $tgtdir=false, - $zendIndex='' - ) { - if (!empty($zendIndex)) { - $return = $this->prepareIndexFullTextPdf( - $srcfile, - $tgtdir, - $indexFileDirectory, - $resId, - $zendIndex - ); - } else { - $return = $this->prepareIndexFullTextPdf( - $srcfile, - $tgtdir, - $indexFileDirectory, - $resId - ); - } - - if ($return === 0) { - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - return $returnArray; - } else { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => $return . $output, - ); - return $returnArray; - } - } - - /** - * Read a txt file - * @param $file string path of the file to read - * @return string contents of the file - */ - private function readFileF($file) - { - $result = ""; - if (is_file($file)) { - $fp = fopen($file, "r"); - $result = fread($fp, filesize($file)); - fclose($fp); - } - return $result; - } - - private function prepareIndexFullTextPdf($pathToFile, $tmpDir, $indexFileDirectory, $resId, $zendIndex = "") - { - $timestart = microtime(true); - if (is_file($pathToFile)) { - $tmpFile = $tmpDir . basename($pathToFile) . ".txt"; - $timestart_fulltext = microtime(true); - $resultExtraction = exec("pdftotext " . escapeshellarg($pathToFile) - . " " . escapeshellarg($tmpFile) - ); - LogsController::executionTimeLog( - $timestart_fulltext, - '', - 'debug', - '[TIMER] Convert_ProcessFulltextAbstract_Service::prepareIndexFullTextPdf__exec' - ); - - $fileContent = trim($this->readFileF($tmpFile)); - - if (!empty($zendIndex)) { - $result = $this->launchIndexFullTextWithZendIndex( - $fileContent, - $indexFileDirectory, - $resId, - $zendIndex - ); - } else { - // TODO : will be done only by the batch convert in OnlyIndexes mode - //$result = $this->launchIndexFullText($fileContent, $indexFileDirectory, $resId); - $result = 0; - } - - } else { - $result = 'file not found ' . $pathToFile; - } - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ProcessFulltextAbstract_Service::prepareIndexFullTextPdf' - ); - return $result; - } - - /** - * Return zend index object for batch mode - * @param $indexFileDirectory string directory of the lucene index - * @return zend index object - */ - public function createZendIndexObject($tempIndexFileDirectory, $numberOfIndexes = 1000) - { - //echo 'createZendIndexObject : ' . $numberOfIndexes . PHP_EOL; - $indexFileDirectory = (string) $tempIndexFileDirectory; - // with version 1.12, we need a string, not an XML element - - if (!is_dir($indexFileDirectory)) { - $index = \Zend_Search_Lucene::create($indexFileDirectory); - } else { - if ($this->isDirEmpty($indexFileDirectory)) { - $index = \Zend_Search_Lucene::create($indexFileDirectory); - } else { - $index = \Zend_Search_Lucene::open($indexFileDirectory); - } - } - $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() - ); - - //$index->MaxBufferedDocs(); - $index->setMaxBufferedDocs($numberOfIndexes); - - return $index; - } - - /** - * Checks if a directory is empty - * - * @param $dir string The directory to check - * @return bool True if empty, False otherwise - */ - function isDirEmpty($dir) - { - $dir = opendir($dir); - $isEmpty = true; - while (($entry = readdir($dir)) !== false) { - if ($entry !== '.' && $entry !== '..' && $entry !== '.svn') { - $isEmpty = false; - break; - } - } - closedir($dir); - return $isEmpty; - } - - /** - * Commit the zend index at the end of the batch - * @return nothing - */ - public function commitZendIndex($index) - { - //echo 'the commit' . PHP_EOL; - $index->commit(); - } - - /** - * 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" - */ - private function launchIndexFullText($fileContent, $tempIndexFileDirectory, $Id) - { - // $IndexFileDirectory is replace by tempIndexFileDirectory - $fileContent = TextFormatModel::normalize(['string' => $fileContent]); - $fileContent = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $fileContent); - $indexFileDirectory = (string) $tempIndexFileDirectory; - // with version 1.12, we need a string, not an XML element - $result = -1; - if (strlen($fileContent) > 2) { - if (!is_dir($indexFileDirectory)) { - //$_ENV['logger']->write($indexFileDirectory . " not exists !", "ERROR", 2); - $index = Zend_Search_Lucene::create($indexFileDirectory); - } else { - if ($this->isDirEmpty($indexFileDirectory)) { - //$_ENV['logger']->write($indexFileDirectory . " empty !"); - $index = Zend_Search_Lucene::create($indexFileDirectory); - } else { - $index = Zend_Search_Lucene::open($indexFileDirectory); - } - } - $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); - } - //echo $fileContent; - $doc = new \Zend_Search_Lucene_Document(); - $doc->addField(\Zend_Search_Lucene_Field::UnIndexed('Id', (integer) $Id)); - $doc->addField(\Zend_Search_Lucene_Field::UnStored( - 'contents', $fileContent) - ); - $index->addDocument($doc); - $index->commit(); - //$index->optimize(); - $result = 0; - } 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" - */ - private function launchIndexFullTextWithZendIndex($fileContent, $tempIndexFileDirectory, $Id, $index) - { - //echo 'launchIndexFullTextWithZendIndex' . PHP_EOL; - // $IndexFileDirectory is replace by tempIndexFileDirectory - $fileContent = TextFormatModel::normalize(['string' => $fileContent]); - $fileContent = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $fileContent); - - // with version 1.12, we need a string, not an XML element - $result = -1; - if (strlen($fileContent) > 2) { - try { - // we need utf8 for accents - $term = new \Zend_Search_Lucene_Index_Term($Id, 'Id'); - foreach ($index->termDocs($term) as $id) { - $index->delete($id); - } - //echo $fileContent; - $doc = new \Zend_Search_Lucene_Document(); - $doc->addField(\Zend_Search_Lucene_Field::UnIndexed('Id', (integer) $Id)); - $doc->addField(\Zend_Search_Lucene_Field::UnStored( - 'contents', $fileContent) - ); - //$func->show_array($doc); - $index->addDocument($doc); - //$index->commit(); - //$func->show_array($index); - //$index->optimize(); - $result = 0; - } catch (Exception $e) { - $result = $e->getMessage(); - } - - } else if (strlen($fileContent) >= 0){ - $result = 0; - } - return $result; - } - - public static function optimizeLuceneIndex(array $args=[]){ - $timestart = microtime(true); - // prerequisites - self::checkRequired($args, ['collId']); - self::checkString($args, ['collId']); - - $collId = $args['collId']; - - $countColl = count($_SESSION['collections']); - for ($i=0;$i<$countColl;$i++) { - if ($_SESSION['collections'][$i]['id'] == $collId) { - $path_to_lucene = $_SESSION['collections'][$i]['path_to_lucene_index']; - } - } - - if(!empty($path_to_lucene)){ - exec( - 'php '.$_SESSION['config']['corepath'] . - 'modules/convert/optimizeLuceneIndex.php ' . - $path_to_lucene . ' ' . - $_SESSION['config']['corepath'] . ' > /dev/null 2>&1 &' - ); - } - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ProcessFulltextAbstract_Service::optimizeLuceneIndex' - ); - - return true; - } -} diff --git a/modules/convert/Controllers/ProcessManageConvertController.php b/modules/convert/Controllers/ProcessManageConvertController.php deleted file mode 100755 index 3b85205b816..00000000000 --- a/modules/convert/Controllers/ProcessManageConvertController.php +++ /dev/null @@ -1,224 +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 process manageConvert class -* -* <ul> -* <li>Services to process the management of convertion of resources</li> -* </ul> -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup convert -*/ - -namespace Convert\Controllers; - -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Respect\Validation\Validator; -use Convert\Controllers\ProcessConvertController; -use Convert\Controllers\ProcessFulltextController; -use Convert\Controllers\ProcessThumbnailsController; -use SrcCore\controllers\LogsController; - -class ProcessManageConvertController -{ - protected $libreOfficeExecutable; - - //public function __construct($libreOfficeExecutable = 'cloudooo') - public function __construct($libreOfficeExecutable = 'soffice') - //public function __construct($libreOfficeExecutable = 'unoconv') - { - $this->libreOfficeExecutable = $libreOfficeExecutable; - } - - public function create(RequestInterface $request, ResponseInterface $response) - { - $data = $request->getParams(); - - $check = Validator::notEmpty()->validate($data['collId']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['resTable']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['adrTable']); - $check = $check && Validator::intType()->notEmpty()->validate($data['resId']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['tmpDir']); - if (!$check) { - return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); - } - - $return = ProcessManageConvertController::convertAll($data); - - if (empty($return) || !empty($return['errors'])) { - return $response->withStatus(500)->withJson(['errors' => '[ProcessConvertController create] ' . $return['errors']]); - } - - return $response->withJson($return); - } - - /** - * Ask for conversion in all mode - * - * @param string $collId collection - * @param string $resTable resource table - * @param string $adrTable adr table - * @param long $resId res_id - * @param string $tmpDir path to tmp - * @throws Exception Check des valeurs d'entrées - * @return array $returnArray the result - */ - public function convertAll(array $args=[]) - { - $timestart = microtime(true); - // prerequisites - $returnArray = array(); - if (empty($args['collId'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'collId empty for manage convert', - ); - return $returnArray; - } else { - $collId = $args['collId']; - } - if (empty($args['resTable'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'resTable empty for manage convert', - ); - return $returnArray; - } else { - $resTable = $args['resTable']; - } - if (empty($args['adrTable'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'adrTable empty for manage convert', - ); - return $returnArray; - } else { - $adrTable = $args['adrTable']; - } - if (empty($args['resId'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'resId empty for manage convert', - ); - return $returnArray; - } else { - $resId = $args['resId']; - } - - - if (!isset($args['tmpDir']) || $args['tmpDir'] == '') { - $tmpDir = $_SESSION['config']['tmppath']; - } else { - $tmpDir = $args['tmpDir']; - } - - $path_to_lucene = ''; - if (isset($args['path_to_lucene']) && !empty($args['path_to_lucene'])){ - $path_to_lucene = $args['path_to_lucene']; - } - - $params = array( - 'collId' => $collId, - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $resId, - 'tmpDir' => $tmpDir, - 'path_to_lucene' => $path_to_lucene - ); - - //CONV - $ProcessConvertService = new ProcessConvertController(); - $resultOfConversion = $ProcessConvertService->convert($params); - - if ($resultOfConversion['status'] <> '0') { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'CONV:' . $resultOfConversion['error'], - ); - return $returnArray; - } - - //TNL - $ProcessConvertService = new ProcessThumbnailsController(); - $resultOfConversion = $ProcessConvertService->thumbnails($params); - if ($resultOfConversion['status'] <> '0') { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'TNL:' . $resultOfConversion['error'], - ); - return $returnArray; - } - - //FULLTEXT - if ($args['createZendIndex']) { - $params = array( - 'collId' => $collId, - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $resId, - 'tmpDir' => $tmpDir, - 'path_to_lucene' => $path_to_lucene, - 'createZendIndex' => true - ); - } else { - $params = array( - 'collId' => $collId, - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $resId, - 'tmpDir' => $tmpDir, - 'path_to_lucene' => $path_to_lucene - ); - } - $ProcessConvertServiceFulltext = new ProcessFulltextController(); - - $resultOfConversion = $ProcessConvertServiceFulltext->fulltext($params); - - if ($resultOfConversion['status'] <> '0') { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'TXT:' . $resultOfConversion['error'], - ); - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ManageConvertAbstract_Service::convertAll aucun contenu a indexer dans fulltext' - ); - return $returnArray; - } - - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ManageConvertAbstract_Service::convertAll' - ); - - return $returnArray; - } -} \ No newline at end of file diff --git a/modules/convert/Controllers/ProcessThumbnailsController.php b/modules/convert/Controllers/ProcessThumbnailsController.php deleted file mode 100755 index 78d02acee16..00000000000 --- a/modules/convert/Controllers/ProcessThumbnailsController.php +++ /dev/null @@ -1,343 +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 process thumbnails class -* -* <ul> -* <li>Services to process the thumbnails of resources</li> -* </ul> -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup convert -*/ - -namespace Convert\Controllers; - -use Attachment\models\AttachmentModel; -use Docserver\controllers\DocserverController; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Resource\models\ResModel; -use Respect\Validation\Validator; -use Convert\Models\ProcessThumbnailsModel; -use Docserver\models\DocserverModel; -use Docserver\models\ResDocserverModel; -use SrcCore\controllers\LogsController; - -class ProcessThumbnailsController -{ - protected $tnlExecutable; - - public function __construct($tnlExecutable = 'convert') - { - $this->tnlExecutable = $tnlExecutable; - } - - public function create(RequestInterface $request, ResponseInterface $response) - { - $data = $request->getParams(); - - $check = Validator::notEmpty()->validate($data['collId']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['resTable']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['adrTable']); - $check = $check && Validator::intType()->notEmpty()->validate($data['resId']); - $check = $check && Validator::stringType()->notEmpty()->validate($data['tmpDir']); - if (!$check) { - return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); - } - - $return = ProcessThumbnailsController::thumbnails($data); - - if (empty($return) || !empty($return['errors'])) { - return $response->withStatus(500)->withJson(['errors' => '[ProcessThumbnailsController create] ' . $return['errors']]); - } - - return $response->withJson($return); - } - - /** - * Ask for thumbnails - * - * @param string $collId collection - * @param string $resTable resource table - * @param string $adrTable adr table - * @param long $resId res_id - * @param string $tmpDir path to tmp - * @param array $tgtfmt array of target format - * @return array $returnArray the result - */ - public function thumbnails(array $args=[]) - { - $timestart = microtime(true); - $returnArray = array(); - if (empty($args['collId'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'collId empty for thumbnails', - ); - return $returnArray; - } else { - $collId = $args['collId']; - } - if (empty($args['resTable'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'resTable empty for thumbnails', - ); - return $returnArray; - } else { - $resTable = $args['resTable']; - } - if (empty($args['adrTable'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'adrTable empty for thumbnails', - ); - return $returnArray; - } else { - $adrTable = $args['adrTable']; - } - if (empty($args['resId'])) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'resId empty for thumbnails', - ); - return $returnArray; - } else { - $resId = $args['resId']; - } - - if (!isset($args['tmpDir']) || $args['tmpDir'] == '') { - $tmpDir = $_SESSION['config']['tmppath']; - } else { - $tmpDir = $args['tmpDir']; - } - - if ($args['resTable'] == 'res_letterbox') { - $res = ResModel::getById(['resId' => $resId]); - } elseif ($args['resTable'] == 'res_attachments') { - $res = AttachmentModel::getById(['id' => $resId, 'isVersion' => 'false']); - } else { - $res = AttachmentModel::getById(['id' => $resId, 'isVersion' => 'true']); - } - - if ($res['res_id'] <> '') { - $adrType = 'CONV'; - if ( - strtoupper($res['format']) == 'HTML' || - strtoupper($res['format']) == 'MAARCH' - ) { - $adrType = 'DOC'; - } - $resourcePath = ResDocserverModel::getSourceResourcePath( - [ - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $res['res_id'], - 'adrType' => $adrType - ] - ); - } - if (!file_exists($resourcePath)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'file not already converted in pdf for thumbnails. path :' - . $resourcePath . ", adrType : CONV, adr_table : " . $adrTable, - ); - ProcessThumbnailsModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - - //copy the resource on tmp directory - $fileNameOnTmp = $tmpDir . rand() . rand(); - if (!copy($resourcePath, $fileNameOnTmp)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'copy on tmp failed for thumbnails. Copy ' . $resourcePath . ' to ' . $fileNameOnTmp, - ); - ProcessThumbnailsModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - - //now do the thumbnails ! - $resultOfConversion = $this->launchThumbnails( - $fileNameOnTmp, - $tmpDir, - pathinfo($resourcePath, PATHINFO_EXTENSION) - ); - - - if ($resultOfConversion['status'] <> '0') { - ProcessThumbnailsModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ProcessThumbnailsAbstract_Service::thumbnails aucunContenuAIndexer' - ); - return $resultOfConversion; - } - - //copy the result on docserver - // LogsController::info(['message'=>'avant cp ds', 'code'=>1112, ]); - $storeResult = DocserverController::storeResourceOnDocServer([ - 'collId' => $collId, - 'fileInfos' => [ - 'tmpDir' => $tmpDir, - 'tmpFileName' => pathinfo($fileNameOnTmp, PATHINFO_FILENAME) . '.png', - ], - 'docserverTypeId' => 'TNL' - ]); - - if (empty($storeResult)) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => 'Ds of collection and ds type not found for thumbnails:' - . $collId . ' THUMBNAILS', - ); - ProcessThumbnailsModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $returnArray; - } - - $targetDs = DocserverModel::getByDocserverId(['docserverId' => $storeResult['docserver_id']]); - - // LogsController::info(['message'=>'avant update', 'code'=>19, ]); - //update the Database - $resultOfUpDb = ProcessThumbnailsModel::updateDatabase( - [ - 'collId' => $collId, - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $resId, - 'docserver' => $targetDs, - 'path' => $storeResult['destination_dir'], - 'fileName' => $storeResult['file_destination_name'] - ] - ); - - if ($resultOfUpDb['status'] <> '0') { - ProcessThumbnailsModel::manageErrorOnDb( - ['resTable' => $resTable, 'resId' => $resId, 'result' => '-1'] - ); - return $resultOfUpDb; - } - - unlink($fileNameOnTmp); - unlink($fileNameOnTmp . '.png'); - - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ProcessThumbnailsAbstract_Service::thumbnails' - ); - return $returnArray; - } - - /** - * Launch the thumbnails process - * - * @param string $srcfile source file - * @param string $tgtdir target dir - * @param string $srcfmt source format - * @return array $returnArray the result - */ - private function launchThumbnails( - $srcfile, - $tgtdir=false, - $srcfmt - ) { - $timestart = microtime(true); - if (!$tgtdir) { - $tgtdir = dirname($srcfile); - } - - $output = array(); - $return = null; - $this->errors = array(); - - //wkhtmltoimage must be installed with compiled sources - if (strtoupper($srcfmt) == 'MAARCH' || strtoupper($srcfmt) == 'HTML') { - copy($srcfile, str_ireplace('.maarch', '.', $srcfile) . '.html'); - if (file_exists('/usr/bin/mywkhtmltoimage')) { - $command = "mywkhtmltoimage --width 164 --height 105 --quality 100 --zoom 0.2 " - . escapeshellarg(str_ireplace('.maarch', '.', $srcfile) . '.html') . " " - . escapeshellarg($tgtdir . basename(str_ireplace('.maarch', '.', $srcfile)) . '.png'); - } else { - $envVar = "export DISPLAY=FRPAROEMINT:0.0 ; "; - $command = $envVar . "wkhtmltoimage --width 164 --height 105 --quality 100 --zoom 0.2 " - . escapeshellarg(str_ireplace('.maarch', '.', $srcfile) . '.html') . " " - . escapeshellarg($tgtdir . basename(str_ireplace('.maarch', '.', $srcfile)) . '.png'); - } - } else { - $command = "convert -thumbnail 200x300 -background white -alpha remove " - . escapeshellarg($srcfile) . "[0] " - . escapeshellarg($tgtdir . basename($srcfile) . '.png'); - } - //echo $command . PHP_EOL;exit; - $timestart_command = microtime(true); - exec($command, $output, $return); - // LogsController::debug(['message'=>'[TIMER] Commande : ' . $command]); - LogsController::executionTimeLog($timestart_command, '', 'debug', '[TIMER] Convert_ProcessThumbnailsAbstract_Service::launchThumbnails__exec'); - - if ($return === 0) { - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - } else { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => $return . $output, - ); - } - if (strtoupper($srcfmt) == 'MAARCH' || strtoupper($srcfmt) == 'HTML') { - $returnArray = array(); - unlink(str_ireplace('.maarch', '.', $srcfile) . '.html'); - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - } - LogsController::executionTimeLog( - $timestart, - '', - 'debug', - '[TIMER] Convert_ProcessThumbnailsAbstract_Service::launchThumbnails - '); - return $returnArray; - } -} diff --git a/modules/convert/Models/ProcessConvertModel.php b/modules/convert/Models/ProcessConvertModel.php deleted file mode 100755 index e8abb657f83..00000000000 --- a/modules/convert/Models/ProcessConvertModel.php +++ /dev/null @@ -1,21 +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 Process Convert Model -* @author dev@maarch.org -* @ingroup convert -*/ - -namespace Convert\Models; - -class ProcessConvertModel extends ProcessConvertModelAbstract -{ - // Do your stuff in this class -} diff --git a/modules/convert/Models/ProcessConvertModelAbstract.php b/modules/convert/Models/ProcessConvertModelAbstract.php deleted file mode 100755 index 9b48b17b46d..00000000000 --- a/modules/convert/Models/ProcessConvertModelAbstract.php +++ /dev/null @@ -1,218 +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 ProcessConvert Model -* @author dev@maarch.org -* @ingroup convert -*/ - -namespace Convert\Models; - -use History\controllers\HistoryController; -use SrcCore\models\DatabaseModel; -use SrcCore\models\ValidatorModel; - -class ProcessConvertModelAbstract -{ - /** - * Updating the database with the location information of the document on the - * new docserver - * @param string $collId collection - * @param string $resTable res table - * @param string $adrTable adr table - * @param bigint $resId Id of the resource to process - * @param docserver $docserver docserver object - * @param string $path location of the resource on the docserver - * @param string $fileName file name of the resource on the docserver - * @return array $returnArray the result - */ - public static function updateDatabase(array $aArgs = []) - { - try { - ValidatorModel::notEmpty($aArgs, ['collId']); - ValidatorModel::notEmpty($aArgs, ['resTable']); - ValidatorModel::notEmpty($aArgs, ['adrTable']); - ValidatorModel::intVal($aArgs, ['resId']); - ValidatorModel::notEmpty($aArgs, ['docserver']); - ValidatorModel::notEmpty($aArgs, ['path']); - ValidatorModel::notEmpty($aArgs, ['fileName']); - - $aArgs['docserver']['path_template'] = str_replace( - DIRECTORY_SEPARATOR, - '#', - $aArgs['docserver']['path_template'] - ); - $aArgs['path'] = str_replace( - $aArgs['docserver']['path_template'], - '', - $aArgs['path'] - ); - - DatabaseModel::update([ - 'table' => 'convert_stack', - 'set' => [ - 'status' => 'P' - ], - 'where' => ['coll_id = ?', 'res_id = ?'], - 'data' => [$aArgs['collId'], $aArgs['resId']] - ]); - - $returnAdr = DatabaseModel::select([ - 'select' => ['*'], - 'table' => [$aArgs['adrTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - 'order' => ['adr_priority'], - ]); - - if (empty($returnAdr)) { - $returnRes = DatabaseModel::select([ - 'select' => ['docserver_id, path, filename, offset_doc, fingerprint'], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - $returnRes = $returnRes[0]; - // LogsController::info(['message'=>$returnRes, 'code'=>8, ]); - $resDocserverId = $returnRes['docserver_id']; - $resPath = $returnRes['path']; - $resFilename = $returnRes['filename']; - $resOffsetDoc = $returnRes['offset_doc']; - $fingerprintInit = $returnRes['fingerprint']; - - DatabaseModel::insert([ - 'table' => $aArgs['adrTable'], - 'columnsValues' => [ - 'res_id' => $aArgs['resId'], - 'docserver_id' => $resDocserverId, - 'path' => $resPath, - 'filename' => $resFilename, - 'offset_doc' => $resOffsetDoc, - 'fingerprint' => $fingerprintInit, - 'adr_priority' => 1, - ] - ]); - } - - $returnAdr = DatabaseModel::select([ - 'select' => ['*'], - 'table' => [$aArgs['adrTable']], - 'where' => ['res_id = ?', 'adr_type= ?'], - 'data' => [$aArgs['resId'], 'CONV'], - ]); - - if (empty($returnAdr)) { - DatabaseModel::insert([ - 'table' => $aArgs['adrTable'], - 'columnsValues' => [ - 'res_id' => $aArgs['resId'], - 'docserver_id' => $aArgs['docserver']['docserver_id'], - 'path' => $aArgs['path'], - 'filename' => $aArgs['fileName'], - 'offset_doc' => '', - 'fingerprint' => '', - 'adr_priority' => 1, - 'adr_type' => 'CONV', - ] - ]); - } else { - DatabaseModel::update([ - 'table' => $aArgs['adrTable'], - 'set' => [ - 'docserver_id' => $aArgs['docserver']['docserver_id'], - 'path' => $aArgs['path'], - 'filename' => $aArgs['fileName'], - 'offset_doc' => '', - 'fingerprint' => '', - 'adr_priority' => 1, - ], - 'where' => ['res_id = ?', "adr_type = ?"], - 'data' => [$aArgs['resId'], 'CONV'] - ]); - } - - HistoryController::add([ - 'tableName' => $aArgs['resTable'], - 'recordId' => (string) $aArgs['resId'], - 'eventType' => 'ADD', - 'info' => 'process convert done', - 'moduleId' => 'convert', - 'eventId' => 'convert', - ]); - - $queryCpt = DatabaseModel::select([ - 'select' => ["convert_attempts"], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - ]); - - $cptConvert = $queryCpt[0]['convert_attempts'] + 1; - - DatabaseModel::update([ - 'table' => $aArgs['resTable'], - 'set' => [ - 'convert_result' => '1', - 'is_multi_docservers' => 'Y', - 'convert_attempts' => $cptConvert, - ], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - return $returnArray; - } catch (Exception $e) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => $e->getMessage(), - ); - return $returnArray; - } - } - - /** - * Updating the database with the error code - * @param string $resTable res table - * @param bigint $resId Id of the resource to process - * @param string $result error code - * @return nothing - */ - public static function manageErrorOnDb(array $aArgs = []) - { - $attemptsRecord = DatabaseModel::select([ - 'select' => ['convert_attempts'], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - ]); - - if (empty($attemptsRecord)) { - $attempts = 0; - } else { - $attempts = $attemptsRecord[0]['convert_attempts'] + 1; - } - - DatabaseModel::update([ - 'table' => $aArgs['resTable'], - 'set' => [ - 'convert_result' => $aArgs['result'], - 'convert_attempts' => $attempts, - ], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - } -} diff --git a/modules/convert/Models/ProcessFulltextModel.php b/modules/convert/Models/ProcessFulltextModel.php deleted file mode 100755 index ce546d414fe..00000000000 --- a/modules/convert/Models/ProcessFulltextModel.php +++ /dev/null @@ -1,21 +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 Process Fulltext Model -* @author dev@maarch.org -* @ingroup convert -*/ - -namespace Convert\Models; - -class ProcessFulltextModel extends ProcessFulltextModelAbstract -{ - // Do your stuff in this class -} diff --git a/modules/convert/Models/ProcessFulltextModelAbstract.php b/modules/convert/Models/ProcessFulltextModelAbstract.php deleted file mode 100755 index f6e123fd77b..00000000000 --- a/modules/convert/Models/ProcessFulltextModelAbstract.php +++ /dev/null @@ -1,246 +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 ProcessFulltext Model -* @author dev@maarch.org -* @ingroup convert -*/ - -namespace Convert\Models; - -use History\controllers\HistoryController; -use SrcCore\models\DatabaseModel; -use SrcCore\models\ValidatorModel; - -class ProcessFulltextModelAbstract -{ - /** - * Updating the database with the location information of the document on the - * new docserver - * @param string $collId collection - * @param string $resTable res table - * @param string $adrTable adr table - * @param bigint $resId Id of the resource to process - * @param docserver $docserver docserver object - * @param string $path location of the resource on the docserver - * @param string $fileName file name of the resource on the docserver - * @param complex $zendIndex zend index object - * @return array $returnArray the result - */ - public static function updateDatabase(array $aArgs = []) - { - try { - ValidatorModel::notEmpty($aArgs, ['collId']); - ValidatorModel::notEmpty($aArgs, ['resTable']); - ValidatorModel::notEmpty($aArgs, ['adrTable']); - ValidatorModel::intVal($aArgs, ['resId']); - ValidatorModel::notEmpty($aArgs, ['docserver']); - ValidatorModel::notEmpty($aArgs, ['path']); - ValidatorModel::notEmpty($aArgs, ['fileName']); - - $aArgs['docserver']['path_template'] = str_replace( - DIRECTORY_SEPARATOR, - '#', - $aArgs['docserver']['path_template'] - ); - $aArgs['path'] = str_replace( - $aArgs['docserver']['path_template'], - '', - $aArgs['path'] - ); - - DatabaseModel::update([ - 'table' => 'convert_stack', - 'set' => [ - 'status' => 'P' - ], - 'where' => ['coll_id = ?', 'res_id = ?'], - 'data' => [$aArgs['collId'], $aArgs['resId']] - ]); - - $returnAdr = DatabaseModel::select([ - 'select' => ['*'], - 'table' => [$aArgs['adrTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - 'order' => ['adr_priority'], - ]); - - if (empty($returnAdr)) { - $returnRes = DatabaseModel::select([ - 'select' => ['docserver_id, path, filename, offset_doc, fingerprint'], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - $returnRes = $returnRes[0]; - // LogsController::info(['message'=>$returnRes, 'code'=>8, ]); - $resDocserverId = $returnRes['docserver_id']; - $resPath = $returnRes['path']; - $resFilename = $returnRes['filename']; - $resOffsetDoc = $returnRes['offset_doc']; - $fingerprintInit = $returnRes['fingerprint']; - - DatabaseModel::insert([ - 'table' => $aArgs['adrTable'], - 'columnsValues' => [ - 'res_id' => $aArgs['resId'], - 'docserver_id' => $resDocserverId, - 'path' => $resPath, - 'filename' => $resFilename, - 'offset_doc' => $resOffsetDoc, - 'fingerprint' => $fingerprintInit, - 'adr_priority' => 1, - ] - ]); - } - - $returnAdr = DatabaseModel::select([ - 'select' => ['*'], - 'table' => [$aArgs['adrTable']], - 'where' => ['res_id = ?', 'adr_type= ?'], - 'data' => [$aArgs['resId'], 'TXT'], - ]); - - if (empty($returnAdr)) { - DatabaseModel::insert([ - 'table' => $aArgs['adrTable'], - 'columnsValues' => [ - 'res_id' => $aArgs['resId'], - 'docserver_id' => $aArgs['docserver']['docserver_id'], - 'path' => $aArgs['path'], - 'filename' => $aArgs['fileName'], - 'offset_doc' => '', - 'fingerprint' => '', - 'adr_priority' => 1, - 'adr_type' => 'TXT', - ] - ]); - } else { - DatabaseModel::update([ - 'table' => $aArgs['adrTable'], - 'set' => [ - 'docserver_id' => $aArgs['docserver']['docserver_id'], - 'path' => $aArgs['path'], - 'filename' => $aArgs['fileName'], - 'offset_doc' => '', - 'fingerprint' => '', - 'adr_priority' => 1, - ], - 'where' => ['res_id = ?', "adr_type = ?"], - 'data' => [$aArgs['resId'], 'TXT'] - ]); - } - - HistoryController::add([ - 'tableName' => $aArgs['resTable'], - 'recordId' => (string) $aArgs['resId'], - 'eventType' => 'ADD', - 'info' => 'process fulltext done', - 'moduleId' => 'convert', - 'eventId' => 'fulltext', - ]); - - $queryCpt = DatabaseModel::select([ - 'select' => ["fulltext_attempts"], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - ]); - - $cptFulltext = $queryCpt[0]['fulltext_attempts'] + 1; - - if (!empty($aArgs['zendIndex'])) { - $fResult = 1; - } else { - $fResult = 0; - } - - DatabaseModel::update([ - 'table' => $aArgs['resTable'], - 'set' => [ - 'fulltext_result' => $fResult, - 'is_multi_docservers' => 'Y', - 'fulltext_attempts' => $cptFulltext, - ], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - - return $returnArray; - } catch (Exception $e) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => $e->getMessage(), - ); - - return $returnArray; - } - } - - public static function getById(array $aArgs = []) - { - ValidatorModel::notEmpty($aArgs, ['resId']); - ValidatorModel::intVal($aArgs, ['resId']); - - $aReturn = DatabaseModel::select([ - 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], - 'table' => ['res_letterbox'], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - - if (empty($aReturn[0])) { - return []; - } - - return $aReturn[0]; - } - - /** - * Updating the database with the error code - * @param string $resTable res table - * @param bigint $resId Id of the resource to process - * @param string $result error code - * @return nothing - */ - public static function manageErrorOnDb(array $aArgs = []) - { - $attemptsRecord = DatabaseModel::select([ - 'select' => ['fulltext_attempts'], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - ]); - - if (empty($attemptsRecord)) { - $attempts = 0; - } else { - $attempts = $attemptsRecord[0]['fulltext_attempts'] + 1; - } - - DatabaseModel::update([ - 'table' => $aArgs['resTable'], - 'set' => [ - 'fulltext_result' => $aArgs['result'], - 'fulltext_attempts' => $attempts, - ], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - } -} diff --git a/modules/convert/Models/ProcessThumbnailsModel.php b/modules/convert/Models/ProcessThumbnailsModel.php deleted file mode 100755 index c334b9fbcce..00000000000 --- a/modules/convert/Models/ProcessThumbnailsModel.php +++ /dev/null @@ -1,21 +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 Process Thumbnails Model -* @author dev@maarch.org -* @ingroup convert -*/ - -namespace Convert\Models; - -class ProcessThumbnailsModel extends ProcessThumbnailsModelAbstract -{ - // Do your stuff in this class -} diff --git a/modules/convert/Models/ProcessThumbnailsModelAbstract.php b/modules/convert/Models/ProcessThumbnailsModelAbstract.php deleted file mode 100755 index 63a23ebde95..00000000000 --- a/modules/convert/Models/ProcessThumbnailsModelAbstract.php +++ /dev/null @@ -1,240 +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 ProcessThumbnails Model -* @author dev@maarch.org -* @ingroup convert -*/ - -namespace Convert\Models; - -use History\controllers\HistoryController; -use SrcCore\models\DatabaseModel; -use SrcCore\models\ValidatorModel; - -class ProcessThumbnailsModelAbstract -{ - /** - * Updating the database with the location information of the document on the - * new docserver - * @param string $collId collection - * @param string $resTable res table - * @param string $adrTable adr table - * @param bigint $resId Id of the resource to process - * @param docserver $docserver docserver object - * @param string $path location of the resource on the docserver - * @param string $fileName file name of the resource on the docserver - * @param complex $zendIndex zend index object - * @return array $returnArray the result - */ - public static function updateDatabase(array $aArgs = []) - { - try { - ValidatorModel::notEmpty($aArgs, ['collId']); - ValidatorModel::notEmpty($aArgs, ['resTable']); - ValidatorModel::notEmpty($aArgs, ['adrTable']); - ValidatorModel::intVal($aArgs, ['resId']); - ValidatorModel::notEmpty($aArgs, ['docserver']); - ValidatorModel::notEmpty($aArgs, ['path']); - ValidatorModel::notEmpty($aArgs, ['fileName']); - - $aArgs['docserver']['path_template'] = str_replace( - DIRECTORY_SEPARATOR, - '#', - $aArgs['docserver']['path_template'] - ); - $aArgs['path'] = str_replace( - $aArgs['docserver']['path_template'], - '', - $aArgs['path'] - ); - - DatabaseModel::update([ - 'table' => 'convert_stack', - 'set' => [ - 'status' => 'P' - ], - 'where' => ['coll_id = ?', 'res_id = ?'], - 'data' => [$aArgs['collId'], $aArgs['resId']] - ]); - - $returnAdr = DatabaseModel::select([ - 'select' => ['*'], - 'table' => [$aArgs['adrTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - 'order' => ['adr_priority'], - ]); - - if (empty($returnAdr)) { - $returnRes = DatabaseModel::select([ - 'select' => ['docserver_id, path, filename, offset_doc, fingerprint'], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - $returnRes = $returnRes[0]; - // LogsController::info(['message'=>$returnRes, 'code'=>8, ]); - $resDocserverId = $returnRes['docserver_id']; - $resPath = $returnRes['path']; - $resFilename = $returnRes['filename']; - $resOffsetDoc = $returnRes['offset_doc']; - $fingerprintInit = $returnRes['fingerprint']; - - DatabaseModel::insert([ - 'table' => $aArgs['adrTable'], - 'columnsValues' => [ - 'res_id' => $aArgs['resId'], - 'docserver_id' => $resDocserverId, - 'path' => $resPath, - 'filename' => $resFilename, - 'offset_doc' => $resOffsetDoc, - 'fingerprint' => $fingerprintInit, - 'adr_priority' => 1, - ] - ]); - } - - $returnAdr = DatabaseModel::select([ - 'select' => ['*'], - 'table' => [$aArgs['adrTable']], - 'where' => ['res_id = ?', 'adr_type= ?'], - 'data' => [$aArgs['resId'], 'TNL'], - ]); - - if (empty($returnAdr)) { - DatabaseModel::insert([ - 'table' => $aArgs['adrTable'], - 'columnsValues' => [ - 'res_id' => $aArgs['resId'], - 'docserver_id' => $aArgs['docserver']['docserver_id'], - 'path' => $aArgs['path'], - 'filename' => $aArgs['fileName'], - 'offset_doc' => '', - 'fingerprint' => '', - 'adr_priority' => 1, - 'adr_type' => 'TNL', - ] - ]); - } else { - DatabaseModel::update([ - 'table' => $aArgs['adrTable'], - 'set' => [ - 'docserver_id' => $aArgs['docserver']['docserver_id'], - 'path' => $aArgs['path'], - 'filename' => $aArgs['fileName'], - 'offset_doc' => '', - 'fingerprint' => '', - 'adr_priority' => 1, - ], - 'where' => ['res_id = ?', "adr_type = ?"], - 'data' => [$aArgs['resId'], 'TNL'] - ]); - } - - HistoryController::add([ - 'tableName' => $aArgs['resTable'], - 'recordId' => (string) $aArgs['resId'], - 'eventType' => 'ADD', - 'info' => 'process thumbnails done', - 'moduleId' => 'convert', - 'eventId' => 'thumbnails', - ]); - - $queryCpt = DatabaseModel::select([ - 'select' => ["tnl_attempts"], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - ]); - - $cptThumbnails = $queryCpt[0]['tnl_attempts'] + 1; - - DatabaseModel::update([ - 'table' => $aArgs['resTable'], - 'set' => [ - 'tnl_result' => 1, - 'is_multi_docservers' => 'Y', - 'tnl_attempts' => $cptThumbnails, - ], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - - $returnArray = array( - 'status' => '0', - 'value' => '', - 'error' => '', - ); - - return $returnArray; - } catch (Exception $e) { - $returnArray = array( - 'status' => '1', - 'value' => '', - 'error' => $e->getMessage(), - ); - - return $returnArray; - } - } - - public static function getById(array $aArgs = []) - { - ValidatorModel::notEmpty($aArgs, ['resId']); - ValidatorModel::intVal($aArgs, ['resId']); - - $aReturn = DatabaseModel::select([ - 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], - 'table' => ['res_letterbox'], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - - if (empty($aReturn[0])) { - return []; - } - - return $aReturn[0]; - } - - /** - * Updating the database with the error code - * @param string $resTable res table - * @param bigint $resId Id of the resource to process - * @param string $result error code - * @return nothing - */ - public static function manageErrorOnDb(array $aArgs = []) - { - $attemptsRecord = DatabaseModel::select([ - 'select' => ['tnl_attempts'], - 'table' => [$aArgs['resTable']], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']], - ]); - - if (empty($attemptsRecord)) { - $attempts = 0; - } else { - $attempts = $attemptsRecord[0]['tnl_attempts'] + 1; - } - - DatabaseModel::update([ - 'table' => $aArgs['resTable'], - 'set' => [ - 'tnl_result' => $aArgs['result'], - 'tnl_attempts' => $attempts, - ], - 'where' => ['res_id = ?'], - 'data' => [$aArgs['resId']] - ]); - } -} diff --git a/modules/convert/Test/ProcessConvertTest.php b/modules/convert/Test/ProcessConvertTest.php deleted file mode 100755 index 14537a76d43..00000000000 --- a/modules/convert/Test/ProcessConvertTest.php +++ /dev/null @@ -1,117 +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. -* -*/ - -namespace MaarchTest; -use PHPUnit\Framework\TestCase; - -class ProcessConvertTest extends TestCase -{ - public function testconvert () - { - $action = new \Resource\controllers\ResController(); - - $environment = \Slim\Http\Environment::mock( - [ - 'REQUEST_METHOD' => 'POST', - ] - ); - - $samplePath = 'modules/convert/Test/Samples/'; - - //SAMPLE TXT - $fileSource = 'test.txt'; - $fileFormat = 'txt'; - - $fileContent = file_get_contents($samplePath . $fileSource, FILE_BINARY); - $encodedFile = base64_encode($fileContent); - //echo $encodedFile . PHP_EOL;exit; - - $data = []; - - array_push( - $data, - array( - 'column' => 'subject', - 'value' => 'UNIT TEST CONVERT from slim', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'type_id', - 'value' => 110, - 'type' => 'integer', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t1', - 'value' => 'TEST', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t10', - 'value' => 'lgi@maarch.org', - 'type' => 'string', - ) - ); - - $aArgs = [ - 'encodedFile' => $encodedFile, - 'data' => $data, - 'collId' => 'letterbox_coll', - 'table' => 'res_letterbox', - 'fileFormat' => $fileFormat, - 'status' => 'new', - ]; - - $request = \Slim\Http\Request::createFromEnvironment($environment); - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - - $resId = $responseBody->resId; - - if (!defined("_RES_ID_TEST_CONVERT")) { - define("_RES_ID_TEST_CONVERT", $resId); - } - - //real test - $request = \Slim\Http\Request::createFromEnvironment($environment); - $action = new \Convert\Controllers\ProcessConvertController(); - - $aArgs = [ - 'collId' => 'letterbox_coll', - 'resTable' => 'res_letterbox', - 'adrTable' => 'adr_letterbox', - 'resId' => _RES_ID_TEST_CONVERT, - 'tmpDir' => $_SESSION['config']['tmppath'] - ]; - - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - //var_dump($response); - $responseBody = json_decode((string)$response->getBody()); - $status = $responseBody->status; - - $this->assertEquals('0', $status); - } -} diff --git a/modules/convert/Test/ProcessFulltextTest.php b/modules/convert/Test/ProcessFulltextTest.php deleted file mode 100755 index fa01d225016..00000000000 --- a/modules/convert/Test/ProcessFulltextTest.php +++ /dev/null @@ -1,53 +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. -* -*/ - -namespace MaarchTest; -use PHPUnit\Framework\TestCase; - -class ProcessFulltextTest extends TestCase -{ - - public function testfulltext () - { - - if (!defined("_RES_ID_TEST_CONVERT")) { - define("_RES_ID_TEST_CONVERT", 100); - } - - $action = new \Convert\Controllers\ProcessFulltextController(); - - $environment = \Slim\Http\Environment::mock( - [ - 'REQUEST_METHOD' => 'POST', - ] - ); - - $request = \Slim\Http\Request::createFromEnvironment($environment); - - $aArgs = [ - 'collId' => 'letterbox_coll', - 'resTable' => 'res_letterbox', - 'adrTable' => 'adr_letterbox', - 'resId' => _RES_ID_TEST_CONVERT, - 'tmpDir' => $_SESSION['config']['tmppath'], - 'createZendIndex' => true - ]; - - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - //var_dump($response); - $responseBody = json_decode((string)$response->getBody()); - //var_dump($responseBody); - $status = $responseBody->status; - - $this->assertEquals('0', $status); - } -} diff --git a/modules/convert/Test/ProcessManageConvertTest.php b/modules/convert/Test/ProcessManageConvertTest.php deleted file mode 100755 index 3a61a1a123d..00000000000 --- a/modules/convert/Test/ProcessManageConvertTest.php +++ /dev/null @@ -1,373 +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. -* -*/ - -namespace MaarchTest; -use PHPUnit\Framework\TestCase; - -class ManageProcessConvertTest extends TestCase -{ - public function testmanageConvert () - { - $action = new \Resource\controllers\ResController(); - - $environment = \Slim\Http\Environment::mock( - [ - 'REQUEST_METHOD' => 'POST', - ] - ); - - $samplePath = 'modules/convert/Test/Samples/'; - - //SAMPLE TXT - $fileSource = 'test.txt'; - $fileFormat = 'txt'; - - $fileContent = file_get_contents($samplePath . $fileSource, FILE_BINARY); - $encodedFile = base64_encode($fileContent); - //echo $encodedFile . PHP_EOL;exit; - - $data = []; - - array_push( - $data, - array( - 'column' => 'subject', - 'value' => 'UNIT TEST CONVERT ALL from slim with ' . $fileFormat . ' file', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'type_id', - 'value' => 110, - 'type' => 'integer', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t1', - 'value' => 'TEST', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t10', - 'value' => 'lgi@maarch.org', - 'type' => 'string', - ) - ); - - $aArgs = [ - 'encodedFile' => $encodedFile, - 'data' => $data, - 'collId' => 'letterbox_coll', - 'table' => 'res_letterbox', - 'fileFormat' => $fileFormat, - 'status' => 'new', - ]; - - $request = \Slim\Http\Request::createFromEnvironment($environment); - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - - $resIdTxt = $responseBody->resId; - - //SAMPLE PDF - $fileSource = 'test.pdf'; - $fileFormat = 'pdf'; - - $fileContent = file_get_contents($samplePath . $fileSource, FILE_BINARY); - $encodedFile = base64_encode($fileContent); - //echo $encodedFile . PHP_EOL;exit; - - $data = []; - - array_push( - $data, - array( - 'column' => 'subject', - 'value' => 'UNIT TEST CONVERT ALL from slim with ' . $fileFormat . ' file', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'type_id', - 'value' => 110, - 'type' => 'integer', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t1', - 'value' => 'TEST', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t10', - 'value' => 'lgi@maarch.org', - 'type' => 'string', - ) - ); - - $aArgs = [ - 'encodedFile' => $encodedFile, - 'data' => $data, - 'collId' => 'letterbox_coll', - 'table' => 'res_letterbox', - 'fileFormat' => $fileFormat, - 'status' => 'new', - ]; - - $request = \Slim\Http\Request::createFromEnvironment($environment); - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - - $resIdPdf = $responseBody->resId; - - //SAMPLE ODT - $fileSource = 'test.odt'; - $fileFormat = 'odt'; - - $fileContent = file_get_contents($samplePath . $fileSource, FILE_BINARY); - $encodedFile = base64_encode($fileContent); - //echo $encodedFile . PHP_EOL;exit; - - $data = []; - - array_push( - $data, - array( - 'column' => 'subject', - 'value' => 'UNIT TEST CONVERT ALL from slim with ' . $fileFormat . ' file', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'type_id', - 'value' => 110, - 'type' => 'integer', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t1', - 'value' => 'TEST', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t10', - 'value' => 'lgi@maarch.org', - 'type' => 'string', - ) - ); - - $aArgs = [ - 'encodedFile' => $encodedFile, - 'data' => $data, - 'collId' => 'letterbox_coll', - 'table' => 'res_letterbox', - 'fileFormat' => $fileFormat, - 'status' => 'new', - ]; - - $request = \Slim\Http\Request::createFromEnvironment($environment); - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - - $resIdOdt = $responseBody->resId; - - //SAMPLE HTML - $fileSource = 'test.html'; - $fileFormat = 'html'; - - $fileContent = file_get_contents($samplePath . $fileSource, FILE_BINARY); - $encodedFile = base64_encode($fileContent); - //echo $encodedFile . PHP_EOL;exit; - - $data = []; - - array_push( - $data, - array( - 'column' => 'subject', - 'value' => 'UNIT TEST CONVERT ALL from slim with ' . $fileFormat . ' file', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'type_id', - 'value' => 110, - 'type' => 'integer', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t1', - 'value' => 'TEST', - 'type' => 'string', - ) - ); - - array_push( - $data, - array( - 'column' => 'custom_t10', - 'value' => 'lgi@maarch.org', - 'type' => 'string', - ) - ); - - $aArgs = [ - 'encodedFile' => $encodedFile, - 'data' => $data, - 'collId' => 'letterbox_coll', - 'table' => 'res_letterbox', - 'fileFormat' => $fileFormat, - 'status' => 'new', - ]; - - $request = \Slim\Http\Request::createFromEnvironment($environment); - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - - $resIdHtml = $responseBody->resId; - - /***************************************************************************/ - - //test TXT - $request = \Slim\Http\Request::createFromEnvironment($environment); - $action = new \Convert\Controllers\ProcessManageConvertController(); - - $aArgs = [ - 'collId' => 'letterbox_coll', - 'resTable' => 'res_letterbox', - 'adrTable' => 'adr_letterbox', - 'resId' => $resIdTxt, - 'tmpDir' => $_SESSION['config']['tmppath'], - 'createZendIndex' => true - ]; - - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - $status = $responseBody->status; - - $this->assertEquals('0', $status); - - //test PDF - $request = \Slim\Http\Request::createFromEnvironment($environment); - $action = new \Convert\Controllers\ProcessManageConvertController(); - - $aArgs = [ - 'collId' => 'letterbox_coll', - 'resTable' => 'res_letterbox', - 'adrTable' => 'adr_letterbox', - 'resId' => $resIdPdf, - 'tmpDir' => $_SESSION['config']['tmppath'], - 'createZendIndex' => true - ]; - - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - $status = $responseBody->status; - - $this->assertEquals('0', $status); - - //test ODT - $request = \Slim\Http\Request::createFromEnvironment($environment); - $action = new \Convert\Controllers\ProcessManageConvertController(); - - $aArgs = [ - 'collId' => 'letterbox_coll', - 'resTable' => 'res_letterbox', - 'adrTable' => 'adr_letterbox', - 'resId' => $resIdOdt, - 'tmpDir' => $_SESSION['config']['tmppath'], - 'createZendIndex' => true - ]; - - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - $status = $responseBody->status; - - $this->assertEquals('0', $status); - - //test HTML - $request = \Slim\Http\Request::createFromEnvironment($environment); - $action = new \Convert\Controllers\ProcessManageConvertController(); - - $aArgs = [ - 'collId' => 'letterbox_coll', - 'resTable' => 'res_letterbox', - 'adrTable' => 'adr_letterbox', - 'resId' => $resIdHtml, - 'tmpDir' => $_SESSION['config']['tmppath'], - 'createZendIndex' => true - ]; - - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - $responseBody = json_decode((string)$response->getBody()); - $status = $responseBody->status; - - $this->assertEquals('0', $status); - } -} diff --git a/modules/convert/Test/ProcessThumbnailsTest.php b/modules/convert/Test/ProcessThumbnailsTest.php deleted file mode 100755 index 0007f083f24..00000000000 --- a/modules/convert/Test/ProcessThumbnailsTest.php +++ /dev/null @@ -1,52 +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. -* -*/ - -namespace MaarchTest; -use PHPUnit\Framework\TestCase; - -class ProcessThumbnailsTest extends TestCase -{ - - public function testthumbnails () - { - - if (!defined("_RES_ID_TEST_CONVERT")) { - define("_RES_ID_TEST_CONVERT", 100); - } - - $action = new \Convert\Controllers\ProcessThumbnailsController(); - - $environment = \Slim\Http\Environment::mock( - [ - 'REQUEST_METHOD' => 'POST', - ] - ); - - $request = \Slim\Http\Request::createFromEnvironment($environment); - - $aArgs = [ - 'collId' => 'letterbox_coll', - 'resTable' => 'res_letterbox', - 'adrTable' => 'adr_letterbox', - 'resId' => _RES_ID_TEST_CONVERT, - 'tmpDir' => $_SESSION['config']['tmppath'] - ]; - - $response = new \Slim\Http\Response(); - $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); - - $response = $action->create($fullRequest, $response); - //var_dump($response); - $responseBody = json_decode((string)$response->getBody()); - //var_dump($responseBody); - $status = $responseBody->status; - - $this->assertEquals('0', $status); - } -} diff --git a/modules/convert/Test/Samples/test.html b/modules/convert/Test/Samples/test.html deleted file mode 100755 index 974952b211c..00000000000 --- a/modules/convert/Test/Samples/test.html +++ /dev/null @@ -1,8 +0,0 @@ -<html><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"></head> - <!--<body id="validation_page" - onload="javascript:moveTo(0,0);"> - <div id="template_content" style="width:100%;">--> - <body><p style="text-align: center;" data-mce-style="text-align: center;"><span style="font-size: small; text-decoration: underline;" data-mce-style="font-size: small; text-decoration: underline;">ENREGISTREMENT DEMANDE Allo Mairie - DIVERS</span></p><p style="text-align: center;" data-mce-style="text-align: center;"> </p><table style="border: 1pt solid #000000; width: 800px; background-color: #40a497;" data-mce-style="border: 1pt solid #000000; width: 800px; background-color: #40a497;" cellpadding="5" cellspacing="1" border="1"><tbody><tr><td style="width: 200px;" data-mce-style="width: 200px;">DECLARATION DU BESOIN</td><td>DATE: 17-11-2015</td><td>HEURE: 18:01:46</td></tr></tbody></table><table style="border: 1pt solid #000000; width: 800px;" data-mce-style="border: 1pt solid #000000; width: 800px;" cellpadding="5" cellspacing="1" border="1"><tbody><tr><td style="width: 200px; background-color: #40a497;" data-mce-style="width: 200px; background-color: #40a497;">OBJET</td><td style="background-color: #bef3ec;" data-mce-style="background-color: #bef3ec;"> laurent</td></tr><tr><td style="width: 200px; background-color: #40a497;" data-mce-style="width: 200px; background-color: #40a497;">DATE ET HEURE ESTIMEES DU DECLENCHEMENT</td><td> </td></tr><tr><td style="width: 200px; background-color: #40a497;" data-mce-style="width: 200px; background-color: #40a497;">IMPLANTATION / LOCALISATION</td><td style="background-color: #bef3ec;" data-mce-style="background-color: #bef3ec;"> montest</td></tr><tr><td style="width: 200px; background-color: #40a497;" data-mce-style="width: 200px; background-color: #40a497;">DESCRIPTION</td><td> </td></tr><tr><td style="width: 200px; background-color: #40a497;" data-mce-style="width: 200px; background-color: #40a497;">ETENDUE DU PROBLEME</td><td style="background-color: #bef3ec;" data-mce-style="background-color: #bef3ec;"> </td></tr><tr><td style="width: 200px; background-color: #40a497;" data-mce-style="width: 200px; background-color: #40a497;">NATURE DU DESAGREMENT</td><td> </td></tr><tr><td style="width: 200px; background-color: #40a497;" data-mce-style="width: 200px; background-color: #40a497;">DELAIS DE TRAITEMENT SOUHAITE</td><td style="background-color: #bef3ec;" data-mce-style="background-color: #bef3ec;"> </td></tr><tr><td style="width: 200px; background-color: #40a497;" data-mce-style="width: 200px; background-color: #40a497;">AUTRES OBSERVATIONS</td><td> </td></tr></tbody></table><p><br data-mce-bogus="1"></p> <!--</div> - </body> - </html>--> - </body></html> \ No newline at end of file diff --git a/modules/convert/Test/Samples/test.odt b/modules/convert/Test/Samples/test.odt deleted file mode 100755 index 3038c23914d8df78dbda22d8437ab599bf36509b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8726 zcmch6bzGEN*Y?n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K9ebUkY+x}A{d<9q8R6PGq;iG#Q;t$1X#B(Z>{ z%al)ZD2OQkG{gjwnfQrpG!fV&f642Sv2F5H{yOW*<BG2t;cml%?H4=Z1}iTWv;EVC zg%Gx3QIt{_XOUHU#`f<@1nemN>AfPbjS4sLOdznminBsnqf6<2th?VafFOdLmKYaP z)$?j8_acu`t2B|kt+(Nf12qvkG_?ibAc<h{SR5#XA8q2|uh=m<(`_z;nvU@YX1|p@ zY{-?P%$A=lBU5#cRfx_dqm|XU1WdZ6kW+Q1ogA)!f`Nc>>+<{}@5WM<xEp@mf-7qq zasuefM{ANrGuVQemZS(33W56Jn(94Y;GTHHuT>`}FUTk`8%#pWuOv;Z@j<$WZ`v^Z z?JWTut3<U8ZaaOE%V;8>0*6VN-w#S>IELNxNH_@FylvP`HtpemxNlw4r18R3S7&pt zO+kw``<VJQN)`p%Wn-t@N??WAIo22Rxtyt%j^{0!r)hj(d$vgG2A`i`!7gD4rS zKp_Gv@u|qe!4m-fUXg{x_$T{QpZyi}tMvK<q6lmLoe=vg%MTO)a3@#&Fg;i)<yWQU ze~DLrb>s*5f7IX~{p8<}{SdSMQ<mZ1u>26W{+{Jd-uhvvup#)>vA>F4f6sI$cm1%Z zzhU}W{Q6IM+<(LKvl#Y2JU`ci|5UW@<gg!B_8XqR5y$@NIk;0Ee;69l{|?s=Y3x6B zQS>(~KTBnQb@At7_?=kx!(3oIKS^hQy76ahelDZ_A^rUuS&9ZLo&KwG{wwO|>fv39 z^@o+fuKw>d2P?S#iv0PQ_gCZ|tow7V@mJ)}`S$J@_`}}Z`}t7#EAHn+a+i&N7zgYz a|7~tokw=1^L;(Oi*vk&~h(wa#_5KfIfRL5| diff --git a/modules/convert/Test/Samples/test.pdf b/modules/convert/Test/Samples/test.pdf deleted file mode 100755 index f698ff53d41575b222e6778f87f9e9fd8da4f2b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7945 zcmeHMdpuO@*C+SMluP1J*&zvI@43%7V>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0hCMh<`@cPq_XO z0{@8kXLS8*aG^$uMx;MwV-$&$gkzNIe_yE&_EU!2DFn)3J5g4y{<WEc^M>4ukG4c! z0xw#4Kv()Nxy(u_SKOpj_vc2h$%TKam=x`qeEX)nqMqEf$nk5(uw_)g@jv!<hHb%; z$bV-Ht+57m7SeENS(3FAoxiiz+<R``!ge()#p_3%pU!?V8|Uz8rNX8ym8%}hsj@tm zZ+4loxyBbI^3EwZZb$21u&QO3`lG2$9tAB6j~rV({cy~YgNF%BR~m{&vEF-pZ-Ygp z?X^nvWmV*iyP?G&y8L;^)#;N1>fJ1wJ+)9ZbM}_28qbMpe)cZIYsE~p(<j`v0>O+` zS|{G<>dlI}T5gCm=YoTO<&A-XtOYjo>V52<EB^nt=lWxx75~@nD)}$XRp^K2D$={; uJg_-id&V{+F*a{wVr<&_#8*d6QZK4%1j?EFDoh#!h*8~CES5CfPyHXEPS%zH diff --git a/modules/convert/Test/Samples/test.txt b/modules/convert/Test/Samples/test.txt deleted file mode 100755 index 322dd17d9e0..00000000000 --- a/modules/convert/Test/Samples/test.txt +++ /dev/null @@ -1 +0,0 @@ -a unit test for PHP CONVERSION lorem ipsum... \ No newline at end of file diff --git a/modules/convert/ajax_convert.php b/modules/convert/ajax_convert.php deleted file mode 100755 index c6975a255fb..00000000000 --- a/modules/convert/ajax_convert.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -// sample for attachments in allMode : -// http://urltomaarch/apps/maarch_entreprise/index.php?page=ajax_convert&module=convert&id=1&collId=attachments_coll - -$func = new functions(); - -for ($i=0;$i<count($_SESSION['collections']);$i++) { - if ($_SESSION['collections'][$i]['id'] == $_REQUEST['collId']) { - $resTable = $_SESSION['collections'][$i]['table']; - $adrTable = $_SESSION['collections'][$i]['adr']; - } -} - -// echo $_REQUEST['collId'] . '<br />'; -// echo $resTable . PHP_EOL . '<br />'; -// echo $adrTable . PHP_EOL . '<br />'; -// echo $_REQUEST['id'] . PHP_EOL . '<br />'; - -$params = array( - 'collId' => $_REQUEST['collId'], - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $_REQUEST['id'], - 'tmpDir' => $_SESSION['config']['tmppath'] -); - -require_once 'core/services/ManageDocservers.php'; -$ManageDocservers = new Core_ManageDocservers_Service(); - -require_once 'modules/convert/services/ManageConvert.php'; -$ManageConvertService = new Convert_ManageConvert_Service(); -$resultOfConversion = $ManageConvertService->convertAll($params); - -//var_dump($resultOfConversion); diff --git a/modules/convert/batch/LoggerLog4php.php b/modules/convert/batch/LoggerLog4php.php deleted file mode 100755 index 22eb7fab0ec..00000000000 --- a/modules/convert/batch/LoggerLog4php.php +++ /dev/null @@ -1,321 +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. - * - */ - -/** 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/convert/batch/batch_tools.php b/modules/convert/batch/batch_tools.php deleted file mode 100755 index 8b55200228f..00000000000 --- a/modules/convert/batch/batch_tools.php +++ /dev/null @@ -1,291 +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 API to manage batchs - * - * @file - * @author Laurent Giovannoni - * @date $date$ - * @version $Revision$ - * @ingroup convert - */ - -/** - * 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) { - $GLOBALS['logger']->write('ROLLBACK', 'INFO'); - $dbConn->query('ROLLBACK'); - } - $GLOBALS['logger']->write('SQL query error:' . $queryTxt, 'WARNING'); - } - $GLOBALS['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='', $logLevel='') -{ - if (file_exists($GLOBALS['lckFile'])) { - unlink($GLOBALS['lckFile']); - } - if ($returnCode > 0) { - $GLOBALS['totalProcessedResources']--; - if ($GLOBALS['totalProcessedResources'] == -1) { - $GLOBALS['totalProcessedResources'] = 0; - } - if($returnCode < 100) { - if (file_exists($GLOBALS['errorLckFile'])) { - unlink($GLOBALS['errorLckFile']); - } - $semaphore = fopen($GLOBALS['errorLckFile'], "a"); - fwrite($semaphore, '1'); - fclose($semaphore); - } - if($logLevel == 'WARNING'){ - $GLOBALS['logger']->write($message, 'WARNING', $returnCode); - } else { - $GLOBALS['logger']->write($message, 'ERROR', $returnCode); - } - Bt_logInDataBase($GLOBALS['totalProcessedResources'], 1, 'return code:' - . $returnCode . ', ' . $message); - } elseif ($message <> '') { - $GLOBALS['logger']->write($message, 'INFO', $returnCode); - Bt_logInDataBase($GLOBALS['totalProcessedResources'], 0, 'return code:' - . $returnCode . ', ' . $message); - } - - $query = "delete from convert_stack " - . " where coll_id = ? "; - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query, - array( - $GLOBALS['collection'] - ) - ); - - 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(?, ?, " - . $GLOBALS['db']->current_datetime() . ", ?, ?, ?)"; - $stmt = $GLOBALS['dbLog']->query( - $query, - array( - $GLOBALS['batchName'], - $GLOBALS['wb'], - $totalProcessed, - $totalErrors, - substr(str_replace('\\', '\\\\', str_replace("'", "`", $info)), 0, 999) - ) - ); -} - -/** - * Get the batch if of the batch - * - * @return nothing - */ -function Bt_getWorkBatch() -{ - $req = "select param_value_int from parameters where id = ?"; - $stmt = $GLOBALS['db']->query($req, array($GLOBALS['batchName'] . "_id")); - while ($reqResult = $stmt->fetchObject()) { - $GLOBALS['wbCompute'] = $reqResult->param_value_int + 1; - } - if ($GLOBALS['wbCompute'] == '') { - $req = "insert into parameters(id, param_value_int) values " - . "(?, 1)"; - $stmt = $GLOBALS['db']->query($req, array($GLOBALS['batchName'] . "_id")); - $GLOBALS['wbCompute'] = 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 = ?"; - $stmt = $GLOBALS['db']->query($req, array($GLOBALS['wbCompute'], $GLOBALS['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); - } -} - -/** - * Get the current date to process - * - * @return nothing - */ -function Bt_getCurrentDateToProcess() -{ - $req = "select param_value_date from parameters where id = ?"; - $stmt = $GLOBALS['db']->query( - $req, - array( - $GLOBALS['batchName'] . "_" . $GLOBALS['collection'] . "_current_date" - ) - ); - $reqResult = $stmt->fetchObject(); - if ($reqResult->param_value_date == '') { - $req = "insert into parameters(id, param_value_date) values (?, ?)"; - $stmt = $GLOBALS['db']->query( - $req, - array( - $GLOBALS['batchName'] . "_" . $GLOBALS['collection'] . "_current_date", - $GLOBALS['startDateRecovery'] - ) - ); - $GLOBALS['currentDate'] = $GLOBALS['startDateRecovery']; - } else { - $resultDate = formatDateFromDb($reqResult->param_value_date); - if ( - $GLOBALS['func']->compare_date( - $GLOBALS['startDateRecovery'], - $resultDate - ) == 'date1' - ) { - $GLOBALS['currentDate'] = $GLOBALS['startDateRecovery']; - } else { - $GLOBALS['currentDate'] = $resultDate; - } - } -} - -/** - * Update the database with the current date to process - * - * @return nothing - */ -function Bt_updateCurrentDateToProcess() -{ - $req = "update parameters set param_value_date = ? where id = ?"; - $stmt = $GLOBALS['db']->query( - $req, - array( - $GLOBALS['currentDate'], - $GLOBALS['batchName'] . "_" . $GLOBALS['collection'] . "_current_date" - ) - ); -} - -/** - * Compute the end current date to process - * - * @return nothing - */ -function Bt_getEndCurrentDateToProcess() -{ - $dateArray = array(); - $tabDate = explode('/' , $GLOBALS['currentDate']); - $theDate = $tabDate[2] . '-' . $tabDate[1] . '-' . $tabDate[0]; - $dateArray = date_parse($theDate); - $GLOBALS['endCurrentDate'] = strftime( - "%d/%m/%Y", mktime(0, 0, 0, $dateArray['month'] +1 , 0, $dateArray['year']) - ); -} - -/** - * Compute the next month currentDate - * - * @return nothing - */ -function Bt_computeNextMonthCurrentDate() -{ - $tabDate = array(); - $tabDate = explode('/' , $GLOBALS['currentDate']); - $theDate = $tabDate[2] . '-' . $tabDate[1] . '-' . $tabDate[0]; - $GLOBALS['currentDate'] = date("d/m/Y", strtotime('+1 month', strtotime($theDate))); - Bt_getEndCurrentDateToProcess(); -} - -/** - * Compute the creation date clause - * - * @return nothing - */ -function Bt_computeCreationDateClause() -{ - $GLOBALS['creationDateClause'] = ''; - if ($GLOBALS['currentDate'] <> '') { - $GLOBALS['creationDateClause'] = " and (creation_date >= '" . $GLOBALS['currentDate'] . "'"; - if ($GLOBALS['endCurrentDate'] <> '') { - $GLOBALS['creationDateClause'] .= " and creation_date <= '" . $GLOBALS['endCurrentDate'] . "'"; - } - $GLOBALS['creationDateClause'] .= ")"; - } -} - -/** -* Formats a datetime to a dd/mm/yyyy format (date) -* -* @param $date datetime The date to format -* @return datetime The formated date -*/ -function formatDateFromDb($date) -{ - $lastDate = ''; - if ($date <> "") { - if (strpos($date," ")) { - $date_ex = explode(" ",$date); - $theDate = explode("-",$date_ex[0]); - $lastDate = $theDate[0] . "/" . $theDate[1] . "/" . $theDate[2]; - } else { - $theDate = explode("-",$date); - $lastDate = $theDate[0] . "/" . $theDate[1] . "/" . $theDate[2]; - } - } - return $lastDate; -} diff --git a/modules/convert/batch/config/config.xml b/modules/convert/batch/config/config.xml deleted file mode 100755 index c3ee180b529..00000000000 --- a/modules/convert/batch/config/config.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>DEBUG</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>DEBUG</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>1000</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>false</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONFIG_BASE> - <databaseserver>127.0.0.1</databaseserver> - <databaseserverport>5432</databaseserverport> - <databasetype>POSTGRESQL</databasetype> - <databasename>MaarchCourrierTest</databasename> - <databaseuser>maarch</databaseuser> - <databasepassword>maarch</databasepassword> - </CONFIG_BASE> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> \ No newline at end of file diff --git a/modules/convert/batch/config/config.xml.default b/modules/convert/batch/config/config.xml.default deleted file mode 100755 index 7094b227dff..00000000000 --- a/modules/convert/batch/config/config.xml.default +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>INFO</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>INFO</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>50</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>false</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <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> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> \ No newline at end of file diff --git a/modules/convert/batch/config/config_only_convert.xml.default b/modules/convert/batch/config/config_only_convert.xml.default deleted file mode 100755 index 55549d7aa49..00000000000 --- a/modules/convert/batch/config/config_only_convert.xml.default +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>INFO</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>INFO</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>1000</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>false</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - <OnlyIndexes>false</OnlyIndexes> - <ProcessIndexesSize>50</ProcessIndexesSize> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <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> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> \ No newline at end of file diff --git a/modules/convert/batch/config/config_only_indexes.xml.default b/modules/convert/batch/config/config_only_indexes.xml.default deleted file mode 100755 index 71c692441f1..00000000000 --- a/modules/convert/batch/config/config_only_indexes.xml.default +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>INFO</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>INFO</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>1000</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>false</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - <OnlyIndexes>true</OnlyIndexes> - <ProcessIndexesSize>50</ProcessIndexesSize> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <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> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> diff --git a/modules/convert/batch/config/parallel/config_0.xml.default b/modules/convert/batch/config/parallel/config_0.xml.default deleted file mode 100755 index 28a7ec2312c..00000000000 --- a/modules/convert/batch/config/parallel/config_0.xml.default +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>INFO</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>INFO</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>50</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>(0|1)$</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <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> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> \ No newline at end of file diff --git a/modules/convert/batch/config/parallel/config_1.xml.default b/modules/convert/batch/config/parallel/config_1.xml.default deleted file mode 100755 index 123ed3ac145..00000000000 --- a/modules/convert/batch/config/parallel/config_1.xml.default +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>INFO</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>INFO</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>50</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>(2|3)$</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <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> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> \ No newline at end of file diff --git a/modules/convert/batch/config/parallel/config_2.xml.default b/modules/convert/batch/config/parallel/config_2.xml.default deleted file mode 100755 index b30e3ba84c8..00000000000 --- a/modules/convert/batch/config/parallel/config_2.xml.default +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>INFO</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>INFO</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>50</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>(4|5)$</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <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> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> \ No newline at end of file diff --git a/modules/convert/batch/config/parallel/config_3.xml.default b/modules/convert/batch/config/parallel/config_3.xml.default deleted file mode 100755 index aa851ceddb4..00000000000 --- a/modules/convert/batch/config/parallel/config_3.xml.default +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>INFO</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>INFO</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>50</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>(6|7)$</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <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> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> \ No newline at end of file diff --git a/modules/convert/batch/config/parallel/config_4.xml.default b/modules/convert/batch/config/parallel/config_4.xml.default deleted file mode 100755 index 46d9f6993e0..00000000000 --- a/modules/convert/batch/config/parallel/config_4.xml.default +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <CONFIG> - <Lang>fr</Lang> <!-- fr, en--> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> - <TmpDirectory>/var/www/html/MaarchCourrier/modules/convert/batch/tmp/</TmpDirectory> - <LogLevel>INFO</LogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <DisplayedLogLevel>INFO</DisplayedLogLevel> <!-- DEBUG, INFO, NOTICE, WARNING, ERROR--> - <StackSizeLimit>50</StackSizeLimit> - <ApacheUserAndGroup>lgi:lgi</ApacheUserAndGroup> - <UnoconvPath>unoconv</UnoconvPath> <!-- only for Windows --> - <OpenOfficePath>soffice</OpenOfficePath> <!-- only for Windows --> - <UnoconvOptions>--port 8100</UnoconvOptions> - <RegExResId>(8|9)$</RegExResId> - <StartDateRecovery>false</StartDateRecovery> <!-- false or date dd/mm/yyyy --> - <CurrentMonthOnly>false</CurrentMonthOnly> <!-- true or false --> - </CONFIG> - <CONVERT> - <OutputFormat>pdf</OutputFormat> - <InputFormat>odt,ott,odm,html,oth,ods,ots,odg,otg,odp,otp,odf,doc,docx,xls,xlsx,ppt,pptx,tiff,tif,png,jpeg,jpg,gif</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>html</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <CONVERT> - <OutputFormat>png</OutputFormat> - <InputFormat>odt,ods,doc,docx,xls,xlsx,ppt,pptx</InputFormat> - </CONVERT> - <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> - <COLLECTION> - <Id>letterbox_coll</Id> - <Table>res_letterbox</Table> - <View>res_view_letterbox</View> - <Adr>adr_letterbox</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/letterbox_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>attachments_coll</Id> - <Table>res_attachments</Table> - <View>res_view_attachments</View> - <Adr>adr_attachments</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/attachments_coll/</path_to_lucene_index> - </COLLECTION> - <COLLECTION> - <Id>version_attachments_coll</Id> - <Table>res_version_attachments</Table> - <View>res_version_attachments</View> - <Adr>adr_attachments_version</Adr> - <path_to_lucene_index>/opt/maarch/docservers/indexes/version_attachments_coll/</path_to_lucene_index> - </COLLECTION> - <LOG4PHP> - <enabled>true</enabled> - <Log4PhpLogger>loggerTechnique</Log4PhpLogger> - <Log4PhpBusinessCode>Convert</Log4PhpBusinessCode> - <Log4PhpConfigPath>/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath> - </LOG4PHP> -</ROOT> \ No newline at end of file diff --git a/modules/convert/batch/fill_stack.php b/modules/convert/batch/fill_stack.php deleted file mode 100755 index 98c8930e405..00000000000 --- a/modules/convert/batch/fill_stack.php +++ /dev/null @@ -1,247 +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 Batch to convert - * - * @file - * @author Laurent Giovannoni <dev@maarch.org> - * @date $date$ - * @version $Revision$ - * @ingroup convert - */ - -/** - * ***** LIGHT PROBLEMS without an error semaphore - * 101 : Configuration file missing - * 102 : Configuration file does not exist - * 103 : Error on loading config file - * 104 : SQL Query Error - * 105 : a parameter is missin - * 106 : Maarch_CLITools is missing - * 107 : Stack full for the policy and the cycle requested - * 108 : Problem with the php include path - * 109 : An instance of the batch for the required policy and cyle is already - * in progress - * 110 : Problem with collection parameter - * 111 : No resource found - * **** HEAVY PROBLEMS with an error semaphore - * 11 : Cycle not found - * 12 : Previous cycle not found - * 13 : Error persists - * 14 : Cycle step not found - */ - -date_default_timezone_set('Europe/Paris'); -// load the config and prepare to process -include('load_fill_stack.php'); - -//TODO ONLY FOR DEBUG -// $query = "truncate table convert_stack"; -// $stmt = Bt_doQuery( -// $GLOBALS['db'], -// $query -// ); -// $query = "truncate table adr_letterbox"; -// $stmt = Bt_doQuery( -// $GLOBALS['db'], -// $query -// ); -// $query = "update res_letterbox set convert_result = 0"; -// $stmt = Bt_doQuery( -// $GLOBALS['db'], -// $query -// ); - -/******************************************************************************/ -/* beginning */ -$state = 'CONTROL_STACK'; -while ($state <> 'END') { - if (isset($GLOBALS['logger'])) { - $GLOBALS['logger']->write('STATE:' . $state, 'INFO'); - } - switch ($state) { - /**********************************************************************/ - /* CONTROL_STACK */ - /* Checking if the stack is full */ - /**********************************************************************/ - case 'CONTROL_STACK' : - //ONLY FOR TEST - $query = "truncate table convert_stack"; - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query - ); - - $query = "select count(1) as cpt from convert_stack " - . " where coll_id = ? and regex = ?"; - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query, - array($GLOBALS['collection'], $GLOBALS['regExResId']) - ); - $resultCpt = $stmt->fetchObject(); - if ($resultCpt->cpt > 0) { - Bt_exitBatch(107, 'stack is full for collection:' - . $GLOBALS['collection'] . ', regex:' - . $GLOBALS['regExResId'] - , 'WARNING'); - break; - } - $state = 'SELECT_RES'; - break; - /**********************************************************************/ - /* SELECT_RES */ - /* Selects candidates */ - /**********************************************************************/ - case 'SELECT_RES' : - $orderBy = ' order by res_id '; - if ($GLOBALS['stackSizeLimit'] <> '') { - $limit = ' LIMIT ' . $GLOBALS['stackSizeLimit']; - } - - if ($GLOBALS['OnlyIndexes']) { - $where_clause = " convert_result = '1' and ( (fulltext_result = '0' or fulltext_result = '' " - . "or fulltext_result is null) or (fulltext_result= '-1' and (convert_attempts < 3))) "; - $where_clause .= $GLOBALS['creationDateClause'] - . $GLOBALS['whereRegex']; - } else { - $where_clause = " (convert_result = '0' or convert_result = '' " - . "or convert_result is null) or (convert_result= '-1' and (convert_attempts < 3)) " - . $GLOBALS['creationDateClause'] - . $GLOBALS['whereRegex']; - } - - $query = $GLOBALS['db']->limit_select( - 0, - $GLOBALS['stackSizeLimit'], - 'res_id', - $GLOBALS['table'], - $where_clause, - $orderBy - ); - $stmt = Bt_doQuery($GLOBALS['db'], $query); - $resourcesArray = array(); - - while ($resoucesRecordset = $stmt->fetchObject()) { - array_push( - $resourcesArray, - array('res_id' => $resoucesRecordset->res_id) - ); - } - - if (count($resourcesArray) == 0) { - if ($GLOBALS['creationDateClause'] <> '') { - $GLOBALS['logger']->write('No resource found for collection', 'INFO'); - // test if we have to change the current date - if ($GLOBALS['currentMonthOnly'] == 'false') { - if ($GLOBALS['OnlyIndexes']) { - $queryTestDate = " convert_result = '1' and ( (fulltext_result = '0' or fulltext_result = '' " - . "or fulltext_result is null) or (fulltext_result= '-1' and (fulltext_attempts < 3))) "; - $queryTestDate .= $GLOBALS['creationDateClause']; - } else { - $queryTestDate = " select count(res_id) as totalres from " - . $GLOBALS['table'] . " (convert_result = '0' or convert_result = '' " - . "or convert_result is null) or (convert_result= '-1' and (convert_attempts < 3)) " - . $GLOBALS['creationDateClause']; - } - $stmt = Bt_doQuery( - $GLOBALS['db'], - $queryTestDate - ); - $resultTotal = $stmt->fetchObject(); - if ($resultTotal->totalres == 0) { - Bt_computeNextMonthCurrentDate(); - Bt_computeCreationDateClause(); - Bt_updateCurrentDateToProcess(); - if ($GLOBALS['OnlyIndexes']) { - $where_clause = " convert_result = '1' and ( (fulltext_result = '0' or fulltext_result = '' " - . "or fulltext_result is null) or (fulltext_result= '-1' and (fulltext_attempts < 3))) "; - $where_clause .= $GLOBALS['creationDateClause'] - . $GLOBALS['whereRegex']; - } else { - $where_clause = " (convert_result = '0' or convert_result = '' " - . "or convert_result is null) or (convert_result= '-1' and (convert_attempts < 3)) " - . $GLOBALS['creationDateClause'] - . $GLOBALS['whereRegex']; - } - - $query = $GLOBALS['db']->limit_select( - 0, - $GLOBALS['stackSizeLimit'], - 'res_id', - $GLOBALS['table'], - $where_clause, - $orderBy - ); - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query - ); - $resourcesArray = array(); - while ($resoucesRecordset = $stmt->fetchObject()) { - array_push( - $resourcesArray, - array('res_id' => $resoucesRecordset->res_id) - ); - } - if (count($resourcesArray) == 0) { - $GLOBALS['logger']->write('No resource found for collection', 'INFO'); - } - } - } - } else { - $GLOBALS['logger']->write('No resource found for collection', 'INFO'); - } - } - $state = 'FILL_STACK'; - break; - /**********************************************************************/ - /* FILL_STACK */ - /* Fill the stack of candidates */ - /**********************************************************************/ - case 'FILL_STACK' : - for ($cptRes = 0;$cptRes < count($resourcesArray);$cptRes++) { - $query = "insert into convert_stack" - . " (coll_id, res_id, status, work_batch, regex) " - . "values (?, ?, 'I', ?, ?)"; - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query, - array( - $GLOBALS['collection'], - $resourcesArray[$cptRes]["res_id"], - $GLOBALS['wb'], - $GLOBALS['regExResId'] - ) - ); - //history - $query = "insert into " . HISTORY_TABLE - . " (table_name, record_id, event_type, user_id, " - . "event_date, info, id_module) values (?, ?, 'ADD', 'CONVERT_BOT', " - . $GLOBALS['db']->current_datetime() - . ", ?, 'convert')"; - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query, - array( - $GLOBALS['table'], - $resourcesArray[$cptRes]["res_id"], - "convert fill stack for collection:" . $GLOBALS['collection'] - ) - ); - $GLOBALS['totalProcessedResources']++; - } - $state = 'END'; - break; - } -} -$GLOBALS['logger']->write('End of process fill stack', 'INFO'); -include('process_stack.php'); -exit($GLOBALS['exitCode']); diff --git a/modules/convert/batch/load_fill_stack.php b/modules/convert/batch/load_fill_stack.php deleted file mode 100755 index 3721e3515a0..00000000000 --- a/modules/convert/batch/load_fill_stack.php +++ /dev/null @@ -1,383 +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 Library to convert - * - * @file - * @author Laurent Giovannoni <dev@maarch.org> - * @date $date$ - * @version $Revision$ - * @ingroup convert - */ - -/** -* @brief Class to include the file error -* -* @ingroup convert -*/ -class IncludeFileError extends Exception -{ - public function __construct($file) - { - $this->file = $file; - parent :: __construct('Include File \'$file\' is missing!', 1); - } -} - -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); -} -include('batch_tools.php'); -// Globals variables definition -$state = ''; -$configFile = ''; -$MaarchDirectory = ''; -$batchDirectory = ''; -$batchName = 'convert'; -$TmpDirectory = ''; -$table = ''; -$adrTable = ''; -$view = ''; -$coll = ''; -$creationDateClause = ''; -$currentStep = ''; -$docservers = Array(); -$docserverSourcePath = ''; -$docserverSourceFingerprint = ''; -$databasetype = ''; -$exitCode = 0; -$running_date = date('Y-m-d H:i:s'); -$func = ''; -$db = ''; -$db2 = ''; -$db3 = ''; -$docserverControler = ''; -$wb = ''; -$wbCompute = ''; -$stackSizeLimit = ''; -$docserversFeatures = array(); -$lckFile = ''; -$errorLckFile = ''; -$totalProcessedResources = 0; -$apacheUserAndGroup = ''; -$regExResId = 'false'; -$startDateRecovery = 'false'; -$currentDate = 'false'; -$endCurrentDate = 'false'; -$currentMonthOnly = 'false'; -$OnlyIndexes = 'false'; -$ProcessIndexesSize = 1000; -$whereRegex = ''; -$log4PhpEnabled = false; - -// Defines scripts arguments -$argsparser = new ArgsParser(); -// The config file -$argsparser->add_arg( - 'config', - array( - 'short' => 'c', - 'long' => 'config', - 'mandatory' => true, - 'help' => 'Config file path is mandatory.', - ) -); -// The res collection target -$argsparser->add_arg( - 'collection', - array( - 'short' => 'coll', - 'long' => 'collection', - 'mandatory' => true, - 'help' => 'Collection target is mandatory.', - ) -); -// The path of the log directory -$argsparser->add_arg( - 'logs', - array( - 'short' => 'logs', - 'long' => 'logs', - 'mandatory' => false, - 'help' => '', - ) -); -// Parsing script options -try { - $options = $argsparser->parse_args($GLOBALS['argv']); - // If option = help then options = false and the script continues ... - if ($options == false) { - exit(0); - } -} catch (MissingArgumentError $e) { - if ($e->arg_name == 'config') { - $GLOBALS['logger']->write('Configuration file missing', 'ERROR', 101); - exit(101); - } - if ($e->arg_name == 'collection') { - $GLOBALS['logger']->write('Collection missing', 'ERROR', 1); - exit(105); - } -} -// Log management -$GLOBALS['logger'] = new Logger4Php(); -$GLOBALS['logger']->set_threshold_level('DEBUG'); -$console = new ConsoleHandler(); -$GLOBALS['logger']->add_handler($console); -if (!empty($options['logs'])) { - $logFile = $options['logs'] . '/' . date('Y-m-d_H-i-s') . '.log'; -} else { - $logFile = 'logs' . '/' . date('Y-m-d_H-i-s') . '.log'; -} -$file = new FileHandler($logFile); -$GLOBALS['logger']->add_handler($file); -$GLOBALS['logger']->write('STATE:INIT', 'INFO'); -$txt = ''; -foreach (array_keys($options) as $key) { - if (isset($options[$key]) && $options[$key] == false) { - $txt .= $key . '=false,'; - } else { - $txt .= $key . '=' . $options[$key] . ','; - } -} -$GLOBALS['logger']->write($txt, 'DEBUG'); -$GLOBALS['configFile'] = $options['config']; -$GLOBALS['collection'] = $options['collection']; -$GLOBALS['logger']->write($txt, 'INFO'); -// Tests existence of config file -if (!file_exists($GLOBALS['configFile'])) { - $GLOBALS['logger']->write('Configuration file ' . $GLOBALS['configFile'] - . ' does not exist', 'ERROR', 102); - exit(102); -} -// Loading config file -$GLOBALS['logger']->write('Load xml config file:' . $GLOBALS['configFile'], - 'INFO'); -$xmlconfig = simplexml_load_file($GLOBALS['configFile']); -if ($xmlconfig == FALSE) { - $GLOBALS['logger']->write('Error on loading config file:' - . $GLOBALS['configFile'], 'ERROR', 103); - exit(103); -} -// Load the config vars -$CONFIG = $xmlconfig->CONFIG; -$lang = (string) $CONFIG->Lang; -$GLOBALS['MaarchDirectory'] = (string) $CONFIG->MaarchDirectory; -$GLOBALS['batchDirectory'] = $GLOBALS['MaarchDirectory'] . 'modules/convert/batch'; -$GLOBALS['tmpDirectoryRoot'] = (string) $CONFIG->TmpDirectory; -$MaarchApps = (string) $CONFIG->MaarchApps; -$logLevel = (string) $CONFIG->LogLevel; -$GLOBALS['logger']->set_threshold_level($logLevel); -$DisplayedLogLevel = (string) $CONFIG->DisplayedLogLevel; -$GLOBALS['apacheUserAndGroup'] = (string) $CONFIG->ApacheUserAndGroup; -$GLOBALS['stackSizeLimit'] = (string) $CONFIG->StackSizeLimit; -$GLOBALS['databasetype'] = (string) $xmlconfig->CONFIG_BASE->databasetype; -$GLOBALS['unoconvPath'] = (string) $CONFIG->UnoconvPath; -$GLOBALS['openOfficePath'] = (string) $CONFIG->OpenOfficePath; -$GLOBALS['unoconvOptions'] = (string) $CONFIG->UnoconvOptions; - -$GLOBALS['regExResId'] = (string) $CONFIG->RegExResId; -$GLOBALS['startDateRecovery'] = (string) $CONFIG->StartDateRecovery; -$GLOBALS['currentMonthOnly'] = (string) $CONFIG->CurrentMonthOnly; -$GLOBALS['OnlyIndexes'] = (string) $CONFIG->OnlyIndexes; - -if ($GLOBALS['OnlyIndexes'] == 'true') { - $GLOBALS['OnlyIndexes'] = true; -} else { - $GLOBALS['OnlyIndexes'] = false; -} - -$GLOBALS['ProcessIndexesSize'] = (string) $CONFIG->ProcessIndexesSize; - -if ($GLOBALS['regExResId'] <> 'false') { - if ($GLOBALS['databasetype'] == 'POSTGRESQL') { - $GLOBALS['whereRegex'] = " and cast(res_id as character varying(255)) ~ '" - . $GLOBALS['regExResId'] . "' "; - } elseif ($GLOBALS['databasetype'] == 'ORACLE') { - $GLOBALS['whereRegex'] = " and REGEXP_LIKE (to_char(res_id), '" - . $GLOBALS['regExResId'] . "') "; - } -} - -$arrayOfInputs = array(); -$GLOBALS['convertFormats'] = array(); -$i = 0; -foreach ($xmlconfig->CONVERT as $convert) { - $outputFormat = (string) $convert->OutputFormat; - $arrayOfInputs = explode(',', (string) $convert->InputFormat); - $cptInputs = count($arrayOfInputs); - for ($j=0;$j<$cptInputs;$j++) { - if (!empty($GLOBALS['convertFormats'][$arrayOfInputs[$j]])) { - $GLOBALS['convertFormats'][$arrayOfInputs[$j]] .= "_" . $outputFormat; - } else { - $GLOBALS['convertFormats'][$arrayOfInputs[$j]] .= $outputFormat; - } - } - $i++; -} - -//var_dump($GLOBALS['convertFormats']); - -$i = 0; -foreach ($xmlconfig->COLLECTION as $col) { - $GLOBALS['collections'][$i] = array ( - 'id' => (string) $col->Id, - 'table' => (string) $col->Table, - 'view' => (string) $col->View, - 'adr' => (string) $col->Adr, - 'path_to_lucene' => (string) $col->path_to_lucene_index - ); - if ($GLOBALS['collections'][$i]['id'] == $GLOBALS['collection']) { - $GLOBALS['table'] = $GLOBALS['collections'][$i]['table']; - $GLOBALS['adrTable'] = $GLOBALS['collections'][$i]['adr']; - $GLOBALS['view'] = $GLOBALS['collections'][$i]['view']; - $GLOBALS['path_to_lucene'] = $GLOBALS['collections'][$i]['path_to_lucene']; - } - $i++; -} - -set_include_path(get_include_path() . PATH_SEPARATOR - . $GLOBALS['MaarchDirectory']); -//log4php params -$log4phpParams = $xmlconfig->LOG4PHP; -if ((string) $log4phpParams->enabled == 'true') { - $GLOBALS['logger']->set_log4PhpLibrary( - $GLOBALS['MaarchDirectory'] - . 'apps/maarch_entreprise/tools/log4php/Logger.php' - ); - $GLOBALS['logger']->set_log4PhpLogger((string) $log4phpParams->Log4PhpLogger); - $GLOBALS['logger']->set_log4PhpBusinessCode((string) $log4phpParams->Log4PhpBusinessCode); - $GLOBALS['logger']->set_log4PhpConfigPath((string) $log4phpParams->Log4PhpConfigPath); - $GLOBALS['logger']->set_log4PhpBatchName('convert'); -} - -if ($GLOBALS['table'] == '' - || $GLOBALS['adrTable'] == '' - || $GLOBALS['view'] == '' -) { - $GLOBALS['logger']->write('Collection:' . $GLOBALS['collection'].' unknow' - , 'ERROR', 110); - exit(110); -} -if (file_exists($GLOBALS['MaarchDirectory'] . 'modules/convert/lang/' . $lang . '.php') -) { - include($GLOBALS['MaarchDirectory'] . 'modules/convert/lang/' . $lang . '.php'); -} -/*if ($logLevel == 'DEBUG') { - error_reporting(E_ALL); -}*/ -$GLOBALS['logger']->change_handler_log_level($file, $logLevel); -$GLOBALS['logger']->change_handler_log_level($console, $DisplayedLogLevel); -unset($xmlconfig); - -// Include library -try { - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'vendor/autoload.php'); - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'core/class/class_functions.php'); - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'core/class/class_db.php'); - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'core/class/class_db_pdo.php'); - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'core/class/class_core_tools.php'); - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'core/core_tables.php'); - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'core/class/docservers_controler.php'); - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'core/docservers_tools.php'); - Bt_myInclude($GLOBALS['MaarchDirectory'] . 'core/class/docserver_types_controler.php'); - //Bt_myInclude($GLOBALS['MaarchDirectory'] . 'modules/convert/services/ManageConvert.php'); -} catch (IncludeFileError $e) { - $GLOBALS['logger']->write( - 'Problem with the php include path:' - . get_include_path(), 'ERROR', 111 - ); - exit(111); -} -if (!is_dir($GLOBALS['tmpDirectoryRoot'])) { - mkdir($GLOBALS['tmpDirectoryRoot']); - // echo PHP_EOL.'tmpDirectoryRoot '.$GLOBALS['tmpDirectoryRoot'].PHP_EOL; - // $GLOBALS['logger']->write( - // 'Problem with the tmp dir:' . $GLOBALS['tmpDirectoryRoot'], 'ERROR', 17 - // ); - // exit(17); -} - -$coreTools = new core_tools(); -$coreTools->load_lang($lang, $GLOBALS['MaarchDirectory'], $MaarchApps); -session_start(); -$_SESSION['modules_loaded'] = array(); -$_SESSION['user']['UserId'] = 'BOT_CONVERT'; -$GLOBALS['func'] = new functions(); -$GLOBALS['db'] = new Database($GLOBALS['configFile']); -$GLOBALS['db2'] = new Database($GLOBALS['configFile']); -$GLOBALS['db3'] = new Database($GLOBALS['configFile']); -$GLOBALS['dbLog'] = new Database($GLOBALS['configFile']); -$GLOBALS['docserverControler'] = new docservers_controler(); -$GLOBALS['processConvert'] = new \Convert\Controllers\ProcessManageConvertController($GLOBALS['openOfficePath']); -$GLOBALS['processIndexes'] = new \Convert\Controllers\ProcessFulltextController(); - -$configFileName = basename($GLOBALS['configFile'], '.xml'); -$GLOBALS['errorLckFile'] = $GLOBALS['batchDirectory'] . '/' - . $GLOBALS['batchName'] . '_' . $GLOBALS['collection'] - . '_' . $configFileName - . '_error.lck'; -$GLOBALS['lckFile'] = $GLOBALS['batchDirectory'] . '/' - . $GLOBALS['batchName'] . '_' . $GLOBALS['collection'] - . '_' . $configFileName - . '.lck'; -if (file_exists($GLOBALS['errorLckFile'])) { - $GLOBALS['logger']->write( - 'Error persists, please solve this before launching a new batch', - 'ERROR', 29 - ); - exit(29); -} -if (file_exists($GLOBALS['lckFile'])) { - $GLOBALS['logger']->write( - 'An instance of the batch :' . $GLOBALS['batchName'] . '_' - . $GLOBALS['collection'] . '_' . $configFileName - . ' is already in progress', - 'ERROR', 109 - ); - exit(109); -} - -if ($GLOBALS['currentMonthOnly'] == 'true') { - $GLOBALS['currentDate'] = date( - "d/m/Y", - mktime(0, 0, 0, date("m"), 1, date("Y")) - ); - Bt_getEndCurrentDateToProcess(); - Bt_computeCreationDateClause(); - $GLOBALS['logger']->write('current begin date to process : ' - . $GLOBALS['currentDate'], 'INFO'); -} elseif ($GLOBALS['startDateRecovery'] <> 'false') { - Bt_getCurrentDateToProcess(); - Bt_updateCurrentDateToProcess(); - Bt_getEndCurrentDateToProcess(); - Bt_computeCreationDateClause(); - $GLOBALS['logger']->write('current begin date to process : ' - . $GLOBALS['currentDate'], 'INFO'); -} - -$semaphore = fopen($GLOBALS['lckFile'], 'a'); -fwrite($semaphore, '1'); -fclose($semaphore); -Bt_getWorkBatch(); -$GLOBALS['wb'] = rand() . $GLOBALS['wbCompute']; -Bt_updateWorkBatch(); -$GLOBALS['logger']->write('Batch number:' . $GLOBALS['wb'], 'INFO'); -$GLOBALS['tmpDirectory'] = $GLOBALS['tmpDirectoryRoot'] . '/' - . $GLOBALS['wb'] . '/'; -if (!is_dir($GLOBALS['tmpDirectory'])) { - mkdir($GLOBALS['tmpDirectory'], 0777); -} diff --git a/modules/convert/batch/process_stack.php b/modules/convert/batch/process_stack.php deleted file mode 100755 index c5d46ecbf45..00000000000 --- a/modules/convert/batch/process_stack.php +++ /dev/null @@ -1,233 +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 Batch to process the stack - * - * @file - * @author Laurent Giovannoni <dev@maarch.org> - * @date $date$ - * @version $Revision$ - * @ingroup convert - */ - -/** - * ***** LIGHT PROBLEMS without an error semaphore - * 101 : Configuration file missing - * 102 : Configuration file does not exist - * 103 : Error on loading config file - * 104 : SQL Query Error - * 105 : a parameter is missing - * 106 : Maarch_CLITools is missing - * 107 : Stack empty for the request - * 108 : There are still documents to be processed - * 109 : An instance of the batch for the required collection already - * in progress - * 110 : Problem with collection parameter - * 111 : Problem with the php include path - * 112 : Problem with the setup of esign - * **** HEAVY PROBLEMS with an error semaphore - * 12 : Docserver type not found - * 13 : Docserver not found - * 14 : ... - * 15 : Error to copy file on docserver - * 16 : ... - * 17 : Tmp dir not exists - * 18 : Problem to create path on docserver, maybe batch number - * already exists - * 19 : Tmp dir not empty - * 20 : ... - * 21 : Problem to create directory on the docserver - * 22 : Problem during transfert of file (fingerprint control) - * 23 : Problem with compression - * 24 : Problem with extract - * 25 : Pb with fingerprint of the source - * 26 : File deletion impossible - * 27 : Resource not found - * 28 : The docserver will be full at 95 percent - * 29 : Error persists - * 30 : Esign problem - */ - -date_default_timezone_set('Europe/Paris'); - -/******************************************************************************/ -/* beginning */ -$GLOBALS['state'] = "CONTROL_STACK"; -while ($GLOBALS['state'] <> "END") { - if (isset($GLOBALS['logger'])) { - $GLOBALS['logger']->write("STATE:" . $GLOBALS['state'], 'DEBUG'); - } - switch($GLOBALS['state']) { - /**********************************************************************/ - /* CONTROL_STACK */ - /* Checking the stack is empty for the required parameters */ - /**********************************************************************/ - case "CONTROL_STACK" : - $query = "select * from convert_stack" - . " where coll_id = ? and work_batch = ?"; - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query, - array( - $GLOBALS['collection'], - $GLOBALS['wb'] - ) - ); - Bt_updateWorkBatch(); - $GLOBALS['logger']->write("Batch number:" . $GLOBALS['wb'], 'INFO'); - $query = "update convert_stack" - . " set status = 'I' where status = 'W'" - . " and work_batch = ?"; - $stmt = Bt_doQuery($GLOBALS['db'], $query, array($GLOBALS['wb'])); - if ($GLOBALS['OnlyIndexes']) { - //echo 'avant createZendIndexObject : ' . $GLOBALS['ProcessIndexesSize'] . PHP_EOL; - $GLOBALS['zendIndex'] = - $GLOBALS['processIndexes']->createZendIndexObject( - $GLOBALS['path_to_lucene'], $GLOBALS['ProcessIndexesSize'] - ); - //$GLOBALS['zendIndex']->setMergeFactor(10); - //print_r($GLOBALS['zendIndex']); - } - $GLOBALS['state'] = "GET_DOCSERVERS"; - break; - /**********************************************************************/ - /* GET_DOCSERVERS */ - /* Get the list of the docservers of the collection */ - /**********************************************************************/ - case "GET_DOCSERVERS" : - //retrieve docservers of the collection to process - $query = "select * from docservers " - . " where coll_id = ?"; - $stmt = Bt_doQuery( - $GLOBALS['db2'], - $query, - array($GLOBALS['collection']) - ); - $stmtCpt = $stmt; - if ($stmtCpt->fetchObject()->docserver_id == '') { - Bt_exitBatch(13, 'Docserver not found'); - break; - } else { - while($docserversRecordset = $stmt->fetchObject()) { - $GLOBALS['docservers'][$docserversRecordset->docserver_id] - = $GLOBALS['func']->object2array($docserversRecordset); - } - } - $GLOBALS['state'] = "A_RECORD"; - break; - /**********************************************************************/ - /* A_RECORD */ - /* Process a record */ - /**********************************************************************/ - case "A_RECORD" : - $GLOBALS['totalProcessedResources']++; - $query = "select * from convert_stack " - . " where coll_id = ? " - . " and status = 'I' " - . " and work_batch = ? limit 1"; - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query, - array( - $GLOBALS['collection'], - $GLOBALS['wb'] - ) - ); - $stackRecordset = $stmt->fetchObject(); - if (!($stackRecordset->res_id)) { - if ($GLOBALS['OnlyIndexes']) { - $GLOBALS['processIndexes']->commitZendIndex($GLOBALS['zendIndex']); - } - $GLOBALS['state'] = "END"; - $GLOBALS['logger']->write('No more records to process', 'INFO'); - break; - } else { - $currentRecordInStack = array(); - $currentRecordInStack = $GLOBALS['func']->object2array( - $stackRecordset - ); - $GLOBALS['logger']->write( - "current record:" . $currentRecordInStack['res_id'], - 'DEBUG' - ); - $GLOBALS['state'] = "CONVERT_IT"; - } - break; - /**********************************************************************/ - /* CONVERT_IT */ - /* Removes the address of the resource in the database */ - /**********************************************************************/ - case "CONVERT_IT" : - if ($GLOBALS['OnlyIndexes']) { - $resultConvert = $GLOBALS['processIndexes']->fulltext( - array( - 'collId' => $GLOBALS['collection'], - 'resTable' => $GLOBALS['table'], - 'adrTable' => $GLOBALS['adrTable'], - 'resId' => $currentRecordInStack['res_id'], - 'tmpDir' => $GLOBALS['tmpDirectory'], - 'path_to_lucene' => $GLOBALS['path_to_lucene'], - 'zendIndex' => $GLOBALS['zendIndex'] - ) - ); - } else { - $resultConvert = $GLOBALS['processConvert']->convertAll( - array( - 'collId' => $GLOBALS['collection'], - 'resTable' => $GLOBALS['table'], - 'adrTable' => $GLOBALS['adrTable'], - 'resId' => $currentRecordInStack['res_id'], - 'tmpDir' => $GLOBALS['tmpDirectory'], - 'path_to_lucene' => $GLOBALS['path_to_lucene'], - //'createZendIndex' => false - ) - ); - } - - $logInfo = "Problem with the record:" . $currentRecordInStack['res_id'] - . " details " . $resultConvert['error']; - - if ($resultConvert['status'] == '2') { - $GLOBALS['logger']->write($logInfo, 'WARNING'); - - } elseif ($resultConvert['status'] <> '0') { - $GLOBALS['logger']->write($logInfo, 'ERROR'); - } - $GLOBALS['state'] = "UPDATE_DATABASE"; - break; - - /**********************************************************************/ - /* UPDATE_DATABASE */ - /* Updating the database */ - /**********************************************************************/ - case "UPDATE_DATABASE" : - $query = "delete from convert_stack " - . " where coll_id = ? " - . " and res_id = ?"; - $stmt = Bt_doQuery( - $GLOBALS['db'], - $query, - array( - $GLOBALS['collection'], - $currentRecordInStack['res_id'] - ) - ); - $GLOBALS['state'] = "A_RECORD"; - break; - } -} - -$GLOBALS['logger']->write('End of process', 'INFO'); -Bt_logInDataBase( - $GLOBALS['totalProcessedResources'], 0, 'process without error' -); -Ds_washTmp($GLOBALS['tmpDirectory']); -unlink($GLOBALS['lckFile']); -exit($GLOBALS['exitCode']); diff --git a/modules/convert/batch/scripts/launch_convert_all_coll.sh.default b/modules/convert/batch/scripts/launch_convert_all_coll.sh.default deleted file mode 100755 index b729fa249c8..00000000000 --- a/modules/convert/batch/scripts/launch_convert_all_coll.sh.default +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config' - -#rm convert_letterbox_coll_config.lck -#rm convert_letterbox_coll_config_error.lck - -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll letterbox_coll -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll attachments_coll -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll attachments_version_coll -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll calendar_coll -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll folder_coll -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll chrono_coll -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll reprise_coll diff --git a/modules/convert/batch/scripts/launch_convert_attachments.sh.default b/modules/convert/batch/scripts/launch_convert_attachments.sh.default deleted file mode 100755 index 0969b997b16..00000000000 --- a/modules/convert/batch/scripts/launch_convert_attachments.sh.default +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config' - -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll attachments_coll \ No newline at end of file diff --git a/modules/convert/batch/scripts/launch_convert_letterbox.sh.default b/modules/convert/batch/scripts/launch_convert_letterbox.sh.default deleted file mode 100755 index e9430237257..00000000000 --- a/modules/convert/batch/scripts/launch_convert_letterbox.sh.default +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config' - -php $Mypath/fill_stack.php -c $ConfigPath/config.xml -coll letterbox_coll \ No newline at end of file diff --git a/modules/convert/batch/scripts/launch_fulltext_all_coll.sh.default b/modules/convert/batch/scripts/launch_fulltext_all_coll.sh.default deleted file mode 100755 index 4055fb238f9..00000000000 --- a/modules/convert/batch/scripts/launch_fulltext_all_coll.sh.default +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config' - -#rm convert_letterbox_coll_config_only_indexes.lck -#rm convert_letterbox_coll_config_only_indexes_error.lck - -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll letterbox_coll -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll attachments_coll -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll attachments_version_coll -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll calendar_coll -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll folder_coll -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll chrono_coll -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll reprise_coll diff --git a/modules/convert/batch/scripts/launch_fulltext_attachments.sh.default b/modules/convert/batch/scripts/launch_fulltext_attachments.sh.default deleted file mode 100755 index 897e3b5c720..00000000000 --- a/modules/convert/batch/scripts/launch_fulltext_attachments.sh.default +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config' - -rm convert_attachments_coll_config_only_indexes.lck -rm convert_attachments_coll_config_only_indexes_error.lck - -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll attachments_coll diff --git a/modules/convert/batch/scripts/launch_fulltext_letterbox.sh.default b/modules/convert/batch/scripts/launch_fulltext_letterbox.sh.default deleted file mode 100755 index 11906732bbf..00000000000 --- a/modules/convert/batch/scripts/launch_fulltext_letterbox.sh.default +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config' - -rm convert_letterbox_coll_config_only_indexes.lck -rm convert_letterbox_coll_config_only_indexes_error.lck - -php $Mypath/fill_stack.php -c $ConfigPath/config_only_indexes.xml -coll letterbox_coll diff --git a/modules/convert/batch/scripts/mywkhtmltoimage.sh b/modules/convert/batch/scripts/mywkhtmltoimage.sh deleted file mode 100755 index 2be138daf9c..00000000000 --- a/modules/convert/batch/scripts/mywkhtmltoimage.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -xvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltoimage -q $* diff --git a/modules/convert/batch/scripts/mywkhtmltopdf.sh b/modules/convert/batch/scripts/mywkhtmltopdf.sh deleted file mode 100755 index 76c76e2c586..00000000000 --- a/modules/convert/batch/scripts/mywkhtmltopdf.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -xvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $* diff --git a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_0.sh.default b/modules/convert/batch/scripts/parallel/launch_convert_letterbox_0.sh.default deleted file mode 100755 index 3ffef248dfc..00000000000 --- a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_0.sh.default +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config/parallel' - -for (( i=0; i < 3; i++ )); - do php $Mypath/fill_stack.php -c $ConfigPath/config_0.xml -coll letterbox_coll -done diff --git a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_1.sh.default b/modules/convert/batch/scripts/parallel/launch_convert_letterbox_1.sh.default deleted file mode 100755 index ccd8fb0406d..00000000000 --- a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_1.sh.default +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config/parallel' - -for (( i=0; i < 3; i++ )); - do php $Mypath/fill_stack.php -c $ConfigPath/config_1.xml -coll letterbox_coll -done diff --git a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_2.sh.default b/modules/convert/batch/scripts/parallel/launch_convert_letterbox_2.sh.default deleted file mode 100755 index 4405d6e3a3a..00000000000 --- a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_2.sh.default +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config/parallel/' - -for (( i=0; i < 3; i++ )); - do php $Mypath/fill_stack.php -c $ConfigPath/config_2.xml -coll letterbox_coll -done diff --git a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_3.sh.default b/modules/convert/batch/scripts/parallel/launch_convert_letterbox_3.sh.default deleted file mode 100755 index 45e28e9bdb4..00000000000 --- a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_3.sh.default +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config/parallel/' - -for (( i=0; i < 3; i++ )); - do php $Mypath/fill_stack.php -c $ConfigPath/config_3.xml -coll letterbox_coll -done diff --git a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_4.sh.default b/modules/convert/batch/scripts/parallel/launch_convert_letterbox_4.sh.default deleted file mode 100755 index 5e2d68f800d..00000000000 --- a/modules/convert/batch/scripts/parallel/launch_convert_letterbox_4.sh.default +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -Mypath='/var/www/html/MaarchCourrier/modules/convert/batch' -cd $Mypath -ConfigPath='/var/www/html/MaarchCourrier/modules/convert/batch/config/parallel/' - -for (( i=0; i < 3; i++ )); - do php $Mypath/fill_stack.php -c $ConfigPath/config_4.xml -coll letterbox_coll -done diff --git a/modules/convert/batch/scripts/parallel/param_cron.txt b/modules/convert/batch/scripts/parallel/param_cron.txt deleted file mode 100755 index de6869a344b..00000000000 --- a/modules/convert/batch/scripts/parallel/param_cron.txt +++ /dev/null @@ -1,6 +0,0 @@ -# tous les jours toutes les 2 heures de 0h a 20h du lundi au samedi lancement des batchs de conversion -0 0-20/2 * * 1-6 maarch /var/www/html/MaarchCourrier/modules/convert/batch/scripts/parallel/launch_convert_letterbox_0.sh -1 0-20/2 * * 1-6 maarch /var/www/html/MaarchCourrier/modules/convert/batch/scripts/parallel/launch_convert_letterbox_1.sh -2 0-20/2 * * 1-6 maarch /var/www/html/MaarchCourrier/modules/convert/batch/scripts/parallel/launch_convert_letterbox_2.sh -3 0-20/2 * * 1-6 maarch /var/www/html/MaarchCourrier/modules/convert/batch/scripts/parallel/launch_convert_letterbox_3.sh -4 0-20/2 * * 1-6 maarch /var/www/html/MaarchCourrier/modules/convert/batch/scripts/parallel/launch_convert_letterbox_4.sh diff --git a/modules/convert/batch/verif_index.php b/modules/convert/batch/verif_index.php deleted file mode 100755 index 203f6be90d0..00000000000 --- a/modules/convert/batch/verif_index.php +++ /dev/null @@ -1,23 +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. - * - */ - -date_default_timezone_set('Europe/Paris'); - -// load the config and prepare to process -include('load_fill_stack.php'); - - -/******************************************************************************/ -$GLOBALS['zendIndex'] = - $GLOBALS['processIndexes']->createZendIndexObject( - $GLOBALS['path_to_lucene'], $GLOBALS['ProcessIndexesSize'] - ); -unlink($GLOBALS['lckFile']); -exit($GLOBALS['zendIndex']->numDocs()); - diff --git a/modules/convert/class/class_modules_tools.php b/modules/convert/class/class_modules_tools.php deleted file mode 100755 index 949f379d3a9..00000000000 --- a/modules/convert/class/class_modules_tools.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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/>. -*/ - -/** -* @defgroup convert convert Module -*/ - -/** -* @brief Module convert : Module Tools Class -* -* <ul> -* <li>Set the session variables needed to run the convert module</li> -* </ul> -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup convert -*/ - -/** -* @brief Module convert : Module Tools Class -* -* <ul> -* <li>Loads the tables used by the convert</li> -* <li>Set the session variables needed to run the convert module</li> -* </ul> -* -* @ingroup convert -*/ -class convert extends Database -{ - function __construct() - { - parent::__construct(); - $this->index = array(); - } - - /** - * Loads convert tables into sessions vars from the - * convert/xml/config.xml - * Loads convert log setting into sessions vars from the - * convert/xml/config.xml - */ - public function build_modules_tables() - { - if (file_exists($_SESSION['config']['corepath'].'custom' - .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'] - .DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR - ."convert".DIRECTORY_SEPARATOR - ."xml".DIRECTORY_SEPARATOR."config.xml") - ) { - $path = $_SESSION['config']['corepath'].'custom' - .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'] - .DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR."convert" - .DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."config.xml"; - } else { - $path = "modules".DIRECTORY_SEPARATOR."convert" - .DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."config.xml"; - } - $xmlconfig = simplexml_load_file($path); - //$CONFIG = $xmlconfig->CONFIG; - // Loads the tables of the module convert - // into session ($_SESSION['tablename'] array) - - // Loads the log setting of the module convert - // into session ($_SESSION['history'] array) - $HISTORY = $xmlconfig->HISTORY; - $_SESSION['history']['convertadd'] = (string) $HISTORY->convertadd; - $_SESSION['history']['convertup'] = (string) $HISTORY->convertup; - $_SESSION['history']['convertdel'] = (string) $HISTORY->convertdel; - } - - /** - * Load into session vars all the convert specific vars : - * calls private methods - */ - public function load_module_var_session($userData) - { - //functions::show_array($_SESSION['convertFeatures']); - } -} diff --git a/modules/convert/class/ws.php b/modules/convert/class/ws.php deleted file mode 100755 index e9f0494bcda..00000000000 --- a/modules/convert/class/ws.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php -global $SOAP_dispatch_map; -global $XMLRPC_dispatch_map; -global $SOAP_typedef; - diff --git a/modules/convert/css/module.css b/modules/convert/css/module.css deleted file mode 100755 index e69de29bb2d..00000000000 diff --git a/modules/convert/js/functions.js b/modules/convert/js/functions.js deleted file mode 100755 index 5f7c77da42a..00000000000 --- a/modules/convert/js/functions.js +++ /dev/null @@ -1 +0,0 @@ -// diff --git a/modules/convert/lang/en.php b/modules/convert/lang/en.php deleted file mode 100755 index 533aa85eecc..00000000000 --- a/modules/convert/lang/en.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -/* - * - * Copyright 2008-2016 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/>. - */ - diff --git a/modules/convert/lang/fr.php b/modules/convert/lang/fr.php deleted file mode 100755 index 533aa85eecc..00000000000 --- a/modules/convert/lang/fr.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -/* - * - * Copyright 2008-2016 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/>. - */ - diff --git a/modules/convert/lang/nl.php b/modules/convert/lang/nl.php deleted file mode 100644 index 33b0bef78c5..00000000000 --- a/modules/convert/lang/nl.php +++ /dev/null @@ -1,7 +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. - */ diff --git a/modules/convert/optimizeLuceneIndex.php b/modules/convert/optimizeLuceneIndex.php deleted file mode 100755 index bb022b92bd6..00000000000 --- a/modules/convert/optimizeLuceneIndex.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -/* -* Copyright 2016 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 process fulltext class -* -* <ul> -* <li>Services to process the fulltext of resources</li> -* </ul> -* -* @file -* @author <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup convert -*/ - - if(strpos($_SERVER['argv'][1], '/indexes/') >= 0){ - - $_ENV['maarch_tools_path'] = $_SERVER['argv'][2].'/apps/maarch_entreprise/tools/'; - - // Storing text in lucene index - set_include_path('../../../apps/maarch_entreprise/tools/' . PATH_SEPARATOR . get_include_path()); - - if(!@include('Zend/Search/Lucene.php')) { - set_include_path('apps/maarch_entreprise/tools/'. PATH_SEPARATOR . get_include_path() - ); - require_once("Zend/Search/Lucene.php"); - } - require_once 'Zend/Search/Lucene/Storage/File/Filesystem.php'; - require_once 'Zend/Search/Lucene/Storage/Directory/Filesystem.php'; - - $directory = new Zend_Search_Lucene_Storage_Directory_Filesystem((string) $_SERVER['argv'][1]); - - $testDir = Zend_Search_Lucene::getActualGeneration($directory); - - if ($testDir != -1) { - $index = Zend_Search_Lucene::open((string) $_SERVER['argv'][1]); - - if (!empty($index)) { - $index->setFormatVersion(Zend_Search_Lucene::FORMAT_2_3); - Zend_Search_Lucene_Analysis_Analyzer::setDefault( - new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive() - ); - $index->optimize(); - } - } - - } - - -?> diff --git a/modules/convert/test_convert.php b/modules/convert/test_convert.php deleted file mode 100755 index 25ec308b0e4..00000000000 --- a/modules/convert/test_convert.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -// sample for letterbox : -// http:/urltomaarch/apps/maarch_entreprise/index.php?page=test_convert&module=convert&id=1931&collId=letterbox_coll - -// sample for attachments : -// http:/urltomaarch/apps/maarch_entreprise/index.php?page=test_convert&module=convert&id=1&collId=attachments_coll - -// sample for thumbnails : -// http:/urltomaarch//apps/maarch_entreprise/index.php?page=test_convert&module=convert&id=1939&collId=letterbox_coll&convertMode=thumbnails - -// sample for fulltext : -// http:/urltomaarch//apps/maarch_entreprise/index.php?page=test_convert&module=convert&id=1989&collId=letterbox_coll&convertMode=fulltext - -// sample for letterbox in allMode : -// http:/urltomaarch/apps/maarch_entreprise/index.php?page=test_convert&module=convert&id=1931&collId=letterbox_coll&convertMode=allMode - -// sample for attachments in allMode : -// http:/urltomaarch/apps/maarch_entreprise/index.php?page=test_convert&module=convert&id=1&collId=attachments_coll&convertMode=allMode - -$func = new functions(); - -for ($i=0;$i<count($_SESSION['collections']);$i++) { - if ($_SESSION['collections'][$i]['id'] == $_REQUEST['collId']) { - $resTable = $_SESSION['collections'][$i]['table']; - $adrTable = $_SESSION['collections'][$i]['adr']; - } -} - -if (empty($_REQUEST['convertMode'])) { - $convertMode = 'convert'; -} else { - $convertMode = $_REQUEST['convertMode']; -} - -echo $_REQUEST['convertMode'] . '<br />'; -echo $_REQUEST['collId'] . '<br />'; -echo $resTable . PHP_EOL . '<br />'; -echo $adrTable . PHP_EOL . '<br />'; -echo $_REQUEST['id'] . PHP_EOL . '<br />'; - -$params = array( - 'collId' => $_REQUEST['collId'], - 'resTable' => $resTable, - 'adrTable' => $adrTable, - 'resId' => $_REQUEST['id'], - 'tmpDir' => $_SESSION['config']['tmppath'] -); - -require_once 'core/services/ManageDocservers.php'; -$ManageDocservers = new Core_ManageDocservers_Service(); - -if ($convertMode == 'allMode') { - require_once 'modules/convert/services/ManageConvert.php'; - $ManageConvertService = new Convert_ManageConvert_Service(); - $resultOfConversion = $ManageConvertService->convertAll($params); - $adrType = 'CONV'; -} elseif ($convertMode == 'thumbnails') { - $adrType = 'TNL'; - require_once 'modules/convert/services/ProcessThumbnails.php'; - $ProcessConvertService = new Convert_ProcessThumbnails_Service(); - $resultOfConversion = $ProcessConvertService->thumbnails($params); - $resourcePath = $ManageDocservers->getSourceResourcePath( - $resTable, - $adrTable, - $_REQUEST['id'], - $adrType - ); -} elseif ($convertMode == 'fulltext') { - $adrType = 'TXT'; - require_once 'modules/convert/services/ProcessFulltext.php'; - $ProcessConvertService = new Convert_ProcessFulltext_Service(); - $resultOfConversion = $ProcessConvertService->fulltext($params); - $resourcePath = $ManageDocservers->getSourceResourcePath( - $resTable, - $adrTable, - $_REQUEST['id'], - $adrType - ); -} else { - $adrType = 'CONV'; - require_once 'modules/convert/services/ProcessConvert.php'; - $ProcessConvertService = new Convert_ProcessConvert_Service(); - $resultOfConversion = $ProcessConvertService->convert($params); - $resourcePath = $ManageDocservers->getSourceResourcePath( - $resTable, - $adrTable, - $_REQUEST['id'], - $adrType - ); -} - -echo $resourcePath . '<br />'; - -$func->show_array($resultOfConversion); - -$link .= $_SESSION['config']['businessappurl'] - . 'index.php?display=true' - . '&dir=indexing_searching' - . '&page=ViewRes' - . '&collId=' . $_REQUEST['collId'] - . '&id=' . $_REQUEST['id'] - . '&adrType=' . $adrType; -$linkToRes = '<a href="' . $link . '" target="_blank">clic to view the new resource !</a>'; - -echo '<br />' . $linkToRes; \ No newline at end of file diff --git a/modules/convert/xml/IVS/data_types.xml b/modules/convert/xml/IVS/data_types.xml deleted file mode 100755 index d182eb10092..00000000000 --- a/modules/convert/xml/IVS/data_types.xml +++ /dev/null @@ -1,2 +0,0 @@ -<dataTypes> -</dataTypes> \ No newline at end of file diff --git a/modules/convert/xml/IVS/requests_definitions.xml b/modules/convert/xml/IVS/requests_definitions.xml deleted file mode 100755 index de13c79b153..00000000000 --- a/modules/convert/xml/IVS/requests_definitions.xml +++ /dev/null @@ -1,2 +0,0 @@ -<requestDefinitions> -</requestDefinitions> \ No newline at end of file diff --git a/modules/convert/xml/IVS/validation_rules.xml b/modules/convert/xml/IVS/validation_rules.xml deleted file mode 100755 index bfc6f655dba..00000000000 --- a/modules/convert/xml/IVS/validation_rules.xml +++ /dev/null @@ -1,2 +0,0 @@ -<validationRules> -</validationRules> \ No newline at end of file diff --git a/modules/convert/xml/config.xml b/modules/convert/xml/config.xml deleted file mode 100755 index 3837913ef90..00000000000 --- a/modules/convert/xml/config.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <CONFIG> - <name>convert</name> - <comment>_CONVERT_COMMENT</comment> - <file_prefix>convert</file_prefix> - <loaded>true</loaded> - </CONFIG> - <TABLENAME/> - <HISTORY> - <convertadd>true</convertadd> - <convertup>true</convertup> - <convertdel>true</convertdel> - </HISTORY> -</root> diff --git a/modules/convert/xml/menu.xml b/modules/convert/xml/menu.xml deleted file mode 100755 index d15cc8033fc..00000000000 --- a/modules/convert/xml/menu.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> -</root> diff --git a/modules/convert/xml/services.xml b/modules/convert/xml/services.xml deleted file mode 100755 index d15cc8033fc..00000000000 --- a/modules/convert/xml/services.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> -</root> diff --git a/modules/entities/admin_entities.php b/modules/entities/admin_entities.php deleted file mode 100755 index 4d5da201f66..00000000000 --- a/modules/entities/admin_entities.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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/>. -*/ - -/** - * File : admin_entities.php. - * - * @brief Entities Administration summary Page - * - * @version 1 - * - * @since 03/2009 - * - * @license GPL - * @author C�dric Ndoumba <dev@maarch.org> - */ -$admin = new core_tools(); -$admin->test_admin('manage_entities', 'entities'); -/****************Management of the location bar ************/ -$init = false; -if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == 'true') { - $init = true; -} -$level = ''; -if (isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) { - $level = $_REQUEST['level']; -} -$page_path = $_SESSION['config']['businessappurl'].'index.php?page=admin_entities&module=entities'; -$page_label = _ENTITIES; -$page_id = 'admin_entities'; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ -unset($_SESSION['m_admin']); - -?> -<h1><i class="fa fa-sitemap fa-2x"></i> <?php echo _ENTITIES; ?></h1> - -<div id="inner_content" class="clearfix"> -<div class="block"> -<h2 style="text-align:center;"><?php echo _ENTITIES; ?></h2> - <div class="admin_item" title="<?php echo _MANAGE_ENTITIES_DESC; ?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=manage_entities&module=entities';"> - <div><i class="fa fa-sitemap fa-4x"></i></div> - <div> - <strong><?php echo _MANAGE_ENTITIES; ?></strong> - </div> - </div> - <div class="admin_item" title="<?php echo _ENTITY_TREE_DESC; ?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=view_tree_entities&module=entities';"> - <div><i class="fa fa-code-branch fa-4x"></i></div> - <div> - <strong><?php echo _ENTITY_TREE; ?></strong> - </div> - </div> - <?php if ($admin->test_admin('admin_difflist_types', 'entities', false)) { - ?> - <div class="admin_item" title="<?php echo _DIFFLIST_TYPES_DESC; ?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=admin_difflist_types&module=entities';"> - <div><i class="fa fa-share-alt fa-4x"></i></div> - <div> - <strong><?php echo _DIFFLIST_TYPES; ?></strong> - </div> - </div> - <?php -} ?> - <?php if ($admin->test_admin('admin_listmodels', 'entities', false)) { - ?> - <div class="admin_item" title="<?php echo _LISTMODELS_DESC; ?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=admin_listmodels&module=entities';"> - <div><i class="fa fa-share-alt-square fa-4x"></i></div> - <div> - <strong><?php echo _LISTMODELS; ?></strong> - </div> - </div> - <?php - } ?> -<div class="clearfix"></div> - </div> -</div> diff --git a/modules/entities/choose_tree.php b/modules/entities/choose_tree.php deleted file mode 100755 index 509a8614f4e..00000000000 --- a/modules/entities/choose_tree.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -$core_tools = new core_tools(); -$core_tools->load_lang(); -$func = new functions(); -$core_tools->load_html(); -$core_tools->load_header('', true, false); -$_SESSION['entities_chosen_tree'] = array(); -if(isset($_REQUEST['tree_id']) && !empty($_REQUEST['tree_id'])) -{ - $_SESSION['entities_chosen_tree'] = $_REQUEST['tree_id']; - ?> - <script type="text/javascript">window.top.frames['show_trees'].location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=show_trees';?>';</script> - <?php -} -else -{ - $_SESSION['entities_chosen_tree'] = ""; -} -?> -<body> -<div class="block"> - <h2> - <form name="frm_choose_tree" id="frm_choose_tree" method="get" action="<?php echo $_SESSION['config']['businessappurl'];?>index.php"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="module" value="entities" /> - <input type="hidden" name="page" value="choose_tree" /> - <p align="left"> - <label><?php echo _ENTITY;?> :</label> - <select name="tree_id" id="tree_id" onchange="this.form.submit();"> - <option value=""><?php echo _CHOOSE_ENTITY;?></option> - <?php - for($i=0;$i<count($_SESSION['tree_entities']);$i++) - { - ?> - <option value="<?php functions::xecho($_SESSION['tree_entities'][$i]['ID']);?>" <?php if($_SESSION['entities_chosen_tree'] == $_SESSION['tree_entities'][$i]['ID'] ){ echo 'selected="selected"';}?>><?php echo $_SESSION['tree_entities'][$i]['LABEL'];?></option> - <?php - } - ?> - </select> - </p> - </form> - </h2> -</div> - <?php $core_tools->load_js();?> -</body> -</html> diff --git a/modules/entities/redirect.php b/modules/entities/redirect.php index 22fd398dea5..1463c742976 100755 --- a/modules/entities/redirect.php +++ b/modules/entities/redirect.php @@ -311,7 +311,7 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col $stmt = $db->query( "select u.user_id, u.firstname, u.lastname, e.entity_id, e.entity_label " . "FROM " . $_SESSION['tablename']['users'] . " u, " . ENT_ENTITIES . " e, " - . ENT_USERS_ENTITIES . " ue WHERE u.status <> 'DEL' and u.enabled = 'Y' and" + . ENT_USERS_ENTITIES . " ue WHERE u.status <> 'DEL' and u.status != 'SPD' and" . " e.entity_id = ue.entity_id and u.user_id = ue.user_id and" . " e.enabled = 'Y' and ue.primary_entity='Y' and u.user_id = ?", array($userId) diff --git a/modules/entities/show_trees.php b/modules/entities/show_trees.php deleted file mode 100755 index de125c8462d..00000000000 --- a/modules/entities/show_trees.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php - -require_once("core/class/class_request.php"); -require_once("modules/entities/entities_tables.php"); -require_once('modules/entities/class/class_manage_entities.php'); - -$core_tools = new core_tools(); -$core_tools->load_lang(); -$func = new functions(); -$core_tools->load_html(); -$core_tools->load_header(); -?> - -<body> -<?php - -if (count($_SESSION['tree_entities']) < 1) { - echo _NO_DEFINED_TREES; -} else { - if (isset($_SESSION['entities_chosen_tree']) && !empty($_SESSION['entities_chosen_tree'])) { - $ent = new entity(); - $db = new Database(); - $_SESSION['EntitiesIdExclusion'] = array(); - $whereExclusion = ' and (1=1)'; - if ($_SESSION['user']['UserId'] != 'superadmin') { - require_once('modules/entities/class/class_manage_entities.php'); - $ent = new entity(); - $my_tab_entities_id = $ent->get_all_entities_id_user($_SESSION['user']['entities']); - $my_tab_entities_id = array_unique($my_tab_entities_id); - //var_dump($my_tab_entities_id); - if (count($my_tab_entities_id) > 0) { - $listOfMyEntities = implode(',', $my_tab_entities_id); - $stmt = $db->query( - "select entity_id from " - . ENT_ENTITIES . " where entity_id not in (" . $listOfMyEntities .") and enabled= 'Y' order by entity_id" - ); - //$ent->show(); - while ($res = $stmt->fetchObject()) { - array_push($_SESSION['EntitiesIdExclusion'], "'". $res->entity_id . "'"); - } - } - } - ?> - <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'] . 'tools/tafelTree/';?>js/scriptaculous.js"></script> - <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'] . 'tools/tafelTree/';?>Tree.js"></script> - <?php - //$where = ""; - $level1 = array(); - $stmt = $db->query("select u.user_id, u.lastname, u.firstname from " . ENT_USERS_ENTITIES . " ue, " - . $_SESSION['tablename']['users'] . " u where ue.entity_id = ? and ue.user_id = u.user_id and u.status <> 'DEL' " - . $whereExclusionUE . " order by u.lastname, u.firstname",array($_SESSION['entities_chosen_tree'])); - - - //$ent->show(); - while ($res = $stmt->fetchObject()) { - array_push( - $level1, array( - 'id' => $res->user_id, - 'tree' => $_SESSION['entities_chosen_tree'], - 'key_value' => $res->user_id, - 'label_value' => functions::show_string($res->lastname.' '.$res->firstname, true), - 'is_entity' => false - ) - ); - } - $stmt = $db->query("select entity_id, entity_label from " . ENT_ENTITIES . " where parent_entity_id = ? and enabled ='Y' order by entity_label",array($_SESSION['entities_chosen_tree'])); - //$ent->show(); - $level1 = array(); - while ($res = $stmt->fetchObject()) { - if (!is_integer(array_search("'" . $res->entity_id . "'", $_SESSION['EntitiesIdExclusion'])) || count($_SESSION['EntitiesIdExclusion']) == 0) { - $labelValue = '<span class="entity_tree_element_ok"><i class="fa"></i><a href="index.php?page=entity_up&module=entities&id=' - . $res->entity_id . '" target="_top">' . functions::show_string($res->entity_label, true) . '</a></span>'; - } else { - $labelValue = '<small><i>' . functions::show_string($res->entity_label, true) . '</i></small>'; - } - array_push( - $level1, - array( - 'id' => $res->entity_id, - 'tree' => $_SESSION['entities_chosen_tree'], - 'key_value' => $res->entity_id, - 'label_value' => $labelValue, - 'script' => "", - 'is_entity' => true - ) - ); - } - for ($i=0;$i<count($_SESSION['tree_entities']);$i++) { - if ($_SESSION['tree_entities'][$i]['ID'] == $_SESSION['entities_chosen_tree']) { - if (!is_integer(array_search("'" . $_SESSION['tree_entities'][$i]['ID'] . "'", $_SESSION['EntitiesIdExclusion'])) || count($_SESSION['EntitiesIdExclusion']) == 0) { - $label = $_SESSION['tree_entities'][$i]['ID'] . ' - <a href="index.php?page=entity_up&module=entities&id=' - . $_SESSION['tree_entities'][$i]['ID'] . '" target="_top">' . $ent->show_string($_SESSION['tree_entities'][$i]['LABEL'], true) . '</a>'; - } else { - $label = "<b>" . $_SESSION['tree_entities'][$i]['ID'] . ' - ' - . $_SESSION['tree_entities'][$i]['LABEL'] . "</b>"; - } - $valId=$_SESSION['tree_entities'][$i]['ID']; - } - } - $stmt = $db->query("select u.user_id, u.lastname, u.firstname, u.enabled, ue.entity_id as entity_id from " - . ENT_USERS_ENTITIES . " ue, " . $_SESSION['tablename']['users'] - . " u where ue.entity_id = ? and ue.user_id = u.user_id and u.status <> 'DEL' order by u.lastname, u.firstname",array($_SESSION['entities_chosen_tree'])); - while ($res = $stmt->fetchObject()) { - if (!is_integer(array_search("'" . $res->entity_id . "'", $_SESSION['EntitiesIdExclusion'])) || count($_SESSION['EntitiesIdExclusion']) == 0) { - if($res->enabled == 'N'){ - $labelValue = '<span class="entity_tree_element_ok">' . functions::show_string('<a style="color:red;" href="index.php?page=users_management_controler&mode=up&admin=users&id=' - . $res->user_id . '" target="_top">' . $res->lastname . ' ' . $res->firstname . '</a>', true) . '</span>'; - }else{ - $labelValue = '<span class="entity_tree_element_ok">' . functions::show_string('<a href="index.php?page=users_management_controler&mode=up&admin=users&id=' - . $res->user_id . '" target="_top">' . $res->lastname . ' ' . $res->firstname . '</a>', true) . '</span>'; - } - - } else { - $labelValue = '<small><i>' . functions::show_string($res->lastname . ' ' . $res->firstname, true) . '</i></small>'; - } - array_push( - $level1, - array( - 'id' => $res->user_id, - 'tree' => $_SESSION['entities_chosen_tree'], - 'key_value' => $res->user_id, - 'label_value' => $labelValue, - 'is_entity' => false - ) - ); - } - ?> - <div class="tree" id='divTree'> - <ul> - <li id=<?php echo "'".$valId."'"; ?> > - <span class="root"> - <span class="icon"><i class="fa fa-plus-square" style='cursor:pointer' onClick=<?php echo "\"getChildrenHtml('".$valId."','divTree','index.php?display=true&module=entities&page=get_tree_childs','fa fa-minus-square','fa fa-plus-square')\""?>></i></span> - <?php echo $label;?> - - </span> - </li> - </ul> - </div> - <script type="text/javascript"> - - var tree = $j('#divTree'); - BootstrapTree.init(tree); - </script> - <div id="trees_div"></div> - <?php - } else { - //echo "<div align='left'> "._CHOOSE_FOLDERTYPE."</div>"; - } -} -?> -</body> -</html> diff --git a/modules/entities/view_tree_entities.php b/modules/entities/view_tree_entities.php deleted file mode 100755 index 90c213b6960..00000000000 --- a/modules/entities/view_tree_entities.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** -* File : view_tree_entities.php. -* -* Entities Administration view tree -* -* @version 1 -* -* @since 03/2009 -* -* @license GPL -* @author C�dric Ndoumba <dev@maarch.org> -*/ -require_once 'modules/entities/entities_tables.php'; -$admin = new core_tools(); -$admin->test_admin('manage_entities', 'entities'); -$db = new Database(); -/****************Management of the location bar ************/ -$init = false; -if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == 'true') { - $init = true; -} -$level = ''; -if (isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 - || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 - || $_REQUEST['level'] == 1) -) { - $level = $_REQUEST['level']; -} -$page_path = $_SESSION['config']['businessappurl'].'index.php?page=view_tree_entities&module=entities'; -$page_label = _ENTITY_TREE; -$page_id = 'view_tree_entities'; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ -unset($_SESSION['m_admin']); -$_SESSION['tree_entities'] = array(); - -$stmt = $db->query('select entity_id, entity_label from '.ENT_ENTITIES." where parent_entity_id = '' or parent_entity_id is null order by entity_label"); -while ($res = $stmt->fetchObject()) { - array_push($_SESSION['tree_entities'], array('ID' => $res->entity_id, 'LABEL' => $res->entity_label)); -} -?> -<h1><i class="fa fa-code-branch fa-2x"></i> <?php echo _ENTITY_TREE; ?></h1> -<div id="inner_content" class="clearfix"> - <table width="100%" border="0"> - <tr> - <td> - <iframe name="choose_tree" id="choose_tree" width="550" height="40" frameborder="0" scrolling="no" src="<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=choose_tree'; ?>" style="width:100%;"></iframe> - </td> - </tr> - <tr> - <td> - <iframe name="show_trees" class="block" id="show_trees" width="550" height="600" frameborder="0" scrolling="auto" src="<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=show_trees';?>" style="width:99%;"></iframe> - </td> - </tr> - </table> -</div> diff --git a/modules/entities/xml/IVS/requests_definitions.xml b/modules/entities/xml/IVS/requests_definitions.xml index 20a539a16c8..b1de4c2066c 100755 --- a/modules/entities/xml/IVS/requests_definitions.xml +++ b/modules/entities/xml/IVS/requests_definitions.xml @@ -64,15 +64,6 @@ <parameter name="display" value="true"/> <parameter name="module" value="entities"/> </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="view_tree_entities" > - <parameter name="page" value="view_tree_entities"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="choose_tree" > - <parameter name="page" value="choose_tree"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="get_tree_childs" > <parameter name="page" value="get_tree_childs"/> diff --git a/modules/entities/xml/IVS/validation_rules.xml b/modules/entities/xml/IVS/validation_rules.xml index e87c6a4a42f..28868cf4f5b 100755 --- a/modules/entities/xml/IVS/validation_rules.xml +++ b/modules/entities/xml/IVS/validation_rules.xml @@ -67,10 +67,6 @@ <parameter name="archival_agreement" type="string" /> <parameter name="archival_agency" type="string" /> </validationRule> - <validationRule name="choose_tree" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="tree_id" type="identifier" /> - </validationRule> <validationRule name="get_tree_childs" extends="standardForm" mode="error"> <parameter name="module" type="identifier" /> <parameter name="branch" type="string" /> diff --git a/modules/folder/get_folder_view_stats_val.php b/modules/folder/get_folder_view_stats_val.php index 94e9c41e95e..0c69bde5438 100755 --- a/modules/folder/get_folder_view_stats_val.php +++ b/modules/folder/get_folder_view_stats_val.php @@ -176,7 +176,7 @@ elseif(isset($_REQUEST['type_report']) && $_REQUEST['type_report'] == 'user') $stmt = $db->query("SELECT u.user_id, u.lastname ,u.firstname, (SELECT COUNT(DISTINCT h.record_id) FROM ".$_SESSION['tablename']['history']." h INNER JOIN ".$_SESSION['tablename']['users']." u ON h.user_id = u.user_id WHERE h.event_type = 'VIEW' AND h.table_name = :foldFolder ".$whereUser.") AS nbr - FROM ".$_SESSION['tablename']['users']." u WHERE u.enabled = 'Y' ".$whereUser, $arrayPDO); + FROM ".$_SESSION['tablename']['users']." u WHERE u.status != 'SPD' ".$whereUser, $arrayPDO); $tab=array(); while($line = $stmt->fetch(PDO::FETCH_ASSOC)) diff --git a/src/app/convert/controllers/FullTextController.php b/src/app/convert/controllers/FullTextController.php index bdbb1496eed..d77595a4477 100644 --- a/src/app/convert/controllers/FullTextController.php +++ b/src/app/convert/controllers/FullTextController.php @@ -55,19 +55,8 @@ class FullTextController return ['errors' => 'FullText docserver is not writable']; } - if (FullTextController::isDirEmpty($fullTextDocserver['path_template'])) { - $index = \Zend_Search_Lucene::create($fullTextDocserver['path_template']); - } else { - $index = \Zend_Search_Lucene::open($fullTextDocserver['path_template']); - } - - $index->setFormatVersion(\Zend_Search_Lucene::FORMAT_2_3); - \Zend_Search_Lucene_Analysis_Analyzer::setDefault(new \Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive()); - $index->setMaxBufferedDocs(1000); - $tmpFile = CoreConfigModel::getTmpPath() . basename($pathToDocument) . rand() . '.txt'; $pdfToText = exec("pdftotext " . escapeshellarg($pathToDocument) . " " . escapeshellarg($tmpFile)); - if (!is_file($tmpFile)) { return ['errors' => 'Command pdftotext did not work : ' . $pdfToText]; } @@ -78,14 +67,28 @@ class FullTextController $fileContent = FullTextController::cleanFileContent($fileContent); - $doc = new \Zend_Search_Lucene_Document(); + try { + if (FullTextController::isDirEmpty($fullTextDocserver['path_template'])) { + $index = \Zend_Search_Lucene::create($fullTextDocserver['path_template']); + } else { + $index = \Zend_Search_Lucene::open($fullTextDocserver['path_template']); + } + + $index->setFormatVersion(\Zend_Search_Lucene::FORMAT_2_3); + \Zend_Search_Lucene_Analysis_Analyzer::setDefault(new \Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive()); + $index->setMaxBufferedDocs(1000); - $doc->addField(\Zend_Search_Lucene_Field::UnIndexed('Id', (integer)$args['resId'])); - $doc->addField(\Zend_Search_Lucene_Field::UnStored('contents', $fileContent)); + $doc = new \Zend_Search_Lucene_Document(); - $index->addDocument($doc); - $index->commit(); - $index->optimize(); + $doc->addField(\Zend_Search_Lucene_Field::UnIndexed('Id', (integer)$args['resId'])); + $doc->addField(\Zend_Search_Lucene_Field::UnStored('contents', $fileContent)); + + $index->addDocument($doc); + $index->commit(); + $index->optimize(); + } catch (\Exception $e) { + return ['errors' => 'Full Text index failed : ' . $e]; + } unlink($tmpFile); @@ -110,8 +113,8 @@ class FullTextController private static function cleanFileContent($fileContent) { $fileContent = TextFormatModel::normalize(['string' => $fileContent]); - $fileContent = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $fileContent); $fileContent = preg_replace('/[[:punct:]]/', ' ', $fileContent); + $fileContent = preg_replace('/[[:cntrl:]]/', ' ', $fileContent); $fileContent = trim($fileContent); $cleanArrayFile = []; -- GitLab