hda/t3up 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hda/t3up

Composer 安装命令:

composer require hda/t3up

包简介

T3UP - Basic Installation

README 文档

README

Changelog

  • 2025-08-01

    • t3up-table, t3up-onepager und t3up-image sind integriert.
    • Google Icons — Material Symbols ersetzt Font Awesome. Varianten: filled / outline. Klassenbeispiele: .symbol, .symbol-outline.
    • Social-Media-Elemente nutzen .brands und verwenden FFFontawesome Brands.
  • 2025-08-21

    • Material im RTE integriert.
    • Symbolic link for fonts added (see Commands).
  • 2025-08-25

    • In the public/ folder there should be a symlink to ../vendor/hda/t3up/Resources/Public/Fonts.
  • 2025-10-01

    • New fonts inside Merriweather Sans and Merriweather.

Commands

This extension provides two console commands to help with local setup and debugging.

1) Create Fonts Symlink

Creates a symlink public/Fontsvendor/hda/t3up/Resources/Public/Fonts.

  • Command name: t3up:symlink:fonts
  • Alias: t:s:f
  • Description: Create a symlink in public/ that points to vendor/hda/t3up/Resources/Public/Fonts.
  • Behavior:
    • Verifies that the target folder exists.
    • If public/Fonts is an existing symlink it will be removed and recreated.
    • If public/Fonts is a real file/directory the command refuses to overwrite and asks for manual removal (to avoid accidental data loss).
  • Usage (from project root):
    vendor/bin/typo3 t3up:symlink:fonts
    

    or alias

    vendor/bin/typo3 t3up:s:f
    

2) Debug Container Command

Lists services from the DI container, optionally filtered by a string.

  • Command name: t3up:debug:container
  • Alias: t3up:d:c
  • Argument: optional filter (string) — filters service ids (case insensitive).

Usage

  # list all services
  vendor/bin/typo3 t3up:debug:container
  # filtered (e.g. match "Repository")
  vendor/bin/typo3 t3up:debug:container Repository
  # using alias
  vendor/bin/typo3 t3up:d:c Repository

3) Update TypoScript Constants (main command)

Command name: t3up:update:constants

Description: Apply predefined TypoScript constant presets to sys_template (modes: default | up | imp).

This command (Hda\T3up\Command\UpdateTypoScriptConstantsCommand) is designed to automatically apply or update TypoScript constant presets in sys_template.constants.

Purpose

  • Programmatically apply groups of TypoScript constant key/value pairs (presets) to TYPO3 sys_template.constants.
  • A quick way to switch site presets (colors, header/footer wrappers, top bar config, social links, components, site config flags, and more).

High-level behavior

  • Presets are grouped by category (e.g., color, fonts, footer, header, socialmedia, etc.).
  • Each category can provide up to three arrays:
    • PRESET_<CAT>_DEFAULT
    • PRESET_<CAT>_UP
    • PRESET_<CAT>_IMP
  • Final key/value pairs are built according to the selected mode:
    • default: PRESET_*_DEFAULT only.
    • up: PRESET_*_DEFAULT + PRESET_*_UP (keys in UP override DEFAULT).
    • imp: PRESET_*_DEFAULT + PRESET_*_IMP (keys in IMP override DEFAULT).
  • For each selected sys_template record:
    • Existing keys in constants are replaced (line-based regex).
    • Keys absent in the template are inserted only if --force is used; otherwise, they are reported as skipped.
    • A line-level diff preview (oldnew) is printed before any DB write.
    • --dry-run shows the preview but does not write to the database.

Merge precedence (important)

  • Implementation uses array_merge($pairs, $defaultConst, $upConst), etc.
  • In PHP, array_merge with associative keys means later arrays override earlier ones: array_merge($a, $b, $c) means keys in $c override $b and $a when identical.
  • Therefore, in --mode up, the UP values win for colliding keys; in --mode imp, the IMP values win.

Alias

    vendor/bin/typo3 t3up:u:c

