An exception is thrown if a module could not be loaded.
This commit is contained in:
@@ -21,30 +21,28 @@ namespace Thelia\Core;
|
|||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Propel\Runtime\Connection\ConnectionManagerSingle;
|
||||||
use Propel\Runtime\Connection\ConnectionWrapper;
|
use Propel\Runtime\Connection\ConnectionWrapper;
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Symfony\Component\Config\FileLocator;
|
||||||
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Symfony\Component\HttpKernel\Kernel;
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
|
||||||
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
|
||||||
use Thelia\Config\DatabaseConfiguration;
|
use Thelia\Config\DatabaseConfiguration;
|
||||||
use Thelia\Config\DefinePropel;
|
use Thelia\Config\DefinePropel;
|
||||||
|
use Thelia\Core\DependencyInjection\Loader\XmlFileLoader;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Core\Template\ParserInterface;
|
use Thelia\Core\Template\ParserInterface;
|
||||||
use Thelia\Core\Template\TemplateDefinition;
|
use Thelia\Core\Template\TemplateDefinition;
|
||||||
|
|
||||||
use Thelia\Core\DependencyInjection\Loader\XmlFileLoader;
|
|
||||||
use Symfony\Component\Config\FileLocator;
|
|
||||||
|
|
||||||
use Propel\Runtime\Propel;
|
|
||||||
use Propel\Runtime\Connection\ConnectionManagerSingle;
|
|
||||||
use Thelia\Core\Template\TemplateHelper;
|
use Thelia\Core\Template\TemplateHelper;
|
||||||
use Thelia\Log\Tlog;
|
use Thelia\Log\Tlog;
|
||||||
use Thelia\Model\Module;
|
use Thelia\Model\Module;
|
||||||
|
use Thelia\Model\ModuleQuery;
|
||||||
|
|
||||||
class Thelia extends Kernel
|
class Thelia extends Kernel
|
||||||
{
|
{
|
||||||
@@ -143,7 +141,7 @@ class Thelia extends Kernel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\UnexpectedValueException $ex) {
|
} catch (\UnexpectedValueException $ex) {
|
||||||
// The directory does not exists, ignore it.
|
// The directory does not exists, ignore it.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,12 +160,13 @@ class Thelia extends Kernel
|
|||||||
->depth(0)
|
->depth(0)
|
||||||
->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources");
|
->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources");
|
||||||
|
|
||||||
|
/** @var \SplFileInfo $file */
|
||||||
foreach ($finder as $file) {
|
foreach ($finder as $file) {
|
||||||
$loader->load($file->getBaseName());
|
$loader->load($file->getBaseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined("THELIA_INSTALL_MODE") === false) {
|
if (defined("THELIA_INSTALL_MODE") === false) {
|
||||||
$modules = \Thelia\Model\ModuleQuery::getActivated();
|
$modules = ModuleQuery::getActivated();
|
||||||
|
|
||||||
$translationDirs = array();
|
$translationDirs = array();
|
||||||
|
|
||||||
@@ -233,12 +232,16 @@ class Thelia extends Kernel
|
|||||||
$translationDirs[$module->getFrontOfficeTemplateTranslationDomain($template->getName())] =
|
$translationDirs[$module->getFrontOfficeTemplateTranslationDomain($template->getName())] =
|
||||||
$module->getAbsoluteFrontOfficeI18nTemplatePath($template->getName());
|
$module->getAbsoluteFrontOfficeI18nTemplatePath($template->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addStandardModuleTemplatesToParserEnvironment($parser, $module);
|
$this->addStandardModuleTemplatesToParserEnvironment($parser, $module);
|
||||||
|
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
|
|
||||||
Tlog::getInstance()->addError(
|
Tlog::getInstance()->addError(
|
||||||
sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()), $e
|
sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()), $e
|
||||||
);
|
);
|
||||||
|
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user