#!/usr/bin/env bash
# Import the Newspaper PRO pre-built website (demo id: default_pro) and re-apply
# Manthana branding. Needs: theme license activated in wp-admin, and outbound
# internet access to cloud.tagdiv.com from the server.
set -euo pipefail
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if command -v wp >/dev/null; then WP="wp"; else WP="vendor/bin/wp"; fi
[[ "$(id -u)" == "0" ]] && WP="$WP --allow-root"
$WP --context=admin manthana import-demo --demo="${1:-default_pro}" --yes
$WP rewrite flush --hard
$WP manthana status