Options & usage (copyable)

    vendor/bin/typo3 t3up:update:constants [--uid=<UID>...] [--category=<cat>...] [--mode=<default|up|imp>] [--dry-run] [--force]
  • --uid (optional, repeatable) — UID(s) of sys_template records to update. If omitted, templates with root = 1 are targeted.
    • Update a single template by UID:
        vendor/bin/typo3 t3up:update:constants --uid 2 --mode up
      
    • Update multiple templates:
        vendor/bin/typo3 t3up:update:constants --uid 2 --uid 3 --mode up
      
  • --category, -c (optional, repeatable) — Which preset categories to apply. If omitted, all categories are applied.
    • Only apply color and header presets:
        vendor/bin/typo3 t3up:update:constants -c color -c header --mode imp
      
  • --mode, -m (optional) — default | up | imp. Default is default.
      vendor/bin/typo3 t3up:update:constants --mode up
    
  • --dry-run, -dr — Show preview only; do not write to the DB.
      vendor/bin/typo3 t3up:update:constants --mode up --dry-run
    
  • --force, -f — Insert keys that do not exist in the template (otherwise, missing keys are skipped and reported).
      vendor/bin/typo3 t3up:update:constants --mode imp --force
    

Full multi-example (copyable)

  1. Preview all categories in UP mode for root template(s):
    vendor/bin/typo3 t3up:update:constants --mode up --dry-run
    
  2. Apply color + fonts for template UID 10, insert missing keys:
    vendor/bin/typo3 t3up:update:constants --uid 10 --category color --category fonts --mode up --force
    
  3. Apply IMP presets for multiple templates:
    vendor/bin/typo3 t3up:update:constants --uid 2 --uid 3 --mode imp
    

Categories (valid values for --category)

color, typography, fonts, footer, header, navigation, top, totop, socialmedia, breadcrumb, components, design, config, plugins, styles

Implementation details (what gets changed)

  • Reads the constants field from selected sys_template rows.
  • For each preset key, it looks for a line matching ^(\s*KEY\s*=\s*)(.*)$ and replaces that whole line with KEY = value.
  • If the key is missing:
    • With --force, the key/value is appended to the end of the constants string.
    • Without --force, the key is added to skipped and reported.
  • A diff preview is shown; the new constants string is written back only when not in --dry-run.

Safety & best-practices

  • Always run a dry-run first:
      vendor/bin/typo3 t3up:update:constants --mode up --dry-run
    
  • Backup sys_template (or the whole DB) before writing:
    • Example: Dump sys_template table (adjust for your DB)
      mysqldump -u dbuser -p dbname sys_template > /tmp/sys_template.sql
      
  • Inspect the printed diff before confirming.
  • Use --force only if you are certain the inserted keys are intended.
  • To revert, restore from your DB backup.

4) Content Spacing Update

  • Command name: t3up:update:spacing

  • Description:

Ersetzt alte px-Abstände (wie 16px, 8px usw.) in den Feldern space_before_class, space_after_class, padding_before_class und padding_after_class durch numerische Klassen, basierend auf einem festgelegten Mapping.

  • Usage:
    vendor/bin/typo3 t3up:update:spacing
  • Alias:
    vendor/bin/typo3 t3up:u:s
  • Mapping:
  • 16px / 20px6

  • 12px5

  • 8px3

  • (Das vollständige Mapping ist in der Extension definiert.)

5) Set Owner & Permissions (rekursiv)

  • Command name: t3up:set:owner-perms

  • Description:

Setzt owner/group www-data und sinnvolle Rechte rekursiv. Standard: Dry‑run — zeigt an, was passieren würde. Mit --force werden Änderungen ausgeführt.

  • Options:
  • --path: Zielpfad (default: Projektroot)

  • --force, -f: Änderungen anwenden

  • --skip-errors: Fehler sammeln und weitermachen (nicht abbrechen)

  • Usage:

    # Dry-run
    vendor/bin/typo3 t3up:set:owner-perms
    
    # Apply on project root
    vendor/bin/typo3 t3up:set:owner-perms --force
    
    # Apply on custom path and continue on errors
    vendor/bin/typo3 t3up:set:owner-perms --force --path=/var/www/html/site --skip-errors
    
  • Verhaltensdetails:

  • Directories: 0755

  • Files: 0644 (ausführbare Dateien behalten 0755)

  • Owner/Group: www-data (chown/chgrp)

  • Warnung: chown/chgrp funktionieren nur mit entsprechenden Rechten — auf Shared-Hosting oft nicht verfügbar.

