Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Permalink / Version switch resolving #835

Open
garvinhicking opened this issue Nov 19, 2024 · 0 comments
Open

Improve Permalink / Version switch resolving #835

garvinhicking opened this issue Nov 19, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed refactoring refactoring

Comments

@garvinhicking
Copy link
Contributor

We have an objects.inv.json file for each render documentation artifact. This is great. It allows us to use the intercept legacy_hook permalink tool (see TYPO3GmbH/site-intercept#207).

It has disadvantages though: It only operates on a specific file of only one exact language+version+repository. We cannot use it to iterate on all versions of a rendered artifact.

Thus, we need a central index/database of all deployed documentation repositories. An SQLite database has little dependencies and can handle the amount of data we're having.

We need:

  • An indexer that reads the objects.inv.json file of a rendered artifact, which writes the metadata into a SQLite database table
  • An addition to the github ci_deploy GitHub Action (https://github.com/TYPO3-Documentation/t3docs-ci-deploy/blob/main/.github/workflows/main-rendering.yml): After deployment, the deployed objects.inv.json file needs to be updated in the SQLite database. This way we do not need timed process.
  • Additionally, a cronjob/task that can be run to regenerate ALL existing objects.inv.json files of the docs.typo3.org document root into the database. This can be used if ever the SQLite data gets corrupted, and for the initial creation of this
  • A script that offers a JSON endpoint API to retrieve specific metadata:
    • All versions of a specific repository,
    • all manuals of a specific subdirectory,
    • all permalinks of a specific version of a specific repository
    • all permalinks of all versions of a specific repository
    • all languages of a specific repository
  • The permalink tool should be adapted to fetch data from the SQLite database (instead of resolving an objects.inv.json file)
  • The version switch tool needs to be adapted to fetch data from the SQLite database

Database schema

We probably need these tables:

repositories

  • uid
  • repository
  • URL
  • version
  • language

permalinks

  • repositoryUid
  • anchor
  • target

This would yield records like:

# Used to lookup repositories and versions
,repositories
,repository, URL, version, language
,1,'render-guides', 'https://docs.typo3.org/other/t3docs/render-guides/main/en-us/', 'main', 'en-us'
,2,'render-guides', 'https://docs.typo3.org/other/t3docs/render-guides/0.19/en-us/', '0.19', 'en-us'
,3,'render-guides', 'https://docs.typo3.org/other/t3docs/render-guides/0.19/de-de/', '0.19', 'de-de'
# Other inventories will use the composer-key as repository name ("georgringer/news")
# Contains all the permalinks
,permalinks
,repositoryUid,anchor,target
,1,'start','/Index.html'
,2,'start','/Index.html'
,3,'start','/Index.html'
,4,'getting-started','/GettingStarted/Index.html'

Permalink resolving

Link: https://docs.typo3.org/permalink/render-guides:start@stable

SELECT p.target 
  FROM permalinks AS p 
  JOIN repositories AS r ON r.uid = p.repositoryUid
 WHERE r.repository = 'render-guides' 
   AND r.version = 'stable'
   AND r.language = 'en-us'
   AND p.anchor = 'start'

Version resolving

Link: https://docs.typo3.org/versions/en-us/render-guides

SELECT r.version
  FROM repositories AS r
 WHERE r.repository = 'render-guides' 
   AND r.language = 'en-us'

Details tbd. A lookup should probably still use Symfony Caching for the incoming URL request, needs language/version fallbacks etc.

@garvinhicking garvinhicking added enhancement New feature or request help wanted Extra attention is needed refactoring refactoring labels Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed refactoring refactoring
Projects
None yet
Development

No branches or pull requests

1 participant