From f36ec5b9571c131bda948cf47f32e32f2a96be25 Mon Sep 17 00:00:00 2001
From: Alex Orluc <alex.orluc@maarch.org>
Date: Tue, 9 Aug 2016 09:18:15 +0000
Subject: [PATCH] FIX #4483 add attachments for thumbnails

---
 core/trunk/install/class/Class_Install.php | 43 ++++++++++++++++++++--
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/core/trunk/install/class/Class_Install.php b/core/trunk/install/class/Class_Install.php
index 6a55cbb58e6..b6a0a0a7595 100755
--- a/core/trunk/install/class/Class_Install.php
+++ b/core/trunk/install/class/Class_Install.php
@@ -1053,7 +1053,7 @@ class Install extends functions
         return true;
     }
 
-        private function setConfigXmlThumbnails()
+    private function setConfigXmlThumbnails()
     {
         //var_dump("setConfigXmlThumbnails");
         $xmlconfig = simplexml_load_file('modules/thumbnails/xml/config.xml.default');
@@ -1076,7 +1076,8 @@ class Install extends functions
         }
         return true;
     }
-            private function setConfig_batch_XmlThumbnails()
+
+    private function setConfig_batch_XmlThumbnails()
     {
         $xmlconfig = simplexml_load_file('modules/thumbnails/xml/config_batch_letterbox.xml.default');
 
@@ -1104,6 +1105,38 @@ class Install extends functions
             return false;
             exit;
         }
+        
+        $write = fwrite($fp,$res);
+        if (!$write) {
+            return false;
+            exit;
+        }
+        $xmlconfig = simplexml_load_file('modules/thumbnails/xml/config_batch_attachments.xml.default');
+
+        $CONFIG = $xmlconfig->CONFIG;
+
+        $chemin_core = realpath('.').'/core/';
+
+        $CONFIG->MaarchDirectory = realpath('.')."/";
+        
+        $CONFIG_BASE = $xmlconfig->CONFIG_BASE;
+        $CONFIG_BASE->databaseserver = $_SESSION['config']['databaseserver'];
+        $CONFIG_BASE->databaseserverport = $_SESSION['config']['databaseserverport'];
+        $CONFIG_BASE->databasename = $_SESSION['config']['databasename'];
+        $CONFIG_BASE->databaseuser = $_SESSION['config']['databaseuser'];
+        $CONFIG_BASE->databasepassword = $_SESSION['config']['databasepassword'];
+
+        $LOG4PHP = $xmlconfig->LOG4PHP;
+        $LOG4PHP->Log4PhpConfigPath = realpath('.').'/apps/maarch_entreprise/xml/log4php.xml';
+
+
+
+        $res = $xmlconfig->asXML();
+        $fp = @fopen(realpath('.')."/custom/cs_".$_SESSION['config']['databasename']."/modules/thumbnails/xml/config_batch_attachments.xml", "w+");
+        if (!$fp) {
+            return false;
+            exit;
+        }
         $write = fwrite($fp,$res);
         if (!$write) {
             return false;
@@ -1112,7 +1145,7 @@ class Install extends functions
         return true;
     }
 
-                private function setConfig_batch_XmlNotifications()
+    private function setConfig_batch_XmlNotifications()
     {
         $xmlconfig = simplexml_load_file('modules/notifications/batch/config/config.xml.default');
 
@@ -1376,6 +1409,8 @@ class Install extends functions
 			$res = "cd ".realpath('.')."\modules\\thumbnails\\"; 
 			$res .= "\n";
             $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\thumbnails\create_tnl.php  '.realpath('.')."\custom\cs_".$_SESSION['config']['databasename'].'\modules\\thumbnails\xml\config_batch_letterbox.xml';
+            $res .= "\n";
+            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\thumbnails\create_tnl.php  '.realpath('.')."\custom\cs_".$_SESSION['config']['databasename'].'\modules\\thumbnails\xml\config_batch_attachments.xml';
             $res .= "\n";
 
 
@@ -1398,6 +1433,8 @@ class Install extends functions
             $res .= 'cd '.realpath('.').'/modules/thumbnails/';
             $res .= "\n\n";
             $res .= "php ".realpath('.')."/modules/thumbnails/create_tnl.php ".realpath('.')."/custom/cs_".$_SESSION['config']['databasename']."/modules/thumbnails/xml/config_batch_letterbox.xml";
+            $res .= "\n\n";
+            $res .= "php ".realpath('.')."/modules/thumbnails/create_tnl.php ".realpath('.')."/custom/cs_".$_SESSION['config']['databasename']."/modules/thumbnails/xml/config_batch_attachments.xml";
 
                 $fp = @fopen(realpath('.')."/custom/cs_".$_SESSION['config']['databasename']."/modules/thumbnails/scripts/launch_batch_thumbnails.sh", "w+");
             if (!$fp) {
-- 
GitLab