6) Convert List Type

# Trockenlauf (zeigt nur, was passieren würde)
vendor/bin/typo3 t3up:convert:listtypes --dry-run
# Tatsächliches Ausführen (wendet Änderungen an)
vendor/bin/typo3 t3up:convert:listtypes

Option

--dry-run

Zeigt die Anzahl gefundener Einträge und die geplanten Änderungen, führt aber keine Updates aus.

Wo die Mappings stehen

Die Mappings werden in der Klasse selbst definiert in der Konstante C_TYPE_AND_LIST_TYPE_MAPPINGS. Struktur (vereinfachtes Beispiel):

private const C_TYPE_AND_LIST_TYPE_MAPPINGS = [
    [
        'CType' => ['buttons' => 'hda_buttonbox'],
        'list_type' => [],                // nur CType
    ],
    [
        'CType' => ['list' => 'news_newsliststicky'],
        'list_type' => ['news_pi1' => 'news_pi1'], // CType × list_type kombiniert
    ],
];

7) Run helper commands to update project to TYPO3 v13.

  • Command name: t3up:update:to13
  • Alias: t3up:u:13

  • Description:

Führt alle oben gelisteten Commands sequenziell aus. Runs: symlink:fonts, update:constants, adjust-colpos, update-spacing, set:owner-perms in dieser Reihenfolge.

  • Options:
  • --force, -s
  • --dry-run, -d

  • --path, -p: weitergeleitet zu t3up:set:owner-perms

  • --continue-on-error, -c: continue even if a step fails

  • Usage:

    Dry-run owner perms

    vendor/bin/typo3 t3up:update:to13 --dry-run
    

    use force

    vendor/bin/typo3 t3up:update:to13 --force
    

    force and pass path

    vendor/bin/typo3 t3up:update:to13 --force --path=/var/www/html/site
    

t3up:convert:layouts

Was es macht Dieser Symfony/TYPO3-Console-Command durchsucht die Tabelle pages in den Spalten backend_layout und backend_layout_next_level nach Einträgen der Form pagets und ersetzt sie gemäß vordefinierter Mappings durch pagets. Der Command zählt zuerst die betroffenen Zeilen, schreibt die geplanten Änderungen in die Konsole und führt anschließend (oder im Dry-Run nur simuliert) die Updates aus.

Features

Prüft beide Spalten: backend_layout und backend_layout_next_level.

Zeigt Anzahl gefundener und aktualisierter Zeilen an.

Unterstützt --dry-run (zeigt, was geändert würde, ohne die DB zu verändern).

Fängt Fehler beim Update ab und gibt Fehlermeldungen in die Konsole.

Mappings

Quelle (alt) Ziel (neu)

pagets__RightMarginalLayout     ->	pagets__RightMarginal
pagets__OneColumnLayout         ->	pagets__OneColumn
pagets__StandardLayout          ->	pagets__Standard
pagets__RightNavigationLayout   ->	pagets__RightNavigation
pagets__LeftNavigationLayout    ->	pagets__LeftNavigation
pagets__OnePagerLayout          ->	pagets__OnePager
pagets__DefaultLayout           ->	pagets__Default

Dry-Run (Nur Anzeige, keine Änderungen):

vendor/bin/typo3 t3up:convert:layouts --dry-run

Tatsächliches Ausführen (Änderungen werden geschrieben):

vendor/bin/typo3 t3up:convert:layouts

hda/t3up 适用场景与选型建议

hda/t3up 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 100 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「extension」 「t3up」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 hda/t3up 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 hda/t3up 我们能提供哪些服务?
定制开发 / 二次开发

基于 hda/t3up 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 100
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 23
  • 依赖项目数: 7
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2025-07-08