Set the `lastModificationTime` for the template via a `CustomFormDataProcessor`
authorCyperghost <olaf_schmitz_1@t-online.de>
Tue, 8 Oct 2024 09:46:30 +0000 (11:46 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Tue, 8 Oct 2024 09:46:30 +0000 (11:46 +0200)
wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php
wcfsetup/install/files/lib/data/template/TemplateEditor.class.php

index 550cdd3e9c09d69299570e88168c86513b3f3e22..a66f3aeb0cb5d9bbe5f22fb802aa8d26a30414f2 100644 (file)
@@ -196,6 +196,16 @@ class TemplateAddForm extends AbstractFormBuilderForm
                     }
                 )
             )
+            ->addProcessor(
+                new CustomFormDataProcessor(
+                    'lastModificationTime',
+                    static function (IFormDocument $document, array $parameters) {
+                        $parameters['data']['lastModificationTime'] = TIME_NOW;
+
+                        return $parameters;
+                    }
+                )
+            )
             ->addProcessor(new VoidFormDataProcessor('copy'))
             ->addProcessor(new VoidFormDataProcessor('templateSource'));
 
index 0a847bd5ca125f043114a20e39efab1cb5a3af9e..ace4f6c587b32ed0c7b8a3e50b371ec42a070aab 100644 (file)
@@ -3,7 +3,6 @@
 namespace wcf\data\template;
 
 use wcf\data\DatabaseObjectEditor;
-use wcf\system\io\File;
 use wcf\system\Regex;
 use wcf\system\WCF;
 use wcf\util\DirectoryUtil;
@@ -36,9 +35,6 @@ class TemplateEditor extends DatabaseObjectEditor
         if (!isset($parameters['packageID'])) {
             $parameters['packageID'] = PACKAGE_ID;
         }
-        if (!isset($parameters['lastModificationTime'])) {
-            $parameters['lastModificationTime'] = TIME_NOW;
-        }
 
         /** @noinspection PhpIncompatibleReturnTypeInspection */
         return parent::create($parameters);