Skip to content
Snippets Groups Projects
Commit 9d0ffa6c authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #12167 TIME 0:30 end migrate html template + fix admin edition

parent aa8d9690
No related branches found
No related tags found
No related merge requests found
...@@ -255,30 +255,23 @@ foreach ($customs as $custom) { ...@@ -255,30 +255,23 @@ foreach ($customs as $custom) {
if ($template['template_target'] == 'doctypes') { if ($template['template_target'] == 'doctypes') {
$pathFilename = $tmpPath . 'template_migration_' . rand() . '_'. rand() .'.html'; $pathFilename = $tmpPath . 'template_migration_' . rand() . '_'. rand() .'.html';
file_put_contents($pathFilename, $newContent); file_put_contents($pathFilename, $newContent);
// $docInfo = pathinfo($pathFilename);
// $command = "timeout 30 unoconv -f odt " . escapeshellarg($pathFilename); $resource = file_get_contents($pathFilename);
$pathInfo = pathinfo($pathFilename);
// exec('export HOME=' . $tmpPath . ' && '.$command.' 2>&1', $output, $return); $storeResult = DocserverController::storeResourceOnDocServer([
// if (!file_exists($tmpPath.$docInfo["filename"].'.odt')) {
// $nonMigrated++;
// echo implode(" ", $output);
// } else {
$resource = file_get_contents($pathFilename);
$pathInfo = pathinfo($pathFilename);
$storeResult = DocserverController::storeResourceOnDocServer([
'collId' => 'templates', 'collId' => 'templates',
'docserverTypeId' => 'TEMPLATES', 'docserverTypeId' => 'TEMPLATES',
'encodedResource' => base64_encode($resource), 'encodedResource' => base64_encode($resource),
'format' => $pathInfo['extension'] 'format' => $pathInfo['extension']
]); ]);
TemplateModel::update([ TemplateModel::update([
'set' => [ 'set' => [
// 'template_content' => '', 'template_content' => '',
'template_type' => 'OFFICE', 'template_type' => 'OFFICE',
'template_path' => $storeResult['destination_dir'], 'template_path' => $storeResult['destination_dir'],
'template_file_name' => $storeResult['file_destination_name'], 'template_file_name' => $storeResult['file_destination_name'],
'template_style' => '',
'template_datasource' => 'letterbox_attachment', 'template_datasource' => 'letterbox_attachment',
'template_target' => 'indexingFile', 'template_target' => 'indexingFile',
'template_attachment_type' => 'all' 'template_attachment_type' => 'all'
...@@ -286,9 +279,7 @@ foreach ($customs as $custom) { ...@@ -286,9 +279,7 @@ foreach ($customs as $custom) {
'where' => ['template_id = ?'], 'where' => ['template_id = ?'],
'data' => [$template['template_id']] 'data' => [$template['template_id']]
]); ]);
unlink($pathFilename); unlink($pathFilename);
// unlink($tmpPath.$docInfo["filename"].'.html');
// }
} else { } else {
if ($content != $newContent) { if ($content != $newContent) {
TemplateModel::update([ TemplateModel::update([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment