CLAUDE.md
author ymh <ymh.work@gmail.com>
Fri, 05 Sep 2025 18:40:08 +0200
changeset 21 48c4eec2b7e6
permissions -rw-r--r--
Add CLAUDE.md documentation and sync WordPress core files - Add comprehensive CLAUDE.md documentation file with project architecture, development setup, database operations, WordPress CLI usage, file sync procedures, and Mercurial commands - Update WordPress core files from wordpress/ to wp/ directory - Sync latest WordPress admin interface, includes, and core functionality - Update plugins: portfolio plugin with latest BWS framework and fancybox integration - Maintain custom configuration and theme files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>

# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is a WordPress multisite installation for the ENMI Conference website (enmi-conf.org) running in a containerized environment. The project uses Docker Compose with Caddy as a web server, MariaDB for the database, and PHP-FPM for processing.

## Architecture

- **`wp/`**: Primary WordPress installation (production-like)
- **`wordpress/`**: Secondary WordPress installation (backup/staging)
- **`enmi12/`**: Legacy conference materials from 2012
  - `freemind/`: Mind mapping files
  - `glossaire/`: Glossary with graph visualization
- **Docker services**:
  - `web`: Caddy server (port 8080)
  - `fpm`: PHP-FPM container
  - `db`: MariaDB database
  - `wpcli`: WordPress CLI (dev profile only)

## Development Environment

The project uses Nix for development dependencies and direnv for environment management.

### Prerequisites
- Docker and Docker Compose (or Podman Compose)
- Nix (optional, for development shell)

### Development Setup

1. **Start the environment:**
   ```bash
   docker compose pull
   docker compose build
   docker compose up -d
   ```

2. **Access the site:**
   - Local URL: http://enmi-conf.127.0.0.1.nip.io:8080

### Database Operations

**Import database backup:**
```bash
zcat ../dev/enmi-conf_db_export_2022-09-21.sql.gz | docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp db cli
```

**Update URLs for local development:**
```bash
# Test URL replacement (dry run)
docker compose --profile=dev run -w "/var/www/html/wp" wpcli wp search-replace --dry-run --network "enmi-conf.org" "enmi-conf.local:8080"

# Update blog domains
echo "update wp_blogs set domain='enmi-conf.local:8080';" | docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp db cli

# Update home and siteurl options for all sites
echo "select path from wp_blogs;" | docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp db cli --skip-column-names | xargs -I % docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp --url="http://enmi-conf.local:8080%" option update home "http://enmi-conf.local:8080%/"

echo "select path from wp_blogs;" | docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp db cli --skip-column-names | xargs -I % docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp --url="http://enmi-conf.local:8080%" option update siteurl "http://enmi-conf.local:8080%/"

# Update database schema
docker compose --profile=dev run -w "/var/www/html/wp" wpcli wp core update-db --network
```

### WordPress CLI Operations

All WP-CLI commands should be run in the `/var/www/html/wp` directory:
```bash
docker compose --profile=dev run -w "/var/www/html/wp" wpcli wp [command]
```

### File Synchronization

**Sync uploads from production:**
```bash
rsync -avz -h --stats -P charlie.iri.centrepompidou.fr:/shared/php-01/enmi-conf.org/wp/wp-content/uploads/ ./
```

**Sync WordPress core files (dry-run first):**
```bash
rsync -arvz --delete --dry-run --exclude wp-content --exclude wp-config.php ./wordpress/ ./wp/
```

## WordPress Configuration

- **Database**: `wordpress_ec`
- **DB User**: `iri`
- **Themes**: IN-MOTION-package-u1 (parent), IN-MOTION-package-u1-child
- **Key Plugins**: 
  - portfolio
  - include-mastodon-feed
  - blog-copier
  - option-tree

## Important Files

- `docker-compose.yml`: Container orchestration
- `Caddyfile`: Web server configuration
- `wp-config.php`: WordPress configuration (root level)
- `wp/wp-config.php`: Site-specific WordPress config
- `fpm.Dockerfile`: PHP-FPM container build
- `Readme`: Setup and maintenance commands

## Version Control (Mercurial)

This project uses Mercurial (hg) for version control.

**Add files to tracking:**
```bash
hg add [file]
```

**Remove files from tracking:**
```bash
hg remove [file]
# or to remove from tracking but keep file:
hg forget [file]
```

**Add new files and remove deleted files automatically:**
```bash
hg addremove
```

**Check repository status:**
```bash
hg status
```

## Alternative with Podman

For systems using Podman instead of Docker, replace `docker compose` with `podman-compose` and use the nip.io domain format:
```bash
podman-compose --profile=dev run -w "/var/www/html/wp" wpcli wp search-replace --network "enmi-conf.org" "enmi-conf.127.0.0.1.nip.io:8080"
```