mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 12:03:14 +00:00
Fix template generator
This commit is contained in:
@@ -36,7 +36,15 @@ class module_console_systemTemplateGenerator extends Command
|
|||||||
|
|
||||||
public function execute(InputInterface $input, OutputInterface $output)
|
public function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$tplDir = __DIR__ . '/../../../../templates/';
|
$tplDirs = array(
|
||||||
|
realpath(__DIR__ . '/../../../../templates/web/'),
|
||||||
|
realpath(__DIR__ . '/../../../../templates/mobile/')
|
||||||
|
);
|
||||||
|
|
||||||
|
$n_ok = $n_error = 0;
|
||||||
|
|
||||||
|
foreach ($tplDirs as $tplDir)
|
||||||
|
{
|
||||||
$tmpDir = __DIR__ . '/../../../../tmp/cache_twig/';
|
$tmpDir = __DIR__ . '/../../../../tmp/cache_twig/';
|
||||||
|
|
||||||
$loader = new Twig_Loader_Filesystem($tplDir);
|
$loader = new Twig_Loader_Filesystem($tplDir);
|
||||||
@@ -45,6 +53,7 @@ class module_console_systemTemplateGenerator extends Command
|
|||||||
'cache' => $tmpDir,
|
'cache' => $tmpDir,
|
||||||
'auto_reload' => true
|
'auto_reload' => true
|
||||||
));
|
));
|
||||||
|
|
||||||
$twig->addExtension(new Twig_Extensions_Extension_I18n());
|
$twig->addExtension(new Twig_Extensions_Extension_I18n());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,25 +92,20 @@ class module_console_systemTemplateGenerator extends Command
|
|||||||
$twig->addFilter('geoname_name_from_id', new Twig_Filter_Function('geonames::name_from_id'));
|
$twig->addFilter('geoname_name_from_id', new Twig_Filter_Function('geonames::name_from_id'));
|
||||||
|
|
||||||
|
|
||||||
$n_ok = $n_error = 0;
|
$finder = new Symfony\Component\Finder\Finder();
|
||||||
|
foreach ($finder->files()->in(array($tplDir)) as $file)
|
||||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tplDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file)
|
|
||||||
{
|
{
|
||||||
if (strpos($file, '/.svn/') !== false)
|
|
||||||
continue;
|
|
||||||
if (substr($file->getFilename(), 0, 1) === '.')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$twig->loadTemplate(str_replace($tplDir, '', $file));
|
$twig->loadTemplate(str_replace($tplDir, '', $file->getPathname()));
|
||||||
$output->writeln('' . $file . '');
|
$output->writeln('' . $file . '');
|
||||||
$n_ok++;
|
$n_ok ++;
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
||||||
$n_error++;
|
$n_error ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user