Browse Source

Minor updates

master
Radu Liviu Carjan 2 years ago
parent
commit
475a73d5c1
  1. BIN
      .config/libreoffice/4/user/pack/registrymodifications.pack
  2. 2
      .config/libreoffice/4/user/registrymodifications.xcu
  3. 44
      app/SearchDisplace/Convertor/Convertor.php
  4. 2
      app/SearchDisplace/Ingest/HandleReceivedDocument.php

BIN
.config/libreoffice/4/user/pack/registrymodifications.pack

2
.config/libreoffice/4/user/registrymodifications.xcu

@ -10,7 +10,9 @@
<item oor:path="/org.openoffice.Office.Views/Windows"><node oor:name="SplitWindow2" oor:op="replace"><prop oor:name="Visible" oor:op="fuse"><value xsi:nil="true"/></prop><node oor:name="UserData"><prop oor:name="UserItem" oor:op="fuse" oor:type="xs:string"><value>V1,2,0</value></prop></node><prop oor:name="WindowState" oor:op="fuse"><value xsi:nil="true"/></prop></node></item>
<item oor:path="/org.openoffice.Office.Views/Windows"><node oor:name="SplitWindow3" oor:op="replace"><prop oor:name="Visible" oor:op="fuse"><value xsi:nil="true"/></prop><node oor:name="UserData"><prop oor:name="UserItem" oor:op="fuse" oor:type="xs:string"><value>V1,2,0</value></prop></node><prop oor:name="WindowState" oor:op="fuse"><value xsi:nil="true"/></prop></node></item>
<item oor:path="/org.openoffice.Setup/L10N"><prop oor:name="ooLocale" oor:op="fuse"><value>en-US</value></prop></item>
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.drawing.DrawingDocument']"><prop oor:name="ooSetupFactoryWindowAttributes" oor:op="fuse"><value>0,0,800,600;1;0,0,0,0;</value></prop></item>
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.text.TextDocument']"><prop oor:name="ooSetupFactoryWindowAttributes" oor:op="fuse"><value>0,0,800,600;1;0,0,0,0;</value></prop></item>
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.text.WebDocument']"><prop oor:name="ooSetupFactoryWindowAttributes" oor:op="fuse"><value>0,0,800,600;1;0,0,0,0;</value></prop></item>
<item oor:path="/org.openoffice.Setup/Office"><prop oor:name="LastCompatibilityCheckID" oor:op="fuse"><value>40(Build:3)</value></prop></item>
<item oor:path="/org.openoffice.Setup/Office"><prop oor:name="OfficeRestartInProgress" oor:op="fuse"><value>true</value></prop></item>
<item oor:path="/org.openoffice.Setup/Office"><prop oor:name="ooSetupInstCompleted" oor:op="fuse"><value>true</value></prop></item>

44
app/SearchDisplace/Convertor/Convertor.php

@ -21,6 +21,7 @@ class Convertor {
public static function convert($to, $document, $tmp = false)
{
$path = pathinfo($document);
$extension = $path['extension'];
$dir = $path['dirname'];
$original = $dir . '/' . $path['basename'];
if(!$tmp) {
@ -29,6 +30,15 @@ class Convertor {
$folder = storage_path('app/tmp/');
}
$env = [
'HOME' => base_path()
];
if ($extension == 'odt') {
$to = $to . ':"$FILTER"';
$env['FILTER'] = 'OpenDocument Text Flat XML';
}
Log::info('Running `soffice` to convert "' . $original . '" to "' . $to . '". Output folder: "' . $folder . '"');
Log::info(
'COMMAND: ' .
@ -41,20 +51,28 @@ class Convertor {
);
$process = new Process(
[
'soffice',
'--convert-to',
$to,
$original,
'--outdir',
$folder
], base_path(),
[
'HOME' => base_path()
]
// $process = new Process(
// [
// 'soffice',
// '--convert-to',
// $to,
// $original,
// '--outdir',
// $folder
// ], base_path(),
// [
// 'HOME' => base_path(),
// 'FILTER' => 'OpenDocument Text Flat XML'
// ]
// );
$process = Process::fromShellCommandline(
"soffice --convert-to $to $original --outdir $folder",
base_path(),
$env
);
$process->run();
$process->run(null, $env);
Log::info("OUTPUT: " . $process->getOutput());
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);

2
app/SearchDisplace/Ingest/HandleReceivedDocument.php

@ -77,7 +77,7 @@ class HandleReceivedDocument
// HTML document cannot be converted directly to xml. So we convert to ODT first, then to XML
Convertor::convert('odt', $this->storage->path("$dir/$fileName"));
Convertor::convert('xml', $this->storage->path("$dir/$intermediateFileName"));
$this->storage->delete("$dir/$intermediateFileName");
// $this->storage->delete("$dir/$intermediateFileName");
foreach ($this->content['images'] as $image) {
$name = $image['name'];

Loading…
Cancel
Save