Skip to content

Commit 6c8c28f

Browse files
author
HugoFara
committed
feat!: LWT v3 Merge Summary
Overview This merge brings 395 commits representing a complete architectural overhaul of Learning with Texts. The changes span 1,997 files with a net reduction of ~114,000 lines of code through modernization and cleanup. Breaking Changes - Configuration: Replaced connect.php with .env file for database credentials - Table Prefix: Removed $tbpref global and all table prefix functionality - Build System: Frontend now uses Vite for bundling (requires npm run build:all) - Deprecated Functions: Removed all previously deprecated PHP functions - PHP Globals: Eliminated all superglobals and legacy global variables Major Features Multi-User Support - User authentication system with login pages - User-scoped data (words, texts, tags, languages) - Session security with secure cookies - Auth middleware for API protection Architecture Overhaul - Front controller pattern (index.php → Router → Controller → Service → View) - Dependency injection container - Repository pattern for data access - 17 new Controllers, 36 new Services - PSR-4 autoloading with Lwt\ namespace Frontend Modernization - Vite build system with HMR - TypeScript throughout (strict mode) - Alpine.js replacing jQuery for interactions - Lucide SVG icons replacing PNG icons - Bulma CSS framework Database & Security - All SQL queries converted to prepared statements - Fluent query builder API - Security middleware - Session hardening with secure cookies Changes by Category | Type | Count | |--------------------|-------| | Features | 29 | | Bug Fixes | 50 | | Refactoring/Chores | 243 | Files Changed by Type | Type | Files | Insertions | Deletions | |-------|-------|------------|-----------| | PHP | 424 | +111,864 | -41,029 | | JS/TS | 433 | +85,900 | -13,358 | | CSS | 87 | +4,076 | -10,364 | Migration Notes 1. Copy .env.example to .env and configure database credentials 2. Run composer install and npm install 3. Run npm run build:all to build frontend assets 4. Database migrations will run automatically on first access
2 parents 4ff53da + e42222d commit 6c8c28f

2,021 files changed

Lines changed: 234170 additions & 348623 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,5 @@ tools/*
1919
.git
2020
.gitignore
2121

22-
# MarkDown and PHP documentation generation
23-
Doxyfile
24-
2522
# Media files for LWT
2623
media/*

.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

.env.example

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# LWT Database Configuration
2+
# Copy this file to .env and update the values for your environment.
3+
4+
# Database server hostname or IP address
5+
# Examples:
6+
# localhost (default)
7+
# 127.0.0.1
8+
# localhost:8889 (for MAMP)
9+
DB_HOST=localhost
10+
11+
# Database username
12+
DB_USER=root
13+
14+
# Database password (leave empty for no password)
15+
DB_PASSWORD=
16+
17+
# Database name
18+
DB_NAME=learning-with-texts
19+
20+
# Database socket (optional, usually not needed)
21+
# Uncomment and set if your MySQL uses a non-standard socket
22+
# DB_SOCKET=/var/run/mysqld/mysqld.sock
23+
24+
# Multi-user mode (optional)
25+
# Set to true to enable user_id-based data isolation.
26+
# When enabled:
27+
# - Users must authenticate to access their data
28+
# - Each user's data is automatically filtered by user_id
29+
# - Table prefix-based isolation is replaced by user_id columns
30+
#
31+
# MULTI_USER_ENABLED=false

.gitignore

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# LWT specific files
22

3-
# Settings file
4-
connect.inc.php
5-
# Local audio files
6-
media/
3+
# Environment configuration (contains secrets)
4+
.env
5+
# Local audio files (root media directory only)
6+
/media/
77
# Text-to-Speech files
8-
tts/
8+
/tts/
99

1010
# Docker data
11-
lwt_db_data/
11+
/lwt_db_data/
1212

1313
# Dev files
1414

@@ -17,16 +17,21 @@ error.log
1717
access.log
1818
plugins
1919

20-
# Backup files (Doxygen)
20+
# Backup files
2121
*.bak
2222

23-
vendor/
23+
/vendor/
2424
.phpunit.result.cache
2525

2626
composer.phar
2727

2828
# JS unit testing and documentation
29-
node_modules/
29+
/node_modules/
30+
31+
# Vite build outputs (regenerated by npm run build)
32+
/assets/.vite/
33+
/assets/js/vite/
34+
/assets/css/vite/
3035

3136
# Editor
3237
.vscode
@@ -44,5 +49,11 @@ tools/*
4449
.phpdoc/*
4550

4651
# PHPUnit coverage reports
47-
coverage-report/
52+
/coverage-report/
4853
coverage.xml
54+
55+
# Vitest coverage report
56+
/coverage/
57+
58+
# Cypress coverage
59+
/cypress/

.htaccess

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# LWT Front Controller - Apache Configuration
2+
# This file enables clean URLs and routes all requests through index.php
3+
4+
<IfModule mod_rewrite.c>
5+
RewriteEngine On
6+
RewriteBase /
7+
8+
# Deny access to sensitive files
9+
<FilesMatch "^(connect\.inc\.php|composer\.json|composer\.lock|\.env)$">
10+
Require all denied
11+
</FilesMatch>
12+
13+
# Legacy asset redirects (for backward compatibility, can remove in future)
14+
RedirectMatch 301 ^/icn/(.*)$ /assets/icons/$1
15+
RedirectMatch 301 ^/img/(.*)$ /assets/images/$1
16+
RedirectMatch 301 ^/iui/(.*)$ /assets/vendor/iui/$1
17+
RedirectMatch 301 ^/css/(.*)$ /assets/css/$1
18+
RedirectMatch 301 ^/js/(.*)$ /assets/js/$1
19+
RedirectMatch 301 ^/themes/(.*)$ /assets/themes/$1
20+
RedirectMatch 301 ^/sounds/(.*)$ /assets/sounds/$1
21+
22+
# Allow direct access to assets (CSS, JS, images, fonts)
23+
RewriteCond %{REQUEST_FILENAME} -f
24+
RewriteCond %{REQUEST_URI} \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|map)$ [NC]
25+
RewriteRule ^ - [L]
26+
27+
# Allow direct access to existing files (for backward compatibility)
28+
# This allows migrated .php files to still be accessed directly
29+
RewriteCond %{REQUEST_FILENAME} -f
30+
RewriteRule ^ - [L]
31+
32+
# Route everything else through index.php
33+
RewriteCond %{REQUEST_FILENAME} !-f
34+
RewriteCond %{REQUEST_FILENAME} !-d
35+
RewriteRule ^ index.php [QSA,L]
36+
</IfModule>
37+
38+
# Disable directory listings
39+
Options -Indexes
40+
41+
# Set default charset
42+
AddDefaultCharset UTF-8
43+
44+
# Enable GZIP compression (optional, for better performance)
45+
<IfModule mod_deflate.c>
46+
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
47+
</IfModule>
48+
49+
# Set cache headers for static assets (optional)
50+
<IfModule mod_expires.c>
51+
ExpiresActive On
52+
ExpiresByType image/jpg "access plus 1 year"
53+
ExpiresByType image/jpeg "access plus 1 year"
54+
ExpiresByType image/gif "access plus 1 year"
55+
ExpiresByType image/png "access plus 1 year"
56+
ExpiresByType image/svg+xml "access plus 1 year"
57+
ExpiresByType text/css "access plus 1 month"
58+
ExpiresByType application/javascript "access plus 1 month"
59+
ExpiresByType image/x-icon "access plus 1 year"
60+
</IfModule>

0 commit comments

Comments
 (0)