From cc942ca9fe601b7074fd58328fee30c39aafa8bc Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Wed, 17 Jan 2024 07:23:42 +0100 Subject: [PATCH 1/3] Prevent execution of EventListener on CLI --- Classes/Traits/ApplicationContextTrait.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Classes/Traits/ApplicationContextTrait.php b/Classes/Traits/ApplicationContextTrait.php index bf96012..256a216 100644 --- a/Classes/Traits/ApplicationContextTrait.php +++ b/Classes/Traits/ApplicationContextTrait.php @@ -18,16 +18,28 @@ trait ApplicationContextTrait { private function isBackendRequest(): bool { - return ApplicationType::fromRequest($this->getTypo3Request())->isBackend(); + $request = $this->getTypo3Request(); + if ($request instanceof ServerRequestInterface) { + return ApplicationType::fromRequest($request)->isBackend(); + } + + // In CLI context there is no TYPO3_REQUEST + return false; } private function isFrontendRequest(): bool { - return ApplicationType::fromRequest($this->getTypo3Request())->isFrontend(); + $request = $this->getTypo3Request(); + if ($request instanceof ServerRequestInterface) { + return ApplicationType::fromRequest($request)->isFrontend(); + } + + // In CLI context there is no TYPO3_REQUEST + return false; } - private function getTypo3Request(): ServerRequestInterface + private function getTypo3Request(): ?ServerRequestInterface { - return $GLOBALS['TYPO3_REQUEST']; + return $GLOBALS['TYPO3_REQUEST'] ?? null; } } From e99a403dd1faaae84b62270a4d13c5c3c56edf62 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Wed, 17 Jan 2024 07:34:55 +0100 Subject: [PATCH 2/3] Update documentation --- Documentation/ChangeLog/Index.rst | 9 ++++- Documentation/Configuration/Index.rst | 9 +++-- Documentation/Developer/Index.rst | 30 +++++++++------ Documentation/Includes.rst.txt | 50 ++++++++++++------------ Documentation/Index.rst | 5 +-- Documentation/Installation/Index.rst | 55 +++++++++++++++++++++++---- Documentation/Introduction/Index.rst | 15 ++++---- Documentation/KnownProblems/Index.rst | 10 +++-- Documentation/Links.rst | 24 ------------ Documentation/Settings.cfg | 4 +- Documentation/Sitemap.rst | 4 +- Documentation/User/Index.rst | 13 ++++--- Documentation/genindex.rst | 4 +- 13 files changed, 132 insertions(+), 100 deletions(-) delete mode 100644 Documentation/Links.rst diff --git a/Documentation/ChangeLog/Index.rst b/Documentation/ChangeLog/Index.rst index b7a3d11..5aa5646 100644 --- a/Documentation/ChangeLog/Index.rst +++ b/Documentation/ChangeLog/Index.rst @@ -1,12 +1,17 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt -.. _changelog: +.. _changelog: ========= ChangeLog ========= +Version 4.0.3 +============= + +* [BUGFIX] Do not try to add user information to images in CLI mode. + Version 4.0.2 ============= diff --git a/Documentation/Configuration/Index.rst b/Documentation/Configuration/Index.rst index 305cd69..a742866 100644 --- a/Documentation/Configuration/Index.rst +++ b/Documentation/Configuration/Index.rst @@ -1,7 +1,7 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt -.. _configuration: +.. _configuration: ============= Configuration @@ -13,5 +13,6 @@ Extension Settings Owner ----- -If you upload files you have to activate a checkbox to give an owner unrestricted rights -to the uploaded files. The owner in the label is a placeholder and can be set in Extension Settings. +If you upload files you have to activate a checkbox to give an owner +unrestricted rights to the uploaded files. The owner in the label is a +placeholder and can be set in Extension Settings. diff --git a/Documentation/Developer/Index.rst b/Documentation/Developer/Index.rst index c12bafd..a260807 100644 --- a/Documentation/Developer/Index.rst +++ b/Documentation/Developer/Index.rst @@ -1,7 +1,7 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt -.. _developer-manual: +.. _developer-manual: ================ Developer manual @@ -14,18 +14,21 @@ checkfaluploads adds two columns to table sys_file: **cruser_id** -This column will be filled automatically by `checkfaluploads` in TYPO3 BE context. +This column will be filled automatically by `checkfaluploads` in +TYPO3 BE context. **fe_cruser_id** -This column will be automatically filled by the current logged in FE user, as long -as you use the officially TYPO3 API for FAL files. In any other cases you have to fill this column on your own. +This column will be automatically filled by the current logged in FE user, as +long as you use the officially TYPO3 API for FAL files. In any other cases you +have to fill this column on your own. FalUploadService ================ -We deliver a little API you can use in your own Extension to check, if an uploaded file from FE context -has the user rights checkbox marked. Add checkbox to your Fluid Template: +We deliver a little API you can use in your own Extension to check, if an +uploaded file from FE context has the user rights checkbox marked. Add checkbox +to your Fluid Template: Checkbox via Fluid ------------------ @@ -37,7 +40,8 @@ Checkbox via Fluid class="form-check-input" value="1" /> -Somewhere in your extbase extension you should have an UploadTypeConverter. Add following lines: +Somewhere in your extbase extension you should have an UploadTypeConverter. +Add following lines: .. code-block:: php @@ -82,8 +86,9 @@ ViewHelpers ImageRightsMessageViewHelper ---------------------------- -This ViewHelper reads the owner property of checkfaluploads extension settings and implements the owner -into a localized string. That way you can build a text like "I give all image rights to jweiland.net". +This ViewHelper reads the owner property of `checkfaluploads` extension +settings and implements the owner into a localized string. That way you can +build a text like "I give all image rights to jweiland.net". .. code-block:: html @@ -95,8 +100,9 @@ Or inline style: {c:imageRightsMessage()} -If you want you can use your own translation of your own extension. In that case be sure you have added `%s` as -placeholder into your message of locallang.xml. +If you want you can use your own translation of your own extension. In that +case be sure you have added `%s` as placeholder into your message +of locallang.xlf. .. code-block:: html diff --git a/Documentation/Includes.rst.txt b/Documentation/Includes.rst.txt index bf6cef4..d3d2f19 100644 --- a/Documentation/Includes.rst.txt +++ b/Documentation/Includes.rst.txt @@ -1,34 +1,34 @@ -.. More information about this file: - https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/GeneralConventions/FileStructure.html#includes-rst-txt +.. More information about this file: + https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/GeneralConventions/FileStructure.html#includes-rst-txt -.. ---------- -.. text roles -.. ---------- +.. ---------- +.. text roles +.. ---------- -.. role:: aspect(emphasis) -.. role:: bash(code) -.. role:: html(code) -.. role:: js(code) -.. role:: php(code) -.. role:: rst(code) -.. role:: sep(strong) -.. role:: sql(code) +.. role:: aspect(emphasis) +.. role:: bash(code) +.. role:: html(code) +.. role:: js(code) +.. role:: php(code) +.. role:: rst(code) +.. role:: sep(strong) +.. role:: sql(code) -.. role:: tsconfig(code) - :class: typoscript +.. role:: tsconfig(code) + :class: typoscript -.. role:: typoscript(code) -.. role:: xml(code) - :class: html +.. role:: typoscript(code) +.. role:: xml(code) + :class: html -.. role:: yaml(code) +.. role:: yaml(code) -.. default-role:: code +.. default-role:: code -.. --------- -.. highlight -.. --------- +.. --------- +.. highlight +.. --------- -.. By default, code blocks use PHP syntax highlighting +.. By default, code blocks use PHP syntax highlighting -.. highlight:: php \ No newline at end of file +.. highlight:: php diff --git a/Documentation/Index.rst b/Documentation/Index.rst index 94432c6..700f369 100644 --- a/Documentation/Index.rst +++ b/Documentation/Index.rst @@ -1,7 +1,7 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt -.. _start: +.. _start: =============== Checkfaluploads @@ -49,7 +49,6 @@ where the user gives unrestricted rights to the owner for the uploaded files. Developer/Index KnownProblems/Index ChangeLog/Index - Links Sitemap .. Meta Menu diff --git a/Documentation/Installation/Index.rst b/Documentation/Installation/Index.rst index 8575751..3f2b193 100644 --- a/Documentation/Installation/Index.rst +++ b/Documentation/Installation/Index.rst @@ -1,20 +1,59 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt -.. _installation: +.. _installation: ============ Installation ============ -Target group: **Administrators** +Composer +======== -The extension needs to be installed like any other extension of TYPO3 CMS: +If your TYPO3 installation works in composer mode, please execute following +command: -#. Visit ExtensionManager +.. code-block:: bash -#. Switch over to `Get Extensions` + composer req jweiland/checkfaluploads + vendor/bin/typo3 extension:setup --extension=checkfaluploads -#. Search for `checkfaluploads` +If you work with DDEV please execute this command: -#. Install extension +.. code-block:: bash + + ddev composer req jweiland/checkfaluploads + ddev exec vendor/bin/typo3 extension:setup --extension=checkfaluploads + +ExtensionManager +================ + +On non composer based TYPO3 installations you can install `checkfaluploads` +still over the ExtensionManager: + +.. rst-class:: bignums + +1. Login + + Login to backend of your TYPO3 installation as an administrator or system + maintainer. + +2. Open ExtensionManager + + Click on `Extensions` from the left menu to open the ExtensionManager. + +3. Update Extensions + + Choose `Get Extensions` from the upper selectbox and click on + the `Update now` button at the upper right. + +4. Install `checkfaluploads` + + Use the search field to find `checkfaluploads`. Choose the `checkfaluploads` + line from the search result and click on the cloud icon to + install `checkfaluploads`. + +Next step +========= + +:ref:`Configure checkfaluploads `. diff --git a/Documentation/Introduction/Index.rst b/Documentation/Introduction/Index.rst index 4b7a015..a7e69f9 100644 --- a/Documentation/Introduction/Index.rst +++ b/Documentation/Introduction/Index.rst @@ -1,19 +1,20 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt -.. _introduction: +.. _introduction: ============ Introduction ============ -.. _what-it-does: +.. _what-it-does: What does it do? ================ -With checkfaluploads we will add a new checkbox to filelist module and ElementBrowser -where the user gives unrestricted rights to the owner for the uploaded files. -Further the UID of the image uploading editor will be added to the `sys_file` record, so an admin can see who has -uploaded a file in history. +With checkfaluploads we will add a new checkbox to filelist module and +ElementBrowser where the user gives unrestricted rights to the owner for the +uploaded files. Further the UID of the image uploading editor will be added +to the `sys_file` record, so an admin can see who has uploaded a file +in history. diff --git a/Documentation/KnownProblems/Index.rst b/Documentation/KnownProblems/Index.rst index dbf0a2e..9df7d78 100644 --- a/Documentation/KnownProblems/Index.rst +++ b/Documentation/KnownProblems/Index.rst @@ -1,11 +1,15 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt -.. _known-problems: +.. _known-problems: ============== Known Problems ============== -Currently there are no known issues. +No user in CLI mode +=================== +We only set FE or BE user in frontend or backend mode. As the user for CLI mode +is always the same one and only user, it does not make sense to add that +user as creator or editor to any files. diff --git a/Documentation/Links.rst b/Documentation/Links.rst deleted file mode 100644 index d7d2ffc..0000000 --- a/Documentation/Links.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. include:: /Includes.rst.txt - - -.. _links: - -Links ------ - -The links to issue and the GitHub repository are maintained in the Settings.cfg. - -You may want to remove this file if all important links are already handled in -Settings.cfg. - -:Packagist: - https://packagist.org/packages/jweiland/checkfaluploads - -:TER: - https://extensions.typo3.org/extension/checkfaluploads/ - -:Issues: - https://github.com/jweiland-net/checkfaluploads/issues - -:GitHub Repository: - https://github.com/jweiland-net/checkfaluploads diff --git a/Documentation/Settings.cfg b/Documentation/Settings.cfg index 2829013..8896efd 100644 --- a/Documentation/Settings.cfg +++ b/Documentation/Settings.cfg @@ -4,7 +4,7 @@ [general] project = Check FAL Uploads -version = 4.0.2 +version = 4.0.3 release = 4.0 copyright = by jweiland.net @@ -12,7 +12,7 @@ copyright = by jweiland.net # "Edit on GitHub" button github_repository = jweiland-net/checkfaluploads -github_branch = master +github_branch = main # Footer links project_home = diff --git a/Documentation/Sitemap.rst b/Documentation/Sitemap.rst index 09d3c6f..cd06f7d 100644 --- a/Documentation/Sitemap.rst +++ b/Documentation/Sitemap.rst @@ -1,9 +1,9 @@ :template: sitemap.html -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt ======= Sitemap ======= -.. The sitemap.html template will insert here the page tree automatically. +.. The sitemap.html template will insert here the page tree automatically. diff --git a/Documentation/User/Index.rst b/Documentation/User/Index.rst index 488f889..a53ed10 100644 --- a/Documentation/User/Index.rst +++ b/Documentation/User/Index.rst @@ -1,14 +1,15 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt -.. _user-manual: +.. _user-manual: ============ Users Manual ============ -While uploading files in `filelist` module or in `ElementBrowser` you will see a new -checkbox to confirm all file rights to the given owner. If you do not check this checkbox -the file upload will fail. +While uploading files in `filelist` module or in `ElementBrowser` you will see +a new checkbox to confirm all file rights to the given owner. If you do not +check this checkbox the file upload will fail. -If a file was uploaded successfully, your user UID will be assigned to the uploaded files. +If a file was uploaded successfully, your user UID will be assigned to +the uploaded files. diff --git a/Documentation/genindex.rst b/Documentation/genindex.rst index 806ec56..38a804f 100644 --- a/Documentation/genindex.rst +++ b/Documentation/genindex.rst @@ -1,7 +1,7 @@ -.. include:: /Includes.rst.txt +.. include:: /Includes.rst.txt ===== Index ===== -.. Sphinx will insert here the general index automatically. +.. Sphinx will insert here the general index automatically. From eff4a53f55a225b32a204ca73249809425a0014c Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Wed, 17 Jan 2024 07:36:00 +0100 Subject: [PATCH 3/3] Update version to 4.0.3 --- composer.json | 4 ++-- ext_emconf.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 4751121..de40f1b 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,8 @@ "source": "https://github.com/jweiland-net/checkfaluploads" }, "require": { - "typo3/cms-core": "^12.4.4", - "typo3/cms-filelist": "^12.4.4" + "typo3/cms-core": "^12.4.8", + "typo3/cms-filelist": "^12.4.8" }, "require-dev": { "roave/security-advisories": "dev-latest", diff --git a/ext_emconf.php b/ext_emconf.php index fad6821..b8d8ac0 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -8,10 +8,10 @@ 'author_email' => 'projects@jweiland.net', 'author_company' => 'jweiland.net', 'state' => 'stable', - 'version' => '4.0.2', + 'version' => '4.0.3', 'constraints' => [ 'depends' => [ - 'typo3' => '12.4.4-12.4.99', + 'typo3' => '12.4.8-12.4.99', ], 'conflicts' => [ ],