You've already forked Atomcms-edit
Remove all XAMPP support from CMS (files, references, configs)
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
# AtomCMS Environment Configuration
|
# AtomCMS Environment Configuration
|
||||||
# Works on Linux (Nginx/Apache) and Windows (XAMPP/IIS)
|
# Works on Linux (Nginx/Apache) and Windows (IIS)
|
||||||
# Copy to .env and adjust values for your setup
|
# Copy to .env and adjust values for your setup
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
@@ -15,7 +15,7 @@ APP_URL=http://localhost
|
|||||||
# DATABASE - Works on Linux & Windows
|
# DATABASE - Works on Linux & Windows
|
||||||
# ==========================================
|
# ==========================================
|
||||||
DB_CONNECTION=mariadb
|
DB_CONNECTION=mariadb
|
||||||
DB_HOST=127.0.0.1 # Linux: 127.0.0.1, Windows XAMPP: localhost
|
DB_HOST=127.0.0.1
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_DATABASE=habbo
|
DB_DATABASE=habbo
|
||||||
DB_USERNAME=root
|
DB_USERNAME=root
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
# Windows/XAMPP/IIS .env configuration
|
|
||||||
# Copy this to .env and adjust the values for your Windows setup
|
|
||||||
|
|
||||||
# Application
|
|
||||||
APP_NAME="Epicnabbo"
|
|
||||||
APP_ENV=local
|
|
||||||
APP_KEY=base64:EXAMPLE_KEY_CHANGE_ME
|
|
||||||
APP_DEBUG=true
|
|
||||||
APP_URL=http://localhost:8000
|
|
||||||
|
|
||||||
# Database - Windows/XAMPP Settings
|
|
||||||
# For XAMPP use: DB_HOST=localhost
|
|
||||||
# For IIS use: DB_HOST=127.0.0.1 or localhost
|
|
||||||
DB_CONNECTION=mysql
|
|
||||||
DB_HOST=localhost
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_DATABASE=habbo
|
|
||||||
DB_USERNAME=root
|
|
||||||
DB_PASSWORD=
|
|
||||||
|
|
||||||
# For Windows IIS with named pipes, use:
|
|
||||||
# DB_CONNECTION=sqlsrv
|
|
||||||
# DB_HOST=(local)
|
|
||||||
# DB_DATABASE=habbo
|
|
||||||
# DB_USERNAME=sa
|
|
||||||
# DB_PASSWORD=your_password
|
|
||||||
|
|
||||||
# Session (Windows compatible)
|
|
||||||
SESSION_DRIVER=file
|
|
||||||
SESSION_LIFETIME=120
|
|
||||||
|
|
||||||
# Cache (Windows compatible)
|
|
||||||
CACHE_DRIVER=file
|
|
||||||
QUEUE_CONNECTION=sync
|
|
||||||
|
|
||||||
# Mail (Windows compatible - use Mailtrap for testing)
|
|
||||||
MAIL_MAILER=smtp
|
|
||||||
MAIL_HOST=smtp.mailtrap.io
|
|
||||||
MAIL_PORT=2525
|
|
||||||
MAIL_USERNAME=null
|
|
||||||
MAIL_PASSWORD=null
|
|
||||||
MAIL_ENCRYPTION=tls
|
|
||||||
MAIL_FROM_ADDRESS="noreply@epicnabbo.nl"
|
|
||||||
MAIL_FROM_NAME="${APP_NAME}"
|
|
||||||
|
|
||||||
# Pusher (for real-time features)
|
|
||||||
PUSHER_APP_ID=
|
|
||||||
PUSHER_APP_KEY=
|
|
||||||
PUSHER_APP_SECRET=
|
|
||||||
PUSHER_HOST=
|
|
||||||
PUSHER_PORT=443
|
|
||||||
PUSHER_SCHEME=https
|
|
||||||
PUSHER_APP_CLUSTER=mt1
|
|
||||||
|
|
||||||
# Cloudflare Turnstile (optional)
|
|
||||||
TURNSTILE_SITE_KEY=
|
|
||||||
TURNSTILE_SECRET_KEY=
|
|
||||||
|
|
||||||
# Google Recaptcha (optional)
|
|
||||||
NOCAPTCHA_SECRET=
|
|
||||||
NOCAPTCHA_SITEKEY=
|
|
||||||
|
|
||||||
# Discord Webhook (optional)
|
|
||||||
DISCORD_WEBHOOK_URL=
|
|
||||||
|
|
||||||
# Nitro Client Path (Windows paths use backslashes or forward slashes)
|
|
||||||
NITRO_CLIENT_PATH=C:\path\to\nitro-client
|
|
||||||
NITRO_RENDERER_PATH=C:\path\to\nitro-renderer
|
|
||||||
|
|
||||||
# Logging
|
|
||||||
LOG_CHANNEL=stack
|
|
||||||
LOG_LEVEL=debug
|
|
||||||
|
|
||||||
# Broadcast & Filesystems (Windows compatible)
|
|
||||||
BROADCAST_DRIVER=log
|
|
||||||
FILESYSTEM_DISK=local
|
|
||||||
|
|
||||||
# Advanced (usually no changes needed)
|
|
||||||
APP_LOCALE=nl
|
|
||||||
APP_FALLBACK_LOCALE=en
|
|
||||||
APP_LOCALE=nl
|
|
||||||
APP_FAKER_LOCALE=nl_NL
|
|
||||||
|
|
||||||
# Security
|
|
||||||
APP_SECURE=true
|
|
||||||
SESSION_DOMAIN=localhost
|
|
||||||
SANCTUM_STATEFUL_DOMAINS=localhost:3000,127.0.0.1:3000
|
|
||||||
@@ -1,273 +0,0 @@
|
|||||||
# AtomCMS (epicnabbo edit) - v1.0 Ultimate Setup Guide
|
|
||||||
|
|
||||||
**AtomCMS** is a powerful Habbo retro CMS. This guide ensures a **100% working installation** on **any system**: Linux (Nginx/Apache), Windows (IIS/XAMPP), and macOS.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🚀 Quick Start
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone ssh://git@localhost:8422/RemcoEpic/atomcms-edit.git
|
|
||||||
cd atomcms-edit
|
|
||||||
composer install --no-dev
|
|
||||||
cp .env.example .env
|
|
||||||
php artisan key:generate
|
|
||||||
# Configure your .env (DB settings below)
|
|
||||||
php artisan migrate --seed
|
|
||||||
php artisan storage:link
|
|
||||||
php artisan serve
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📋 System Requirements
|
|
||||||
|
|
||||||
### Universal Requirements
|
|
||||||
|
|
||||||
- **PHP**: 8.1, 8.2, or 8.3 (8.2 Recommended)
|
|
||||||
- **Extensions**: `pdo_mysql`, `curl`, `mbstring`, `openssl`, `tokenizer`, `xml`, `zip`
|
|
||||||
- **Database**: MySQL 5.7+ or MariaDB 10.3+
|
|
||||||
- **Composer**: 2.x
|
|
||||||
|
|
||||||
### Linux (Ubuntu/Debian)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y php8.2 php8.2-{mysql,curl,mbstring,xml,zip,fpm} nginx mysql-server
|
|
||||||
```
|
|
||||||
|
|
||||||
### Windows (XAMPP/IIS)
|
|
||||||
|
|
||||||
- Download **XAMPP** with PHP 8.2 or install **PHP 8.2** manually.
|
|
||||||
- Ensure `php.ini` has `extension=pdo_mysql`, `extension=curl`, etc. enabled.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ⚙️ Step 1: Clone the Repository
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# For RemcoEpic epicnabbo edit version:
|
|
||||||
git clone ssh://git@localhost:8422/RemcoEpic/atomcms-edit.git
|
|
||||||
cd atomcms-edit
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📦 Step 2: Install Dependencies
|
|
||||||
|
|
||||||
Run composer to install all required packages. The system is optimized to handle missing extensions automatically via the `SystemCheck` middleware.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
composer install --optimize-autoloader
|
|
||||||
```
|
|
||||||
|
|
||||||
_Windows Note: Run CMD/PowerShell as Administrator if you get permission errors._
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🔧 Step 3: Environment Configuration
|
|
||||||
|
|
||||||
### 3.1 Create .env
|
|
||||||
|
|
||||||
If `.env` is missing, the system tries to create it automatically. You can also do it manually:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp .env.example .env
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3.2 Generate App Key
|
|
||||||
|
|
||||||
```bash
|
|
||||||
php artisan key:generate
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3.3 Database Settings
|
|
||||||
|
|
||||||
Edit `.env` and configure your database connection:
|
|
||||||
|
|
||||||
```env
|
|
||||||
DB_CONNECTION=mysql
|
|
||||||
DB_HOST=127.0.0.1
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_DATABASE=atomcms
|
|
||||||
DB_USERNAME=root
|
|
||||||
DB_PASSWORD=your_password
|
|
||||||
|
|
||||||
APP_URL=http://localhost:8000
|
|
||||||
```
|
|
||||||
|
|
||||||
_Windows IIS Note: If `127.0.0.1` fails, try `localhost`._
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 💾 Step 4: Database Setup
|
|
||||||
|
|
||||||
### 4.1 Create Database
|
|
||||||
|
|
||||||
Login to MySQL and create the database:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
CREATE DATABASE atomcms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
||||||
CREATE USER 'atomcms_user'@'localhost' IDENTIFIED BY 'strong_password';
|
|
||||||
GRANT ALL PRIVILEGES ON atomcms.* TO 'atomcms_user'@'localhost';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
EXIT;
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4.2 Run Migrations
|
|
||||||
|
|
||||||
```bash
|
|
||||||
php artisan migrate --seed
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🔗 Step 5: Storage Link (Crucial!)
|
|
||||||
|
|
||||||
The system uses a **Bulletproof Middleware (`SystemCheck`)** that attempts to create the storage symlink automatically on the first request.
|
|
||||||
|
|
||||||
**Manual Fallback (if auto-fails):**
|
|
||||||
|
|
||||||
_Linux:_
|
|
||||||
|
|
||||||
```bash
|
|
||||||
php artisan storage:link
|
|
||||||
sudo chmod -R 755 storage bootstrap/cache
|
|
||||||
```
|
|
||||||
|
|
||||||
_Windows (CMD as Admin):_
|
|
||||||
|
|
||||||
```cmd
|
|
||||||
mklink /J "C:\path\to\atomcms-edit\public\storage" "C:\path\to\atomcms-edit\storage\app\public"
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🌐 Step 6: Web Server Configuration
|
|
||||||
|
|
||||||
### Option A: PHP Built-in (Testing)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
php artisan serve --host=0.0.0.0 --port=8000
|
|
||||||
```
|
|
||||||
|
|
||||||
Visit: `http://localhost:8000`
|
|
||||||
|
|
||||||
### Option B: Nginx (Linux Production)
|
|
||||||
|
|
||||||
Edit `/etc/nginx/sites-available/atomcms`:
|
|
||||||
|
|
||||||
```nginx
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name epicnabbo.nl; # Your domain
|
|
||||||
root /var/www/atomcms/public;
|
|
||||||
|
|
||||||
add_header X-Frame-Options "SAMEORIGIN";
|
|
||||||
add_header X-Content-Type-Options "nosniff";
|
|
||||||
|
|
||||||
index index.php;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.php?$query_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
|
||||||
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
|
||||||
include fastcgi_params;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Enable: `sudo ln -s /etc/nginx/sites-available/atomcms /etc/nginx/sites-enabled/ && sudo systemctl restart nginx`
|
|
||||||
|
|
||||||
### Option C: Windows IIS
|
|
||||||
|
|
||||||
1. Open **IIS Manager** -> **Sites** -> **Add Website**.
|
|
||||||
2. Physical Path: `C:\inetpub\wwwroot\atomcms-edit\public`
|
|
||||||
3. Install **URL Rewrite Module**.
|
|
||||||
4. Add `web.config` in `public/`:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<configuration>
|
|
||||||
<system.webServer>
|
|
||||||
<rewrite>
|
|
||||||
<rules>
|
|
||||||
<rule name="Laravel Routes" stopProcessing="true">
|
|
||||||
<match url=".*" />
|
|
||||||
<conditions>
|
|
||||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
|
||||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
|
||||||
</conditions>
|
|
||||||
<action type="Rewrite" url="index.php" />
|
|
||||||
</rule>
|
|
||||||
</rules>
|
|
||||||
</rewrite>
|
|
||||||
</system.webServer>
|
|
||||||
</configuration>
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🛡️ Step 7: Production Optimization
|
|
||||||
|
|
||||||
```bash
|
|
||||||
php artisan config:cache
|
|
||||||
php artisan route:cache
|
|
||||||
php artisan view:cache
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ✅ Step 8: Verify & Test
|
|
||||||
|
|
||||||
1. Open `http://your-domain.com` (or `http://localhost:8000`).
|
|
||||||
2. Test **Registration** at `/register`.
|
|
||||||
- _Note:_ v1.0 fixes the "500 Error" on registration (Cloudflare Turnstile & IP fields).
|
|
||||||
3. Check logs if needed: `tail -f storage/logs/laravel.log`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🛠️ Troubleshooting (v1.0 Fixes)
|
|
||||||
|
|
||||||
### 500 Error on Registration?
|
|
||||||
|
|
||||||
**Fixed in v1.0!**
|
|
||||||
|
|
||||||
- ✅ Cloudflare Turnstile null-response handled.
|
|
||||||
- ✅ `ip_register` and `ip_current` added to User model.
|
|
||||||
- ✅ MySQL Strict Mode disabled for Windows/IIS/XAMPP compatibility.
|
|
||||||
|
|
||||||
### "Missing .env" or "No Application Key"
|
|
||||||
|
|
||||||
The `SystemCheck` middleware (auto-runs on every request) will attempt to:
|
|
||||||
|
|
||||||
1. Copy `.env.example` to `.env`.
|
|
||||||
2. Generate `APP_KEY` automatically.
|
|
||||||
|
|
||||||
### Storage Link Issues
|
|
||||||
|
|
||||||
The system auto-creates the symlink. If it fails on Windows, ensure you run the server with **Administrator** privileges.
|
|
||||||
|
|
||||||
### Database Connection Failed
|
|
||||||
|
|
||||||
1. Check `.env` credentials.
|
|
||||||
2. Ensure MySQL service is running (`systemctl status mysql` or Windows Services).
|
|
||||||
3. Use `127.0.0.1` instead of `localhost` if socket errors occur.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🚀 What's new in v1.0 (epicnabbo edit)?
|
|
||||||
|
|
||||||
This version is **Bulletproof**. It is designed to work immediately after `composer install` on any environment.
|
|
||||||
|
|
||||||
- ✅ **Cross-Platform**: Works on Linux (Nginx/Apache), Windows (IIS/XAMPP).
|
|
||||||
- ✅ **Auto-Recovery**: `SystemCheck` middleware fixes missing `.env`, `APP_KEY`, and storage links automatically.
|
|
||||||
- ✅ **Zero 500 Errors**: Registration bugs (Turnstile & IP fields) fixed.
|
|
||||||
- ✅ **MySQL Strict Mode**: Disabled for maximum compatibility.
|
|
||||||
- ✅ **Windows Path Fix**: `index.php` handles Windows backslash paths.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**© 2026 RemcoEpic - epicnabbo.nl**
|
|
||||||
@@ -1,397 +0,0 @@
|
|||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
AtomCMS Auto Installer for Windows (XAMPP / WampServer)
|
|
||||||
.DESCRIPTION
|
|
||||||
Automates the full installation of AtomCMS on Windows.
|
|
||||||
Supports XAMPP and WampServer environments.
|
|
||||||
#>
|
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
$Host.UI.RawUI.WindowTitle = "AtomCMS Installer"
|
|
||||||
|
|
||||||
$REPO_URL = "https://gitlab.epicnabbo.nl/RemcoEpic/atomcms-edit.git"
|
|
||||||
$DB_NAME = "habbo"
|
|
||||||
$DB_USER = "root"
|
|
||||||
$DB_PASS = ""
|
|
||||||
|
|
||||||
function Write-Logo {
|
|
||||||
Write-Host "╔══════════════════════════════════════════╗" -ForegroundColor Magenta
|
|
||||||
Write-Host "║ AtomCMS Auto Installer (Windows) ║" -ForegroundColor Magenta
|
|
||||||
Write-Host "╚══════════════════════════════════════════╝" -ForegroundColor Magenta
|
|
||||||
Write-Host ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function Write-Step {
|
|
||||||
param([string]$Message)
|
|
||||||
Write-Host "[AtomCMS] $Message" -ForegroundColor Magenta
|
|
||||||
}
|
|
||||||
|
|
||||||
function Write-OK {
|
|
||||||
param([string]$Message)
|
|
||||||
Write-Host "[ OK ] $Message" -ForegroundColor Green
|
|
||||||
}
|
|
||||||
|
|
||||||
function Write-Info {
|
|
||||||
param([string]$Message)
|
|
||||||
Write-Host "[ INFO ] $Message" -ForegroundColor Cyan
|
|
||||||
}
|
|
||||||
|
|
||||||
function Write-Warn {
|
|
||||||
param([string]$Message)
|
|
||||||
Write-Host "[ WARN ] $Message" -ForegroundColor Yellow
|
|
||||||
}
|
|
||||||
|
|
||||||
function Write-Error {
|
|
||||||
param([string]$Message)
|
|
||||||
Write-Host "[FAILED] $Message" -ForegroundColor Red
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function Test-Admin {
|
|
||||||
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
|
||||||
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
|
|
||||||
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
|
||||||
Write-Warn "Not running as Administrator. Some operations may fail."
|
|
||||||
$continue = Read-Host "Continue anyway? (y/N)"
|
|
||||||
if ($continue -ne "y") { exit 1 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Find-Xampp {
|
|
||||||
$paths = @(
|
|
||||||
"C:\xampp",
|
|
||||||
"D:\xampp",
|
|
||||||
"E:\xampp",
|
|
||||||
"${env:ProgramFiles}\XAMPP",
|
|
||||||
"${env:ProgramFiles(x86)}\XAMPP"
|
|
||||||
)
|
|
||||||
foreach ($p in $paths) {
|
|
||||||
if (Test-Path "$p\php\php.exe") { return $p }
|
|
||||||
}
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
function Find-Wamp {
|
|
||||||
$paths = @(
|
|
||||||
"C:\wamp64",
|
|
||||||
"C:\wamp",
|
|
||||||
"D:\wamp64",
|
|
||||||
"D:\wamp"
|
|
||||||
)
|
|
||||||
foreach ($p in $paths) {
|
|
||||||
if (Test-Path "$p\bin\php\php8.?.?\php.exe") { return $p }
|
|
||||||
if (Test-Path "$p\bin\php\php8.??\php.exe") { return $p }
|
|
||||||
}
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
function Find-PHP {
|
|
||||||
$php = Get-Command "php.exe" -ErrorAction SilentlyContinue
|
|
||||||
if ($php) { return Split-Path $php.Source -Parent }
|
|
||||||
|
|
||||||
$xampp = Find-Xampp
|
|
||||||
if ($xampp) { return "$xampp\php" }
|
|
||||||
|
|
||||||
$wamp = Find-Wamp
|
|
||||||
if ($wamp) {
|
|
||||||
$phpDirs = Get-ChildItem "$wamp\bin\php" -Filter "php8*" -Directory | Sort-Object Name -Descending
|
|
||||||
if ($phpDirs.Count -gt 0) { return $phpDirs[0].FullName }
|
|
||||||
}
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
function Find-MySQL {
|
|
||||||
$mysql = Get-Command "mysql.exe" -ErrorAction SilentlyContinue
|
|
||||||
if ($mysql) { return Split-Path $mysql.Source -Parent }
|
|
||||||
|
|
||||||
$xampp = Find-Xampp
|
|
||||||
if ($xampp -and (Test-Path "$xampp\mysql\bin\mysql.exe")) { return "$xampp\mysql\bin" }
|
|
||||||
|
|
||||||
$wamp = Find-Wamp
|
|
||||||
if ($wamp -and (Test-Path "$wamp\bin\mariadb\*\bin\mysql.exe")) {
|
|
||||||
$dirs = Get-ChildItem "$wamp\bin\mariadb" -Directory | Sort-Object Name -Descending
|
|
||||||
if ($dirs.Count -gt 0) { return "$($dirs[0].FullName)\bin" }
|
|
||||||
}
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
function Find-Apache {
|
|
||||||
$xampp = Find-Xampp
|
|
||||||
if ($xampp -and (Test-Path "$xampp\apache\bin\httpd.exe")) { return "$xampp\apache" }
|
|
||||||
|
|
||||||
$wamp = Find-Wamp
|
|
||||||
if ($wamp -and (Test-Path "$wamp\bin\apache\*\bin\httpd.exe")) {
|
|
||||||
$dirs = Get-ChildItem "$wamp\bin\apache" -Directory | Sort-Object Name -Descending
|
|
||||||
if ($dirs.Count -gt 0) { return $dirs[0].FullName }
|
|
||||||
}
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
function Ensure-Tool {
|
|
||||||
param([string]$Name, [string]$CheckCommand, [string]$Url, [string]$InstallHint)
|
|
||||||
|
|
||||||
$found = Get-Command $CheckCommand -ErrorAction SilentlyContinue
|
|
||||||
if ($found) {
|
|
||||||
Write-OK "$Name is installed"
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Warn "$Name is not found."
|
|
||||||
if ($Url) {
|
|
||||||
Write-Info "Download from: $Url"
|
|
||||||
}
|
|
||||||
if ($InstallHint) {
|
|
||||||
Write-Info "$InstallHint"
|
|
||||||
}
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
|
|
||||||
function Install-Composer {
|
|
||||||
if (Get-Command "composer" -ErrorAction SilentlyContinue) {
|
|
||||||
Write-OK "Composer already installed"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Write-Step "Installing Composer..."
|
|
||||||
$installer = "$env:TEMP\composer-setup.php"
|
|
||||||
Invoke-WebRequest -Uri "https://getcomposer.org/installer" -OutFile $installer
|
|
||||||
php $installer --quiet --install-dir="$env:USERPROFILE\bin"
|
|
||||||
php -r "unlink('$installer');"
|
|
||||||
$env:Path += ";$env:USERPROFILE\bin"
|
|
||||||
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\bin", "User")
|
|
||||||
Write-OK "Composer installed. You may need to restart your terminal."
|
|
||||||
}
|
|
||||||
|
|
||||||
function Clone-Project {
|
|
||||||
param([string]$TargetDir)
|
|
||||||
|
|
||||||
if (Test-Path "$TargetDir\artisan") {
|
|
||||||
Write-OK "Project already cloned at $TargetDir"
|
|
||||||
return $TargetDir
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Get-Command "git" -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Error "Git is not installed. Install Git for Windows: https://git-scm.com/download/win"
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Step "Cloning project..."
|
|
||||||
git clone $REPO_URL $TargetDir
|
|
||||||
Write-OK "Project cloned to $TargetDir"
|
|
||||||
return $TargetDir
|
|
||||||
}
|
|
||||||
|
|
||||||
function Configure-Env {
|
|
||||||
param([string]$ProjectDir)
|
|
||||||
|
|
||||||
Write-Step "Configuring environment..."
|
|
||||||
$envFile = "$ProjectDir\.env"
|
|
||||||
if (Test-Path $envFile) {
|
|
||||||
Write-Info ".env already exists, skipping"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Copy-Item "$ProjectDir\.env.example" $envFile
|
|
||||||
$dbPass = Read-Host "Database password (leave empty for root without password)"
|
|
||||||
|
|
||||||
(Get-Content $envFile) -replace 'DB_DATABASE=.*', "DB_DATABASE=$DB_NAME" | Set-Content $envFile
|
|
||||||
(Get-Content $envFile) -replace 'DB_USERNAME=.*', "DB_USERNAME=$DB_USER" | Set-Content $envFile
|
|
||||||
(Get-Content $envFile) -replace 'DB_PASSWORD=.*', "DB_PASSWORD=$dbPass" | Set-Content $envFile
|
|
||||||
|
|
||||||
Push-Location $ProjectDir
|
|
||||||
php artisan key:generate --quiet
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
Write-OK ".env configured and APP_KEY generated"
|
|
||||||
}
|
|
||||||
|
|
||||||
function Create-Database {
|
|
||||||
param([string]$MySQLDir)
|
|
||||||
|
|
||||||
Write-Step "Creating database '$DB_NAME'..."
|
|
||||||
|
|
||||||
$mysqlExe = if ($MySQLDir) { "$MySQLDir\mysql.exe" } else { "mysql.exe" }
|
|
||||||
|
|
||||||
if ($DB_PASS) {
|
|
||||||
& $mysqlExe -u $DB_USER -p$DB_PASS -e "CREATE DATABASE IF NOT EXISTS `$DB_NAME` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" 2>$null
|
|
||||||
} else {
|
|
||||||
& $mysqlExe -u $DB_USER -e "CREATE DATABASE IF NOT EXISTS `$DB_NAME` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" 2>$null
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
Write-OK "Database '$DB_NAME' ready"
|
|
||||||
} else {
|
|
||||||
Write-Warn "Could not create database automatically."
|
|
||||||
Write-Info "Open phpMyAdmin (http://localhost/phpmyadmin) and create a database named '$DB_NAME' with charset utf8mb4_unicode_ci."
|
|
||||||
Read-Host "Press Enter after creating the database"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Run-Migrations {
|
|
||||||
param([string]$ProjectDir)
|
|
||||||
|
|
||||||
Write-Step "Running migrations and seeders..."
|
|
||||||
Push-Location $ProjectDir
|
|
||||||
php artisan migrate --seed --force
|
|
||||||
Pop-Location
|
|
||||||
Write-OK "Migrations and seeders complete"
|
|
||||||
}
|
|
||||||
|
|
||||||
function Build-Assets {
|
|
||||||
param([string]$ProjectDir)
|
|
||||||
|
|
||||||
Write-Step "Building frontend assets..."
|
|
||||||
Push-Location $ProjectDir
|
|
||||||
yarn build:all
|
|
||||||
Pop-Location
|
|
||||||
Write-OK "Frontend assets built"
|
|
||||||
}
|
|
||||||
|
|
||||||
function Set-Permissions {
|
|
||||||
param([string]$ProjectDir)
|
|
||||||
|
|
||||||
Write-Step "Setting permissions..."
|
|
||||||
$folders = @("$ProjectDir\storage", "$ProjectDir\bootstrap\cache")
|
|
||||||
|
|
||||||
foreach ($folder in $folders) {
|
|
||||||
if (Test-Path $folder) {
|
|
||||||
try {
|
|
||||||
icacls $folder /grant "Everyone:F" /T /Q 2>$null
|
|
||||||
} catch {
|
|
||||||
Write-Warn "Could not set permissions on $folder. You may need to do this manually."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-OK "Permissions set"
|
|
||||||
}
|
|
||||||
|
|
||||||
function Configure-Apache {
|
|
||||||
param([string]$ApacheDir, [string]$ProjectDir)
|
|
||||||
|
|
||||||
Write-Step "Configuring Apache virtual host..."
|
|
||||||
|
|
||||||
$domain = Read-Host "Enter your domain name (e.g. localhost)"
|
|
||||||
$publicDir = "$ProjectDir\public".Replace("\", "/")
|
|
||||||
|
|
||||||
$vhost = @"
|
|
||||||
<VirtualHost *:80>
|
|
||||||
ServerName $domain
|
|
||||||
DocumentRoot "$publicDir"
|
|
||||||
|
|
||||||
<Directory "$publicDir">
|
|
||||||
Options Indexes FollowSymLinks
|
|
||||||
AllowOverride All
|
|
||||||
Require all granted
|
|
||||||
</Directory>
|
|
||||||
|
|
||||||
ErrorLog logs/atomcms-error.log
|
|
||||||
CustomLog logs/atomcms-access.log combined
|
|
||||||
</VirtualHost>
|
|
||||||
"@
|
|
||||||
|
|
||||||
if ($ApacheDir) {
|
|
||||||
$confFile = "$ApacheDir\conf\extra\httpd-vhosts.conf"
|
|
||||||
Add-Content -Path $confFile -Value "`n$vhost" -ErrorAction SilentlyContinue
|
|
||||||
Write-OK "Virtual host added to $confFile"
|
|
||||||
Write-Info "Make sure these lines are uncommented in httpd.conf:"
|
|
||||||
Write-Info " Include conf/extra/httpd-vhosts.conf"
|
|
||||||
Write-Info " LoadModule rewrite_module modules/mod_rewrite.so"
|
|
||||||
} else {
|
|
||||||
Write-Warn "Apache directory not found. Add this virtual host manually:"
|
|
||||||
Write-Host $vhost -ForegroundColor Gray
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Show-Summary {
|
|
||||||
param([string]$Domain)
|
|
||||||
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "╔══════════════════════════════════════════════════════════════╗" -ForegroundColor Green
|
|
||||||
Write-Host "║ AtomCMS is ready! ║" -ForegroundColor Green
|
|
||||||
Write-Host "║ ║" -ForegroundColor Green
|
|
||||||
Write-Host "║ Visit: http://$Domain ║" -ForegroundColor Green
|
|
||||||
Write-Host "║ Admin: http://$Domain/admin ║" -ForegroundColor Green
|
|
||||||
Write-Host "║ ║" -ForegroundColor Green
|
|
||||||
Write-Host "║ Run the repair tool for extra checks: ║" -ForegroundColor Green
|
|
||||||
Write-Host "║ php artisan atom:check --fix ║" -ForegroundColor Green
|
|
||||||
Write-Host "╚══════════════════════════════════════════════════════════════╝" -ForegroundColor Green
|
|
||||||
Write-Host ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function Main {
|
|
||||||
Write-Logo
|
|
||||||
Test-Admin
|
|
||||||
|
|
||||||
# Check environment
|
|
||||||
$phpDir = Find-PHP
|
|
||||||
$mysqlDir = Find-MySQL
|
|
||||||
$apacheDir = Find-Apache
|
|
||||||
|
|
||||||
if (-not $phpDir) {
|
|
||||||
Write-Error "PHP not found. Install XAMPP (https://www.apachefriends.org/) or WampServer first."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add PHP and MySQL to PATH for this session
|
|
||||||
if ($phpDir) { $env:Path = "$phpDir;$env:Path" }
|
|
||||||
if ($mysqlDir) { $env:Path = "$mysqlDir;$env:Path" }
|
|
||||||
|
|
||||||
Write-OK "PHP found: $((Get-Command php).Source)"
|
|
||||||
if ($mysqlDir) { Write-OK "MySQL found: $mysqlDir" }
|
|
||||||
if ($apacheDir) { Write-OK "Apache found: $apacheDir" }
|
|
||||||
|
|
||||||
# Ensure required tools
|
|
||||||
Ensure-Tool -Name "Node.js" -CheckCommand "node" -Url "https://nodejs.org/" -InstallHint "Install Node.js LTS"
|
|
||||||
$hasYarn = Ensure-Tool -Name "Yarn" -CheckCommand "yarn" -Url "https://yarnpkg.com/getting-started/install" -InstallHint "Run: npm install -g yarn"
|
|
||||||
Ensure-Tool -Name "Git" -CheckCommand "git" -Url "https://git-scm.com/download/win" -InstallHint "Install Git for Windows"
|
|
||||||
|
|
||||||
if (-not $hasYarn) {
|
|
||||||
Write-Step "Installing Yarn via npm..."
|
|
||||||
npm install -g yarn
|
|
||||||
Write-OK "Yarn installed"
|
|
||||||
}
|
|
||||||
|
|
||||||
Install-Composer
|
|
||||||
|
|
||||||
# Where to install?
|
|
||||||
$defaultDir = if (Find-Xampp) { "$(Find-Xampp)\htdocs\atomcms" } else { "$env:USERPROFILE\atomcms" }
|
|
||||||
$projectDir = Read-Host "Installation directory [$defaultDir]"
|
|
||||||
if (-not $projectDir) { $projectDir = $defaultDir }
|
|
||||||
|
|
||||||
Clone-Project -TargetDir $projectDir
|
|
||||||
Configure-Env -ProjectDir $projectDir
|
|
||||||
|
|
||||||
# Install PHP deps
|
|
||||||
Write-Step "Installing PHP dependencies..."
|
|
||||||
Push-Location $projectDir
|
|
||||||
composer install --no-interaction --optimize-autoloader --no-dev
|
|
||||||
Pop-Location
|
|
||||||
Write-OK "PHP dependencies installed"
|
|
||||||
|
|
||||||
# Install Node deps
|
|
||||||
Write-Step "Installing Node dependencies..."
|
|
||||||
Push-Location $projectDir
|
|
||||||
yarn install --frozen-lockfile
|
|
||||||
Pop-Location
|
|
||||||
Write-OK "Node dependencies installed"
|
|
||||||
|
|
||||||
Create-Database -MySQLDir $mysqlDir
|
|
||||||
Run-Migrations -ProjectDir $projectDir
|
|
||||||
Build-Assets -ProjectDir $projectDir
|
|
||||||
Set-Permissions -ProjectDir $projectDir
|
|
||||||
|
|
||||||
$configureWeb = Read-Host "Configure Apache virtual host? (y/N)"
|
|
||||||
if ($configureWeb -eq "y") {
|
|
||||||
Configure-Apache -ApacheDir $apacheDir -ProjectDir $projectDir
|
|
||||||
}
|
|
||||||
|
|
||||||
# Finalize
|
|
||||||
Write-Step "Finalizing..."
|
|
||||||
Push-Location $projectDir
|
|
||||||
php artisan storage:link --force 2>$null
|
|
||||||
php artisan optimize:clear 2>$null
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
$domain = Read-Host "Enter your domain/path to access the site (e.g. localhost/atomcms/public or your-domain.com)"
|
|
||||||
Show-Summary -Domain $domain
|
|
||||||
}
|
|
||||||
|
|
||||||
Main
|
|
||||||
@@ -6,7 +6,6 @@ $searchPaths = @(
|
|||||||
"C:\Program Files (x86)\PHP",
|
"C:\Program Files (x86)\PHP",
|
||||||
"C:\php7",
|
"C:\php7",
|
||||||
"C:\php8",
|
"C:\php8",
|
||||||
"C:\xampp\php",
|
|
||||||
"C:\wamp\bin\php",
|
"C:\wamp\bin\php",
|
||||||
"C:\wamp64\bin\php",
|
"C:\wamp64\bin\php",
|
||||||
"C:\laragon\bin\php",
|
"C:\laragon\bin\php",
|
||||||
@@ -42,7 +41,7 @@ if (-not $phpPath) {
|
|||||||
if (-not $phpPath) {
|
if (-not $phpPath) {
|
||||||
Write-Host "Zoeken in C:\ schijf..." -ForegroundColor Yellow
|
Write-Host "Zoeken in C:\ schijf..." -ForegroundColor Yellow
|
||||||
$rootFolders = Get-ChildItem -Path "C:\" -Directory -ErrorAction SilentlyContinue |
|
$rootFolders = Get-ChildItem -Path "C:\" -Directory -ErrorAction SilentlyContinue |
|
||||||
Where-Object { $_.Name -match 'php|xampp|wamp|laragon|inetpub' }
|
Where-Object { $_.Name -match 'php|wamp|laragon|inetpub' }
|
||||||
foreach ($folder in $rootFolders) {
|
foreach ($folder in $rootFolders) {
|
||||||
$found = Get-ChildItem -Path $folder.FullName -Recurse -Filter "php-cgi.exe" -ErrorAction SilentlyContinue |
|
$found = Get-ChildItem -Path $folder.FullName -Recurse -Filter "php-cgi.exe" -ErrorAction SilentlyContinue |
|
||||||
Select-Object -First 1 -ExpandProperty FullName
|
Select-Object -First 1 -ExpandProperty FullName
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ use Illuminate\Http\Request;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bulletproof Cross-Platform Bootstrap
|
* Bulletproof Cross-Platform Bootstrap
|
||||||
* Works on: Linux (Nginx/Apache), Windows (IIS/XAMPP), Docker
|
* Works on: Linux (Nginx/Apache), Windows (IIS), Docker
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Windows path fix
|
// Windows path fix
|
||||||
|
|||||||
Reference in New Issue
Block a user