MAJ en Thelia 2.3.4

This commit is contained in:
2020-05-03 08:14:07 +02:00
parent 72ddf49e60
commit 35a800ca0e
328 changed files with 9560 additions and 14163 deletions

View File

@@ -13,7 +13,6 @@
namespace Thelia\Module;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Propel;
use SplFileInfo;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -48,7 +47,8 @@ class ModuleManagement
$finder
->name('module.xml')
->in($this->baseModuleDir . '*'.DS.'Config');
->in($this->baseModuleDir . '*' . DS . 'Config')
;
$errors = [];
@@ -84,10 +84,12 @@ class ModuleManagement
{
$descriptorValidator = $this->getDescriptorValidator();
$content = $descriptorValidator->getDescriptor($file->getRealPath());
$content = $descriptorValidator->getDescriptor($file->getRealPath());
$reflected = new \ReflectionClass((string)$content->fullnamespace);
$code = basename(dirname($reflected->getFileName()));
$version = (string)$content->version;
$mandatory = intval($content->mandatory);
$hidden = intval($content->hidden);
$module = ModuleQuery::create()->filterByCode($code)->findOne();
@@ -113,6 +115,8 @@ class ModuleManagement
->setFullNamespace((string)$content->fullnamespace)
->setType($this->getModuleType($reflected))
->setCategory((string)$content->type)
->setMandatory($mandatory)
->setHidden($hidden)
->save($con);
// Update the module images, title and description when the module is installed, but not after
@@ -123,7 +127,7 @@ class ModuleManagement
if (isset($content->{"images-folder"}) && !$module->isModuleImageDeployed($con)) {
/** @var \Thelia\Module\BaseModule $moduleInstance */
$moduleInstance = $reflected->newInstance();
$imagesFolder = THELIA_MODULE_DIR . $code . DS . (string) $content->{"images-folder"};
$imagesFolder = THELIA_MODULE_DIR . $code . DS . (string)$content->{"images-folder"};
$moduleInstance->deployImageFolder($module, $imagesFolder, $con);
}
}
@@ -139,9 +143,13 @@ class ModuleManagement
$instance->update($currentVersion, $version, $con);
}
if ($action !== 'none') {
$instance->registerHooks();
}
$con->commit();
} catch (\Exception $ex) {
Tlog::getInstance()->addError("Failed to update module ".$module->getCode(), $ex);
Tlog::getInstance()->addError("Failed to update module " . $module->getCode(), $ex);
$con->rollBack();
throw $ex;
@@ -184,7 +192,8 @@ class ModuleManagement
->setDescription(isset($description->description) ? $description->description : null)
->setPostscriptum(isset($description->postscriptum) ? $description->postscriptum : null)
->setChapo(isset($description->subtitle) ? $description->subtitle : null)
->save($con);
->save($con)
;
}
}
}