From 5e8fdf80684632e03b5ec3436782064378bccdd4 Mon Sep 17 00:00:00 2001 From: WOBBLEFANG THE THIRD Date: Sun, 19 Apr 2026 22:12:52 +0200 Subject: [PATCH] clear :3 --- .env | 9 ------ Dockerfile | 13 --------- compose.yaml | 30 -------------------- docker/apache.conf | 14 ---------- public/index.php | 27 ------------------ src/Controllers/HomeController.php | 24 ---------------- src/Database.php | 32 --------------------- src/View.php | 20 ------------- src/ViewModels/HomeData.php | 11 -------- src/Views/home.php | 19 ------------- src/migrations.php | 27 ------------------ src/seeds.php | 45 ------------------------------ 12 files changed, 271 deletions(-) delete mode 100644 .env delete mode 100644 Dockerfile delete mode 100644 compose.yaml delete mode 100644 docker/apache.conf delete mode 100644 public/index.php delete mode 100644 src/Controllers/HomeController.php delete mode 100644 src/Database.php delete mode 100644 src/View.php delete mode 100644 src/ViewModels/HomeData.php delete mode 100644 src/Views/home.php delete mode 100644 src/migrations.php delete mode 100644 src/seeds.php diff --git a/.env b/.env deleted file mode 100644 index 60996c7..0000000 --- a/.env +++ /dev/null @@ -1,9 +0,0 @@ -# Database -DB_HOST=database -DB_NAME=pawra -DB_USER=appuser -DB_PASSWORD=pick-a-real-password-here -DB_ROOT_PASSWORD=pick-another-real-password - -# App -APP_ENV=development \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index c0cafa6..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM php:8.3-apache - -RUN a2enmod rewrite - -RUN docker-php-ext-install pdo_mysql - -COPY docker/apache.conf /etc/apache2/sites-available/000-default.conf - -COPY . /var/www/html - -RUN chown -R www-data:www-data /var/www/html - -WORKDIR /var/www/html \ No newline at end of file diff --git a/compose.yaml b/compose.yaml deleted file mode 100644 index 7fa99d9..0000000 --- a/compose.yaml +++ /dev/null @@ -1,30 +0,0 @@ -services: - server: - build: . - restart: always - ports: - - "8080:80" - volumes: - - ".:/var/www/html" - environment: - - DB_HOST=${DB_HOST} - - DB_NAME=${DB_NAME} - - DB_USER=${DB_USER} - - DB_PASSWORD=${DB_PASSWORD} - depends_on: - database: - condition: service_healthy - - database: - image: mariadb:lts - restart: always - environment: - MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} - MARIADB_DATABASE: ${DB_NAME} - MARIADB_USER: ${DB_USER} - MARIADB_PASSWORD: ${DB_PASSWORD} - healthcheck: - test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] - interval: 10s - timeout: 5s - retries: 5 \ No newline at end of file diff --git a/docker/apache.conf b/docker/apache.conf deleted file mode 100644 index 2d26a7a..0000000 --- a/docker/apache.conf +++ /dev/null @@ -1,14 +0,0 @@ - - DocumentRoot /var/www/html/public - - PassEnv DB_HOST DB_NAME DB_USER DB_PASSWORD - - - AllowOverride All - Require all granted - Options -Indexes - - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - \ No newline at end of file diff --git a/public/index.php b/public/index.php deleted file mode 100644 index 7b0f6f9..0000000 --- a/public/index.php +++ /dev/null @@ -1,27 +0,0 @@ -index(); -} \ No newline at end of file diff --git a/src/Controllers/HomeController.php b/src/Controllers/HomeController.php deleted file mode 100644 index 59a7c32..0000000 --- a/src/Controllers/HomeController.php +++ /dev/null @@ -1,24 +0,0 @@ -db->query("SELECT * FROM posts LIMIT 10")->fetchAll() - ); - - View::render('home', $data); - } -} \ No newline at end of file diff --git a/src/Database.php b/src/Database.php deleted file mode 100644 index eb457bd..0000000 --- a/src/Database.php +++ /dev/null @@ -1,32 +0,0 @@ - PDO::ERRMODE_EXCEPTION, - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - ] - ); - } - return self::$instance; - } -} \ No newline at end of file diff --git a/src/View.php b/src/View.php deleted file mode 100644 index e86242c..0000000 --- a/src/View.php +++ /dev/null @@ -1,20 +0,0 @@ - - - - - <?= htmlspecialchars($data->pageTitle) ?> - - -

pageTitle) ?>

- - posts as $post): ?> -

-

- - - - \ No newline at end of file diff --git a/src/migrations.php b/src/migrations.php deleted file mode 100644 index 58216b0..0000000 --- a/src/migrations.php +++ /dev/null @@ -1,27 +0,0 @@ -exec("CREATE TABLE IF NOT EXISTS users ( - id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, - username VARCHAR(50) NOT NULL UNIQUE, - email VARCHAR(255) NOT NULL UNIQUE, - password VARCHAR(255) NOT NULL, - created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP -)"); - -$db->exec("CREATE TABLE IF NOT EXISTS posts ( - id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, - user_id INT UNSIGNED NOT NULL, - title VARCHAR(255) NOT NULL, - body TEXT NOT NULL, - created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE -)"); - -echo "Migrations ran successfully.\n"; \ No newline at end of file diff --git a/src/seeds.php b/src/seeds.php deleted file mode 100644 index 9935f56..0000000 --- a/src/seeds.php +++ /dev/null @@ -1,45 +0,0 @@ -exec("SET FOREIGN_KEY_CHECKS = 0"); -$db->exec("TRUNCATE TABLE posts"); -$db->exec("TRUNCATE TABLE users"); -$db->exec("SET FOREIGN_KEY_CHECKS = 1"); - -$users = [ - ['luna', 'luna@pawra.dev', 'password123'], - ['marco', 'marco@pawra.dev', 'password456'], -]; - -$insertUser = $db->prepare( - "INSERT INTO users (username, email, password) VALUES (?, ?, ?)" -); - -foreach ($users as [$username, $email, $password]) { - $insertUser->execute([ - $username, - $email, - password_hash($password, PASSWORD_DEFAULT), - ]); -} - -$posts = [ - [1, 'First post', 'Hello from Luna — Pawra is live!'], - [1, 'Getting started', 'Here is how I set up my profile...'], - [2, 'Hello Pawra', 'Marco here, excited to join!'], -]; - -$insertPost = $db->prepare( - "INSERT INTO posts (user_id, title, body) VALUES (?, ?, ?)" -); - -foreach ($posts as $post) { - $insertPost->execute($post); -} - -echo "Seeded successfully.\n"; \ No newline at end of file