Course-Pack Authoring & Sync Guide — LightPath Training Portal¶
Scope: Declarative course registration (config/courses.php), source directory conventions, Markdown & Quiz parsing rules, 7-pillar Qualiopi labs, Retina Mermaid & Studio Slide caching, and packaging CLI tools.
1. Declarative Course Registry¶
Courses are registered declaratively in config/courses.php and merged at runtime with optional custom courses persisted in custom_courses.json (toggleCustomCourse, deleteCustomCourse).
Per-Course Feature Overrides (FeatureManager)¶
While config/features.php defines 10 global modular flags and 4 deployment profiles (full_enterprise, classroom_workshop, exam_lockdown, static_hosting_nodocker), administrators can override individual flags per course slug (FeatureManager::setCourseOverrides(), FeatureManager::clearCourseOverrides(), FeatureManager::isEnabledForCourse()):
- Useful when hosting a theoretical/non-Docker course alongside PostgreSQL 18 (docker_labs => false, automatically disabling dependent chaos_engineering via 'requires' => ['docker_labs']), or selectively tailoring personal_notes and flashcards_srs per curriculum.
- Configured in Administration -> Système (action=admin_save_course_features) and exportable/importable as JSON (exportConfigJson() / importConfigJson()).
Track Schema (config/courses.php)¶
Each course entry defines:
- Top-level metadata (slug, title, subtitle, duration, level, icon, docker_enabled, source_root, pgscripts_root, description).
- tracks: Ordered associative map of certification tracks. For the flagship 'postgresql-18' course pack:
- 'cursus-complet': Modules 01–20 (JOUR 1..JOUR 5, 35h–42h)
- 'performance-tuning': Modules 21–25 (ÉTAPE 1..ÉTAPE 3)
- 'ingenierie-specialisee': Modules 26–29 (VOLET 1..VOLET 2)
- 'fondamentaux-sql': Modules sql_01–sql_05 (SOCLE 1..SOCLE 2)
- Track keys use normalized 'module_filter' arrays (with fallback support in CourseRepository and templates for legacy 'module_Filter').
2. Canonical Course-Pack Directory Layout¶
When pointing source_root to a LightPath course repository (e.g., ../training_postgresql), CourseRepository.php discovers artifacts across deterministic subdirectories:
| Directory | Contents & Discovery Pattern |
|---|---|
01_programme_et_referentiel/ |
Qualiopi syllabus, evaluation grids, trainer guides (referentiel index) |
03_supports_de_cours/ |
Module source Markdown files (module_XX_*.md, module_sql_XX_*.md), .pptx & _slides.pdf Studio decks |
04_ateliers_et_tp/ |
Practical lab Markdown guides (lab_XX_*.md, lab_sql_XX_*.md) |
05_cheatsheets/ |
Printable reference cheatsheets (69 items in PG18 pack) |
pgexamples/ |
Multi-language PostgreSQL client examples (Python, Go, PHP) |
pgscripts/ (configurable via pgscripts_root) |
Pure-Python DBA diagnostic & benchmark toolkit (35 scripts) with dual documentation (README.md, README_fr.md) |
video_engine/output/ |
Module MP4 video lessons streamed via HTTP 206 Partial Content and companion .md transcripts |
assets/ |
Self-hosted diagrams, logos, and assets/mermaid_cache/mermaid_<hash>.png |
3. Markdown Course Authoring Rules¶
MarkdownParser.php compiles Markdown on demand and caches parsed structures in storage/data/parsed_cache/.
Supported Extensions & Directives¶
- GitHub Callout Alerts: Rendered into styled
.lms-callout-*cards with distinct accents: [!IMPORTANT]->Important — Exigence Critique[!WARNING]->Attention — Point de Vigilance[!CAUTION]->Précaution Majeure en Production[!TIP]->Astuce & Bonne Pratique DBA[!NOTE]->Information Technique- Inline SQL Workbench Injection: Code fences tagged
sqlexpose an "Exécuter dans le Lab" button carrying UTF-8 Base64 payloads decoded safely inpublic/assets/js/app.jsusingTextDecoder. - Quiz QCM Extraction:
MarkdownParser::extractQuizQuestions()parses quiz sections inside each module Markdown file soapi_submit_quizgrades learner answers server-side against canonical keys. - Inline HTML Preview CSP Isolation: Standalone compiled
.htmlcourse files rendered inside LMS iframes (?action=course_asset/DownloadController::streamFile()) emitSecurity::sendStandaloneDocumentCspHeader()(style-src 'self' 'unsafe-inline'scoped strictly to standalone documents), whereas main LMS portal routes enforce zero-inline-stylestyle-src 'self'(P1-6resolved). - Mermaid Diagrams (
renderMermaidBlock): - Whitespace-normalizes the Mermaid source and computes
substr(hash('sha256', $normalized), 0, 16). - Checks for a pre-rendered Retina 2x PNG at
$sourceRoot/assets/mermaid_cache/mermaid_<hash>.pnginside the active course pack and serves it (zoomable in the lightbox modal) viaresolveAssetUrl()or the?action=course_asset&course=...&path=...controller fallback. - Falls back cleanly to local
public/assets/mermaid.min.jsSVG rendering when no PNG cache matches (zero external CDNs). - Always quote Mermaid node labels containing parentheses or brackets (e.g.,
id["Node (Detail)"]) to guarantee valid parsing.
LaTeX Math Integrity Policy (When Authoring Technical Formulas)¶
Follow these five rules whenever formulas appear in course or portal Markdown:
1. Place display math $$ at column 0 (never indented inside lists) with blank lines before and after.
2. Restrict LaTeX operators strictly to standard built-ins (\arg\max, \arg\min, and \text{...}); never emit non-standard custom operator macros blocked by MathJax/KaTeX.
3. Preserve all subscript underscores (_) and superscript asterisks (*) with explicit indices (\sum_{i=1}^n).
4. Keep inline math tight ($x$, never $ x $) and escape prose currency/shell $ (\$100 or backticks).
5. Verify math spans remain unmodified across edits.
4. Authoring 7-Pillar Qualiopi Labs¶
Every practical lab in 04_ateliers_et_tp/ must conform to LightPath's 7 Qualiopi Pillars:
1. Metadata & Bloom Level: Lab ID, timed duration, Bloom cognitive objective.
2. Prerequisites & Idempotent Setup: Target instance and repeatable seed baseline.
3. Real-World Production Scenario: E-commerce, banking, logistics, or Sakila/Pagila rental workflows (no trivial foo/bar tables).
4. Step-by-Step Instructions: Explicit context boundaries (Bash vs psql vs Python).
5. Expected Outputs & Reference Plans: Console outputs and reference EXPLAIN plans.
6. Automated Validation Oracle: Deterministic SQL/DO block confirming completion (VALIDATION_OK / boolean pass).
7. Solution & REX Debriefing: Production insights, common pitfalls, and DBA field experience.
How MarkdownParser::splitLabEnonceAndCorrige() Works¶
- Challenge Spoilers: Solution blocks preceded by bulleted markers (
**Requête Solution :**,**Commandes Solutions :**,**Solutions Analytiques :**,**Corrigés Techniques :**,**Corrigés SQL :**, etc.) are wrapped in collapsible<details>elements in full view and grouped in the Corrigé tab. - Section Split: The lab splits automatically into Énoncé and Corrigé at the first
H2matching## Corrigé,## Commande de Validation,## Script de Validation,## Validation Automatisée, or## Solution(with optional leading step number), while preserving any"🌟 Pour Aller Plus Loin"section inside the Énoncé. - Trainer Solution Lock: When a trainer activates
lock_solutionsin Classroom Broadcast (or applies theexam_lockdown/lecturepreset), public/index.php and the modularLabApiController/LearnerControllerdispatch strip Corrigé tabs and disableapi_run_lab_solutionfor non-staff learners. - 34-Lab Readiness & Interactive Workbench: Every lab (
01..29,sql_01..sql_05) is mapped inLabSqlRunner::checkLabReadiness()(api_lab_readiness/php bin/lab-runner.php readiness <uid> <lab_id>) against its target database (dvdrentalvsformation_pg), required PG18 extensions, container status, and deterministic SQL oracle (getLabOracles()), alongside per-user sandbox savepoints (api_lab_savepoint), boundedpgbenchruns (api_lab_pgbench), live PG18 diagnostics (api_lab_pg_diag), andCtrl+EnterSQL execution.
5. Slide Export & Course Packaging CLIs¶
Export Studio 16:9 Slide Caches (bin/export_slides_cache.py)¶
Generates public/assets/slides_cache/<module_id>/slide_001.png..slide_NNN.png plus manifest.json by aligning PDF slide text metadata 1:1 with PowerPoint speaker notes (135 DPI PNGs):
- Slides are categorized into
title,objectives,concept,summary,quiz, andlabtypes and displayed in the interactive slide carousel inside module reader pages. - Note: MarkdownParser::parseModuleFile() checks
$manifestMtimeonpublic/assets/slides_cache/<module_id>/manifest.jsonso updated slide decks invalidate module caches automatically.
Sync & Package Course Metadata (bin/sync-course.php)¶
- Sanitizes
<course-slug>(preg_replace('/[^a-zA-Z0-9_\-]/', '', ...), defaulting topostgresql-18), verifies<source-directory>exists, and writesstorage/courses/<slug>/manifest.json.
Catalog Cache Invalidation¶
CourseRepository::computeCatalogFingerprint()tracks directory/file modification timestamps under fingerprint prefixv8_rca164.- Administrators can trigger
CourseRepository::clearCatalogCache(): intfrom Administration -> Système (action=admin_clear_cache) to flushcatalog_cache_*.jsonfiles and inspect the removed file count in the audit trail.