# Livada SEO — Self-hosted update workflow

This plugin ships an updater that checks a JSON manifest hosted on
`https://livada.fr/livada-seo-updates/` once every 12 hours. As soon as you
push a new version to that endpoint, every site running Livada SEO sees
**"Mettre à jour maintenant"** on its Extensions page, just like a plugin
from the WordPress.org repository.

## One-time setup (livada.fr)

1. Connect to livada.fr via Hostinger File Manager (or SFTP).
2. Inside `/public_html/`, create a folder named `livada-seo-updates/`.
3. Make sure it's web-accessible: visiting
   `https://livada.fr/livada-seo-updates/` should not 403.
4. (Optional) drop an empty `index.html` inside to disable directory
   listing on hosts that have it on by default.

## Releasing a new version (4 steps, ≈ 1 minute)

### 1. Bump the version

Edit `livada-seo.php`:

```php
 * Version:           1.8.1
...
define( 'LIVADA_SEO_VERSION', '1.8.1' );
```

Update `readme.txt` (`Stable tag:` + Changelog + Upgrade Notice) and
`CHANGELOG.md`.

### 2. Build the ZIP

PowerShell on Windows (uses Python because PowerShell `Compress-Archive`
writes Windows-style backslash paths that break Linux extraction):

```powershell
python - << 'PY'
import zipfile, os
src = r'D:/Slave H/Claude/plugins/livada-seo'
dst = r'D:/livada-seo.zip'
parent = os.path.dirname(src)
with zipfile.ZipFile(dst, 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as zf:
    for root, _, files in os.walk(src):
        for f in files:
            full = os.path.join(root, f)
            rel  = os.path.relpath(full, parent)
            zf.write(full, rel.replace(os.sep, '/'))
PY
```

The result is a standard WordPress plugin ZIP (single root folder
`livada-seo/`, Unix forward-slash paths, ~270 KB).

### 3. Update `info.json`

Copy `info.example.json` → `info.json`, edit:

- `version`           → match the new version
- `last_updated`      → current timestamp
- `sections.changelog` → HTML excerpt of what's new
- `sections.upgrade_notice` → optional admin notice
- `download_url`      → keep `https://livada.fr/livada-seo-updates/livada-seo.zip` (we always overwrite this URL)

### 4. Upload both files to `/public_html/livada-seo-updates/`

- `livada-seo.zip`  (overwrite the previous one)
- `info.json`       (overwrite the previous one)

That's it. Within 12 hours every site running Livada SEO sees the update
notice. To make it appear immediately on a specific site:

- **wp-admin → Extensions** → row Livada SEO → click **"Check for updates"**
- OR run `wp transient delete update_plugins` via WP-CLI

## Override the update URL (dev / staging)

If you want a single staging site to point at a different manifest:

```php
add_filter( 'livada_seo_update_url', function () {
    return 'https://staging.livada.fr/livada-seo-updates/info.json';
} );
```

Drop that in your `mu-plugins/` or theme `functions.php`.

## Disable the updater

```php
add_filter( 'livada_seo_update_disabled', '__return_true' );
```

## How to deploy to a new site

For the **first install** on a site (camping-la-ferme.com, etc.), use the
standard WordPress upload flow:

- **Extensions → Ajouter → Téléverser une extension** → upload
  `livada-seo.zip`.

After the first install, all subsequent updates appear automatically on
the Extensions page when a new version is published to
`livada-seo-updates/`.

## Manifest reference

See [`info.example.json`](info.example.json) for the full schema. Required
fields: `version`, `download_url`. Everything else is optional but
populating `sections.changelog` and `tested` makes the "View details"
modal informative.
