Browse Source

minor fixes

Olivier Massot 4 years ago
parent
commit
eb1c8a6ee6
2 changed files with 7 additions and 4 deletions
  1. 5 3
      ot_admin/Classes/Command/ScanCommand.php
  2. 2 1
      ot_admin/composer.json

+ 5 - 3
ot_admin/Classes/Command/ScanCommand.php

@@ -55,13 +55,17 @@ class ScanCommand extends Command
     {
     {
         $io = new SymfonyStyle($input, $output);
         $io = new SymfonyStyle($input, $output);
 
 
+        // instanciate twig loader
+        $loader = new \Twig\Loader\FilesystemLoader(dirname(__FILE__) . '/../../templates');
+        $twig = new \Twig\Environment($loader);
+
         // evaluate the report path
         // evaluate the report path
         $report_path = $input->getOption('report');
         $report_path = $input->getOption('report');
         if ($report_path == null) {
         if ($report_path == null) {
             $report_path = getcwd() . '/scan_report.html';
             $report_path = getcwd() . '/scan_report.html';
         } else {
         } else {
             $info = pathinfo($report_path);
             $info = pathinfo($report_path);
-            if ($info['extension'] != '.html') {
+            if ($info['extension'] != 'html') {
                 $report_path .= '.html';
                 $report_path .= '.html';
             }
             }
         }
         }
@@ -71,8 +75,6 @@ class ScanCommand extends Command
         $scan = $scanController->scanAllAction(true);
         $scan = $scanController->scanAllAction(true);
 
 
         // render the twig template
         // render the twig template
-        $loader = new \Twig\Loader\FilesystemLoader(dirname(__FILE__) . '/../../templates');
-        $twig = new \Twig\Environment($loader);
         $template = $twig->load('scan_report.twig');
         $template = $twig->load('scan_report.twig');
 
 
         $html_report = $template->render(['scan' => $scan]);
         $html_report = $template->render(['scan' => $scan]);

+ 2 - 1
ot_admin/composer.json

@@ -9,7 +9,8 @@
         }
         }
     ],
     ],
     "require": {
     "require": {
-        "typo3/cms-core": "^9.5 || ^10.4"
+        "typo3/cms-core": "^9.5 || ^10.4",
+        "twig/twig": "^2.13"
     },
     },
     "autoload": {
     "autoload": {
         "psr-4": {
         "psr-4": {