feat: extract MediaController, wire into Dispatcher, delete media.php

This commit is contained in:
Pontoporeia
2026-04-17 11:44:08 +02:00
parent b03be51b92
commit 75f808bee4
157 changed files with 1713 additions and 452 deletions

View File

@@ -13,7 +13,7 @@ setup:
[group('dev')]
serve: migrate
@php -S 127.0.0.1:8000 -t public/ config/router.php 2>&1 | stdbuf -oL grep -E '(Development Server|\[200\])' | stdbuf -oL grep -v 'live-reload\.php' || true
@php -S 127.0.0.1:8000 -t app/public/ app/router.php 2>&1 | stdbuf -oL grep -E '(Development Server|\[200\])' | stdbuf -oL grep -v 'live-reload\.php' || true
[group('dev')]
stop:
@@ -29,7 +29,7 @@ logs:
[group('deploy')]
deploy:
rsync -vur --progress \
rsync -vur --progress --delete \
--chown="www-data:posterg" \
--exclude 'vendor' \
--exclude 'tests' \
@@ -44,13 +44,9 @@ deploy:
--exclude 'storage/cache/*' \
--exclude 'storage/fixtures' \
--exclude 'storage/docs' \
--exclude 'nginx' \
--exclude 'docs' \
--exclude 'justfile*' \
--exclude 'scripts' \
--exclude 'var/cache/*' \
--exclude 'var/logs/*' \
./ posterg:/var/www/posterg/
app/ posterg:/var/www/posterg/
ssh posterg "mkdir -p /var/www/posterg/var/{cache,logs,tmp}"
[group('deploy')]
@@ -85,7 +81,7 @@ deploy-nginx:
[group('deploy')]
deploy-db:
@ssh posterg '[ ! -f /var/www/posterg/storage/test.db ]' || (echo "ERROR: remote database already exists. Remove it manually if you intend to overwrite." && exit 1)
rsync -v --progress ./storage/test.db posterg:/var/www/posterg/storage/test.db
rsync -v --progress app/storage/test.db posterg:/var/www/posterg/storage/test.db
ssh posterg "chown www-data:posterg /var/www/posterg/storage/test.db && chmod 660 /var/www/posterg/storage/test.db"
# ============================================================================
@@ -94,27 +90,25 @@ deploy-db:
[group('test')]
test:
@DB_ENV=test php tests/run-tests.php
@DB_ENV=test php app/tests/run-tests.php
[group('test')]
test-unit:
@DB_ENV=test php tests/Unit/DatabaseTest.php
@DB_ENV=test php tests/Unit/RateLimitTest.php
@DB_ENV=test php app/tests/Unit/DatabaseTest.php
@DB_ENV=test php app/tests/Unit/RateLimitTest.php
[group('test')]
test-integration:
@DB_ENV=test php tests/Integration/SearchTest.php
@DB_ENV=test php app/tests/Integration/SearchTest.php
[group('test')]
test-security:
@DB_ENV=test php tests/Security/SecurityTest.php
@DB_ENV=test php app/tests/Security/SecurityTest.php
[group('test')]
syntax:
@find . -maxdepth 1 -name "*.php" -not -path "./vendor/*" -exec php -l {} \; | grep -v "No syntax errors"
@find admin/ -name "*.php" -exec php -l {} \; 2>/dev/null | grep -v "No syntax errors" || true
@find src/ -name "*.php" -exec php -l {} \; | grep -v "No syntax errors"
@echo "✅ Syntax OK"
@find app/ -name '*.php' -exec php -l {} \; 2>/dev/null | grep -v 'No syntax errors' || true
@echo '✅ Syntax OK'
# ============================================================================
# Database
@@ -135,29 +129,29 @@ migrate-prod:
[group('database')]
init-db:
@sqlite3 storage/test.db < storage/schema.sql
@sqlite3 storage/test.db "SELECT COUNT(*) || ' tables' FROM sqlite_master WHERE type='table';"
@sqlite3 app/storage/test.db < app/storage/schema.sql
@sqlite3 app/storage/test.db "SELECT COUNT(*) || ' tables' FROM sqlite_master WHERE type='table';"
[group('database')]
reset-db:
@rm -f storage/test.db
@rm -f app/storage/test.db
@just init-db
[group('database')]
query:
@sqlite3 storage/test.db
@sqlite3 app/storage/test.db
[group('database')]
show id:
@sqlite3 -column -header storage/test.db "SELECT * FROM v_theses_full WHERE id = {{id}};"
@sqlite3 -column -header app/storage/test.db "SELECT * FROM v_theses_full WHERE id = {{id}};";
[group('database')]
backup:
@sqlite3 storage/test.db .dump > storage/backup_$(date +%Y%m%d_%H%M%S).sql
@sqlite3 app/storage/test.db .dump > app/storage/backup_$(date +%Y%m%d_%H%M%S).sql
[group('database')]
fixtures:
@php storage/fixtures/CreateTestDatabase.php
@php app/storage/fixtures/CreateTestDatabase.php
# ============================================================================
# Utils
@@ -165,11 +159,11 @@ fixtures:
[group('utils')]
clean:
@rm -f error.log admin/error.log
@rm -rf src/cache/rate_limit/*
@rm -f app/error.log
@rm -rf app/storage/cache/rate_limit/*
@rm -f /tmp/posterg-*.log /tmp/posterg-*.pid
[group('utils')]
setup-dirs:
@mkdir -p admin/data/{theses,covers,yaml} src/cache/rate_limit
@touch admin/data/theses/.gitkeep admin/data/covers/.gitkeep
@mkdir -p app/storage/cache/rate_limit
@touch app/storage/cache/rate_limit/.gitkeep