浏览代码

minor fixes

Olivier Massot 4 年之前
父节点
当前提交
eb1c8a6ee6
共有 2 个文件被更改,包括 7 次插入4 次删除
  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);
 
+        // instanciate twig loader
+        $loader = new \Twig\Loader\FilesystemLoader(dirname(__FILE__) . '/../../templates');
+        $twig = new \Twig\Environment($loader);
+
         // evaluate the report path
         $report_path = $input->getOption('report');
         if ($report_path == null) {
             $report_path = getcwd() . '/scan_report.html';
         } else {
             $info = pathinfo($report_path);
-            if ($info['extension'] != '.html') {
+            if ($info['extension'] != 'html') {
                 $report_path .= '.html';
             }
         }
@@ -71,8 +75,6 @@ class ScanCommand extends Command
         $scan = $scanController->scanAllAction(true);
 
         // render the twig template
-        $loader = new \Twig\Loader\FilesystemLoader(dirname(__FILE__) . '/../../templates');
-        $twig = new \Twig\Environment($loader);
         $template = $twig->load('scan_report.twig');
 
         $html_report = $template->render(['scan' => $scan]);

+ 2 - 1
ot_admin/composer.json

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