# Windows Installation (No Docker)

## 1. Install prerequisites

- Git
- Node.js 20+
- PHP 8.1+ with required extensions for MediaWiki
- One database option:
  - SQLite for fast local tests, or
  - MariaDB/MySQL for production-like behavior

## 2. Install project dependencies

```bash
npm install
```

## 3. Fetch MediaWiki source

```bash
npm run mw:init
```

Default branch is REL1_43 in scripts/mw-init.ps1. Adjust if needed.

## 4. Start local server

```bash
npm run dev
```

Open http://127.0.0.1:8080 and complete the MediaWiki web installer.

## 5. Save LocalSettings.php

After installer completion, place generated LocalSettings.php in mediawiki/.

## 6. Install Semantic MediaWiki

```powershell
php .\composer.phar --working-dir=mediawiki require mediawiki/semantic-media-wiki "~6.0" --prefer-dist --optimize-autoloader
```

Add to `mediawiki/LocalSettings.php` (after `wfLoadSkin`):

```php
wfLoadExtension( 'SemanticMediaWiki' );
enableSemantics( '127.0.0.1:8080' );
```

Run the SMW database setup:

```powershell
php mediawiki/extensions/SemanticMediaWiki/maintenance/setupStore.php --nochecks
```

## 7. Push wiki infrastructure pages

Templates, the sidebar, the document index, and category pages are maintained as `.wiki` files in `scripts/templates/`. Push them once after a fresh install:

```powershell
$php = "D:\xampp\php\php.exe"
$mw  = "mediawiki\maintenance\run.php"
$usr = "Gxplex admin"   # replace with your admin username

$pages = @{
    "Template:RegDocument"              = "scripts\templates\RegDocument.wiki"
    "Template:Reference"                = "scripts\templates\Reference.wiki"
    "MediaWiki:Sidebar"                 = "scripts\templates\Sidebar.wiki"
    "Document Index"                    = "scripts\templates\DocumentIndex.wiki"
    "Category:Medical Devices"          = "scripts\templates\Cat_MedicalDevices.wiki"
    "Category:In Vitro Diagnostics"     = "scripts\templates\Cat_IVD.wiki"
    "Category:Clinical"                 = "scripts\templates\Cat_Clinical.wiki"
    "Category:Post-Market Surveillance" = "scripts\templates\Cat_PostMarket.wiki"
    "Category:Labelling"                = "scripts\templates\Cat_Labelling.wiki"
    "Main_Page"                         = "scripts\templates\MainPage.wiki"
}

foreach ($title in $pages.Keys) {
    Get-Content $pages[$title] -Raw | & $php $mw edit --user $usr --summary "Initial setup" $title
}
```

Then rebuild the SMW data index:

```powershell
php mediawiki/extensions/SemanticMediaWiki/maintenance/rebuildData.php
```

## 8. Run accessibility checks

```bash
npm run a11y:all
```
