Preprod mutu dc0edebeb0 tnt
2017-09-12 10:48:51 +02:00

68 lines
2.2 KiB
PHP

<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_2_10($objTNT)
{
$templateOverrides = array(
array(
'fileName' => 'view.tpl',
'directorySrc' => 'views/templates/admin/override/controllers/admin/templates/orders/helpers/view/',
'directoryDst' => 'controllers/admin/templates/orders/helpers/view/',
),
);
foreach ($templateOverrides as $template) {
try {
$directoryDst = _PS_OVERRIDE_DIR_.$template['directoryDst'];
if (!is_dir($directoryDst)) {
mkdir($directoryDst, 0777, true);
}
$overrideDestination = $directoryDst.$template['fileName'];
if (file_exists($overrideDestination)) {
unlink($overrideDestination);
}
} catch (Exception $objException) {
$logger = new FileLogger();
$logger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log');
$logger->log($objException->getMessage(), 3);
return false;
}
try {
$directoryDst = _PS_OVERRIDE_DIR_.$template['directoryDst'];
if (!is_dir($directoryDst)) {
mkdir($directoryDst, 0777, true);
}
$overrideSrc = $objTNT->getLocalPath().$template['directorySrc'].$template['fileName'];
$overrideDestination = $directoryDst.$template['fileName'];
copy($overrideSrc, $overrideDestination);
} catch (Exception $objException) {
$logger = new FileLogger();
$logger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log');
$logger->log($objException->getMessage(), 3);
return false;
}
}
// Reinstall Overrides
if (!$objTNT->uninstallOverrides()) {
return false;
}
if (!$objTNT->installOverrides()) {
return false;
}
return true;
}