Skip to content

[FEATURE] Allow a separate file for the site data - #42

Open
sfsmfc wants to merge 6 commits into
developfrom
feature/analytics-site-data-file
Open

sfsmfc wants to merge 6 commits into
developfrom
feature/analytics-site-data-file

Conversation

@sfsmfc

@sfsmfc sfsmfc commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Set siteDataPath to write the site data into a separate file: <siteDataPath>/<identifier>.yaml.

With siteDataPath:

  • The extension reads and writes the site data only in the separate file.
  • The settings.yaml does not contain the site data. You can commit it.
  • Until the file contains values of the extension, the extension reads the site settings. The first write copies the values into the file.
  • Each write keeps the file permissions.

Without siteDataPath, the extension uses settings.yaml as before.


@sfsmfc
sfsmfc force-pushed the feature/analytics-site-data-file branch 2 times, most recently from 4288b6f to 7fdd8d3 Compare November 6, 2026 16:01
@sfsmfc
sfsmfc added this pull request to stack #45 November 6, 2026 17:18
@buchmarv
buchmarv self-requested a review November 11, 2026 07:41
Comment thread Classes/Service/SiteDataProvider.php Resolved
Comment thread Classes/Service/SiteDataStorage.php Resolved
Comment thread Documentation/Installation/Index.rst Resolved
@sfsmfc
sfsmfc requested a review from buchmarv November 11, 2026 15:19
Comment thread Build/UnitTestsBootstrap.php Resolved
Comment thread Classes/Service/SiteDataStorage.php Resolved
@sfsmfc
sfsmfc requested a review from buchmarv November 13, 2026 12:57
@sfsmfc
sfsmfc force-pushed the feature/analytics-site-data-file branch from c1b7435 to f215454 Compare November 18, 2026 09:26
@buchmarv

Copy link
Copy Markdown

I set the extension setting and tried to register a site that was not registered before.

Bildschirmfoto 2026-11-19 um 08 39 31

@buchmarv buchmarv left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

@sfsmfc

sfsmfc commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

@buchmarv I tested it yesterday with a fresh installation of TYPO3 v14.3.12, where siteDataPath = “config/analytics”, and it works perfectly. Have you perhaps included a ‘/’ at the very beginning? I’ve also added an import to the settings.yaml file with:

imports:

  • { resource: “../../analytics/main.yaml”, glob: true }

@buchmarv

Copy link
Copy Markdown

'siteDataPath' => 'config/analytics' in config/settings.php.
From a user perspective, setting it in the backend, then trying to register a site and receiving this error message is not quite understandable.
It doesn't work when i add the import either.

@andreaskienast andreaskienast left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR says "Allow a separate file", and the README.md states this:

By default, the extension writes sensitive data (credentials, tracking code and API keys) into config/sites/<identifier>/settings.yaml of each site. Do not commit this file to the repository.

Why don't we create the "separate file" directly when we register a new site?

Set siteDataPath to write the site data into a separate file.
The settings.yaml of each site must import this file.
The extension always reads the site data from the site settings.
Without siteDataPath, the extension uses settings.yaml as before.
- Read siteDataPath only from the extension configuration.
- Use the ExtensionConfiguration API and read the path one time.
- Remove the unused constant KEYS.
- Let get() return the value of any type. Add getString().
- Use the Locking API of TYPO3 for settings.yaml and the separate file.
- Recommend the separate file in the documentation.
With siteDataPath, the extension reads the data from the separate file.
The settings.yaml does not need an import.

The settings editor of the core wrote the imported values into
settings.yaml and removed the import. The values in settings.yaml
then had priority over the file.

Until the file contains values of the extension, the extension reads
the site settings. The first write copies the values of the extension
into the file.
Each write replaced the file and set the default permissions.
A restricted file became readable for the group again.
Remove the hints about imports. The extension does not use imports.
@sfsmfc
sfsmfc force-pushed the feature/analytics-site-data-file branch from e5832f3 to 25a7e6a Compare November 27, 2026 07:17
@sfsmfc

sfsmfc commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@buchmarv + @andreaskienast : You are right: the error message was not clear, and the import was an unnecessary step.

I removed the import. With siteDataPath, the extension now reads the site data directly from <siteDataPath>/<identifier>.yaml. The settings.yaml does not need any change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants