An experimental project that merges a modern development environment (PHP 8.3, MySQL 8, Docker, a block editor, CLI / env / playground tooling) into the oldest WordPress release — 0.71-gold (2003) — leaving the 2003 code itself untouched.
⚠️ This is purely an experimental / study project — it is NOT intended for production use. WordPress 0.71-gold is 2003-era b2/cafelog code; even with the changes in this repository it remains an obsolete platform and must not be used to run a real website or handle real data. The purpose is to explore running historical code on a current PHP/MySQL stack — it is modernised just enough to run, not rewritten.
Run WordPress 0.71 (2003) entirely in your browser, no install. PHP 8.3
is compiled to WebAssembly and the database is in-browser SQLite, so nothing
runs on a server. Deployed to GitHub Pages from tools/playground/; see the
071-now package.
- Docker (with Docker Compose v2)
- Node.js 20+ (for the
tools/packages, the Playwright E2E suite and the block editor build)
git clone https://github.com/mt8/wordpress-0.71-gold.git
cd wordpress-0.71-gold
npm run setup # install all tooling (npm, block editor, Composer)
npx 071-env start # build and start the PHP 8.3 / MySQL 8 environmentnpm run setup runs the post-clone installs in one step — the
repository-root npm packages (the tools/ workspaces, Playwright, husky),
the block editor's own npm package and its Vite build, and the PHP dev
tooling via Composer. It then generates a default src/b2config.php
(git-ignored) when none exists, so the files that require_once it resolve
under phpstan. It installs and configures tooling only; starting the blog is
the next line.
npx 071-env start builds the web image and starts the environment. The
Docker Compose files now live under tools/env/, so a plain
docker compose up from the repository root no longer works — 071-env is
the documented way to start the environment.
Then open the installer at http://localhost:8080/wp-admin/wp-install.php and follow it. Afterwards:
- Blog front end: http://localhost:8080/
- Admin screen: http://localhost:8080/wp-admin/b2edit.php
npx 071-env stop # stop without removing the environment
npx 071-env destroy # stop and drop the database volume| Service | Image | Role |
|---|---|---|
web |
php:8.3-apache + mysqli (built from tools/env/Dockerfile) |
Apache + PHP 8.3, serves ./src |
db |
mysql:8.0 (official) |
MySQL 8 database b2 (user user / pass) |
Both base images are official; the only customization is tools/env/Dockerfile
adding the mysqli extension. 071-env start generates src/b2config.php
from the committed src/b2config-sample.php; the sample's default database
credentials match tools/env/docker-compose.yml, so no configuration is needed
for local use — per-environment values can be set via the wpConfig object of
.071-env.json.
The tools/ directory holds the 0.71-specific tooling packages. The first
three are npm workspaces, so npm install at the repository root installs
them all.
| Package | Path | Run | What it is |
|---|---|---|---|
071-cli |
tools/cli |
npx 071 <command> |
wp-cli-style CLI for WordPress 0.71; includes 071 export (static export). See tools/cli/README.md. |
071-env |
tools/env |
npx 071-env <command> |
wp-env-style manager for the PHP 8.3 / MySQL 8 Docker environment. See tools/env/README.md. |
071-now |
tools/playground |
npx 071-now |
wp-now / Playground-style in-browser WordPress 0.71. See tools/playground/README.md. |
| block editor | tools/block-editor |
cd tools/block-editor && npm install && npm run build |
Build source for the custom block editor; build output goes to src/block-editor/assets/. See tools/block-editor/README.md. |
npx always works. To run the bare 071 / 071-env commands (without the
npx prefix), npm link the package — e.g. npm link --workspace tools/cli.
composer install
composer phpcs # WordPress-Core coding standard (WPCS)
composer phpstan # PHPStan (level 0)Both currently report 0. phpcs runs the curated WordPress-Core
standard; PHPStan runs at level 0. A husky pre-commit hook runs lint-staged
(phpcs / phpstan on staged changes) so regressions are caught before they land.
See docs/static-analysis.md.
composer test # PHPUnitA PHPUnit suite (94 tests) covers the unit-testable parts of the
2003-era code in tests/phpunit/tests/:
- Pure helpers — text formatting, escaping, date/URL/number helpers in
b2functions.phpandb2template.functions.php. - The
textileformatter inb2-include/textile.php(string in, HTML out). - Database-dependent helpers —
get_postdata(),get_userdata(),get_the_category(), etc. A test-support fake$wpdbstub (tests/phpunit/includes/Support/FakeWpdb.php) plus the table-name globals make these unit-testable without a live MySQL server. - The CSRF helpers added in Issue #33.
# 1. Start the local Docker blog
npx 071-env start
npx 071-env status # confirm web + db are Up
# 2. Install the Node tooling (first run only)
npm install
npx playwright install chromium
# 3. Run the suite
npm run test:e2eA Playwright end-to-end suite (in tests/e2e/) drives the real admin and
front-end pages of the running Docker blog. It covers the admin flows
(log in; create / edit / delete a post; add / delete a category) and the
front end (home page, single post ?p=, category ?cat=, monthly archive
?m=, and the RSS 2.0 feed), and asserts that no PHP
Fatal error / Warning / Deprecated text appears on any page. Test data
is seeded and cleaned up by helpers in tests/e2e/helpers/; every seeded row carries
an E2E: title/name prefix and only those rows are removed, so your existing
content is never touched and the suite is safe to re-run. The Docker blog must
be running first. See docs/php83-migration.md (Issue #60) for details.
npx 071 export # or: composer static-exportWordPress 0.71 must never be exposed to the public internet as a running
PHP application. The intended workflow is: write posts in the local
environment, export the site to static HTML with npx 071 export (the
export command group of 071-cli), and upload only the static files to a
public server — which then runs no PHP and no database, so the 2003 codebase
is never exposed. composer static-export is a thin alias for 071 export.
See docs/static-export.md.
The project also includes an experimental custom block editor, built on
the @wordpress/block-editor package — a modern editing method offered
alongside the classic wp-admin/b2edit.php editor (it does not replace it).
WordPress 0.71 has no REST API, so the editor is a deliberately-scoped
experiment; see docs/gutenberg-investigation.md.
Build the editor once:
cd tools/block-editor
npm install
npm run buildThen, logged in to the admin, open a post in it from the "Block editor"
link shown next to each post in the admin post list (wp-admin/b2edit.php),
or directly at block-editor/api/editor.php?post=<ID>. Block content is
stored as block markup in the existing post_content column, so the 0.71
front end keeps rendering the post normally.
| Path | Contents |
|---|---|
src/ |
The WordPress 0.71-gold source — the actual modified codebase. src/block-editor/ holds the runtime block editor PHP (api/) and its built assets (assets/). |
tests/phpunit/ |
PHPUnit unit tests (tests/) and support classes (includes/). |
tests/e2e/ |
Playwright E2E specs and test-data helpers. |
docs/ |
Documentation. |
tools/ |
0.71-specific tooling — 071-cli (tools/cli, includes the static export), 071-env (tools/env), 071-now (tools/playground), and the block editor build source (tools/block-editor). |
tools/env/Dockerfile, tools/env/docker-compose.yml |
Local PHP 8.3 + MySQL 8 environment. |
phpcs.xml.dist, phpstan.neon.dist |
Static-analysis configuration. |
composer.json |
PHP dev tooling (phpcs / WPCS / PHPStan / PHPUnit). |
package.json, playwright.config.js, lint-staged.config.mjs, .husky/ |
Node tooling — Playwright E2E and the husky/lint-staged pre-commit hook. |
- PHP 8.3 migration —
ext/mysql→mysqli, POSIXereg*→ PCRE, removed/changed PHP functions and superglobals, PHP4-style constructors, etc. - MySQL 8 compatibility — strict
sql_mode, reserved words, etc. - Security hardening — SQL injection, XSS, CSRF, authentication & session, access control, file upload, information disclosure.
- Removed unused features — XML-RPC, comments, trackback and pingback.
- Static analysis — phpcs (WordPress-Core / WPCS) and PHPStan, both at 0.
Every change is recorded, per GitHub Issue, in docs/php83-migration.md.
| File | Contents |
|---|---|
docs/php83-migration.md |
Per-Issue migration log. |
docs/security-audit.md |
Security audit summary. |
docs/static-export.md |
Static export & safe publishing. |
docs/static-analysis.md |
phpcs / PHPStan tooling. |
docs/docker-environment.md |
Docker environment details. |
docs/gutenberg-investigation.md |
Gutenberg port feasibility investigation. |
docs/block-editor-media-and-layout.md |
Block editor: image upload & layout-block consistency. |
GPL-2.0-or-later. WordPress is released under the GNU General Public License; this derivative work follows the same license.
最古の WordPress リリース 0.71-gold(2003 年)に、モダンな開発環境 (PHP 8.3・MySQL 8・Docker・ブロックエディタ・CLI / 環境 / playground ツール群)をマージする実験プロジェクト。2003 年の コード本体には手を入れない。
⚠️ これはあくまでも実験・学習目的のプロジェクトであり、本番利用は 想定していません。 WordPress 0.71-gold は 2003 年当時の b2/cafelog コード で、本リポジトリの変更を加えても旧式のプラットフォームであることに変わりは なく、実運用のサイトや実データに使用してはいけません。目的は歴史的なコードを 現行の PHP/MySQL 環境で動かす検証であり、動作する範囲で近代化しているのみ、 全面的な書き直しはしていない。
WordPress 0.71(2003 年)をブラウザ内で完全に動かす。インストール不要。
PHP 8.3 を WebAssembly へコンパイルし、データベースはブラウザ内 SQLite で
あるため、サーバー側では何も動かない。tools/playground/ から GitHub Pages
へデプロイされている。詳細は 071-now
パッケージを参照。
- Docker(Docker Compose v2)
- Node.js 20 以上(
tools/パッケージ、Playwright E2E、ブロックエディタの ビルドに必要)
git clone https://github.com/mt8/wordpress-0.71-gold.git
cd wordpress-0.71-gold
npm run setup # ツール一式を導入(npm・ブロックエディタ・Composer)
npx 071-env start # PHP 8.3 / MySQL 8 環境をビルドして起動npm run setup はクローン後の導入を1ステップで実行する — リポジトリ
直下の npm パッケージ(tools/ ワークスペース・Playwright・husky)、
ブロックエディタ自身の npm パッケージと Vite ビルド、Composer による PHP
開発ツール。さらに src/b2config.php(git 管理外)が無ければ既定のものを
生成し、require_once するファイルが phpstan で解決できるようにする。
導入と設定のみを行い、ブログの起動は次の行で行う。
npx 071-env start は web イメージをビルドし、環境を起動する。Docker
Compose ファイルは tools/env/ 配下へ移ったため、リポジトリ直下での素の
docker compose up はもう動かない — 環境起動は 071-env で行うのが
ドキュメント上の手順である。
起動後、http://localhost:8080/wp-admin/wp-install.php のインストーラを 開いて進める。完了後:
npx 071-env stop # 環境を削除せずに停止
npx 071-env destroy # 停止し DB ボリュームも削除| サービス | イメージ | 役割 |
|---|---|---|
web |
php:8.3-apache + mysqli(tools/env/Dockerfile からビルド) |
Apache + PHP 8.3、./src を配信 |
db |
mysql:8.0(公式) |
MySQL 8 データベース b2(ユーザー user / pass) |
ベースイメージはいずれも公式。カスタマイズは tools/env/Dockerfile で
mysqli 拡張を追加する 1 点のみ。071-env start がコミット済みの
src/b2config-sample.php から src/b2config.php を生成する。サンプルの
既定 DB 認証情報は tools/env/docker-compose.yml と一致しているため、
ローカル利用では設定不要 — 環境ごとの値は .071-env.json の wpConfig
オブジェクトで設定できる。
tools/ ディレクトリには 0.71 専用のツールパッケージが置かれている。先頭の
3 つは npm workspaces であるため、リポジトリ直下での npm install で
まとめて導入される。
| パッケージ | パス | 実行 | 内容 |
|---|---|---|---|
071-cli |
tools/cli |
npx 071 <command> |
WordPress 0.71 向けの wp-cli 風 CLI。071 export(静的書き出し)を含む。tools/cli/README.md を参照。 |
071-env |
tools/env |
npx 071-env <command> |
PHP 8.3 / MySQL 8 の Docker 環境を扱う wp-env 風マネージャ。tools/env/README.md を参照。 |
071-now |
tools/playground |
npm run dev --workspace tools/playground |
wp-now / Playground 風のブラウザ内 WordPress 0.71。tools/playground/README.md を参照。 |
| ブロックエディタ | tools/block-editor |
cd tools/block-editor && npm install && npm run build |
カスタムブロックエディタのビルドソース。ビルド出力は src/block-editor/assets/ へ。tools/block-editor/README.md を参照。 |
npx は常に動く。素の 071 / 071-env コマンド(npx 接頭辞なし)で
実行するには、パッケージを npm link する — 例: npm link --workspace tools/cli。
composer install
composer phpcs # WordPress-Core coding standard (WPCS)
composer phpstan # PHPStan (level 0)いずれも現在 0 件。phpcs は精選した WordPress-Core 標準、PHPStan は
level 0 で実行する。husky の pre-commit フックが lint-staged(staged 変更
への phpcs / phpstan)を実行し、退行をマージ前に捕捉する。詳細は
docs/static-analysis.md。
composer test # PHPUnitPHPUnit スイート(94 テスト)が、2003 年当時のコードのうち単体テスト
可能な部分を tests/phpunit/tests/ で網羅する:
- 純粋なヘルパー —
b2functions.phpとb2template.functions.phpの テキスト整形・エスケープ・日付/URL/数値ヘルパー。 textileフォーマッタ —b2-include/textile.php(文字列入力・HTML 出力)。- DB 依存ヘルパー —
get_postdata()・get_userdata()・get_the_category()ほか。テスト補助の偽$wpdbスタブ (tests/phpunit/includes/Support/FakeWpdb.php)とテーブル名グローバルに より、実 MySQL サーバー無しで単体テスト可能にする。 - CSRF ヘルパー — Issue #33 で追加。
# 1. ローカル Docker ブログを起動
npx 071-env start
npx 071-env status # web と db が Up か確認
# 2. Node ツールを導入 (初回のみ)
npm install
npx playwright install chromium
# 3. スイートを実行
npm run test:e2ePlaywright の E2E スイート(tests/e2e/)が、稼働中の Docker ブログの実際の
管理画面・フロントエンドのページを操作する。管理画面フロー(ログイン、投稿の
作成/編集/削除、カテゴリの追加/削除)とフロントエンド(トップ、単一投稿
?p=、カテゴリ ?cat=、月別アーカイブ ?m=、RSS 2.0 フィード)を
対象とし、どのページにも PHP の Fatal error / Warning /
Deprecated が出ないことを検証する。テストデータは tests/e2e/helpers/ の
ヘルパーが投入・後始末する。投入する行はすべて E2E: というタイトル/名前接頭辞を持ち、
その行のみを削除するため、既存コンテンツに触れることはなく、再実行しても安全
である。先に Docker ブログを起動しておくこと。詳細は docs/php83-migration.md
(Issue #60)を参照。
npx 071 export # or: composer static-exportWordPress 0.71 を、稼働中の PHP アプリケーションとして公開インターネット
へ晒してはならない。想定するワークフローは: ローカル環境で投稿を書き、
npx 071 export(071-cli の export コマンドグループ)でサイトを静的 HTML
へ書き出し、静的ファイルだけを公開サーバーへアップロードする — 公開サーバーは
PHP も DB も動かさないため、2003 年のコードベースが晒されることはない。
composer static-export は 071 export の薄いエイリアスである。詳細は
docs/static-export.md。
本プロジェクトには、@wordpress/block-editor パッケージを用いた実験的な
カスタムブロックエディタも入っている — 従来の wp-admin/b2edit.php
エディタと並ぶモダンな編集手段である(置き換えではない)。WordPress 0.71 に
REST API は無いため、本エディタは範囲を限定した実験である。詳細は
docs/gutenberg-investigation.md を参照。
エディタは最初に一度ビルドする:
cd tools/block-editor
npm install
npm run buildビルド後、管理画面にログインした状態で、管理画面の投稿一覧
(wp-admin/b2edit.php)の各投稿の隣に表示される **「Block editor」**リンク、
または直接 block-editor/api/editor.php?post=<ID> から投稿をブロック
エディタで開く。ブロック内容はブロックマークアップとして既存の
post_content カラムに保存されるため、0.71 のフロントエンドは投稿を通常
どおり描画し続ける。
| パス | 内容 |
|---|---|
src/ |
WordPress 0.71-gold のソース(改修対象の本体)。src/block-editor/ はランタイムのブロックエディタ PHP(api/)とビルド済みアセット(assets/)を保持する。 |
tests/phpunit/ |
PHPUnit 単体テスト(tests/)と補助クラス(includes/)。 |
tests/e2e/ |
Playwright E2E spec とテストデータヘルパー。 |
docs/ |
ドキュメント。 |
tools/ |
0.71 専用のツール — 071-cli(tools/cli、静的書き出しを含む)・071-env(tools/env)・071-now(tools/playground)・ブロックエディタのビルドソース(tools/block-editor)。 |
tools/env/Dockerfile, tools/env/docker-compose.yml |
ローカルの PHP 8.3 + MySQL 8 環境。 |
phpcs.xml.dist, phpstan.neon.dist |
静的解析の設定。 |
composer.json |
PHP 開発ツール(phpcs / WPCS / PHPStan / PHPUnit)。 |
package.json, playwright.config.js, lint-staged.config.mjs, .husky/ |
Node ツール — Playwright E2E と husky/lint-staged の pre-commit フック。 |
- PHP 8.3 移行 —
ext/mysql→mysqli、POSIXereg*→ PCRE、廃止・変更 された PHP 関数やスーパーグローバル、PHP4 形式コンストラクタ など。 - MySQL 8 互換 — 厳格な
sql_mode、予約語 など。 - セキュリティ強化 — SQL インジェクション・XSS・CSRF・認証/セッション・ アクセス制御・ファイルアップロード・情報漏洩。
- 不要機能の撤去 — XML-RPC・コメント・トラックバック・ピンバック。
- 静的解析 — phpcs(WordPress-Core / WPCS)と PHPStan、いずれも 0 件。
すべての変更は GitHub Issue 単位で docs/php83-migration.md に記録している。
| ファイル | 内容 |
|---|---|
docs/php83-migration.md |
Issue 単位の移行ログ。 |
docs/security-audit.md |
セキュリティ監査のまとめ。 |
docs/static-export.md |
静的書き出しと安全な公開。 |
docs/static-analysis.md |
phpcs・PHPStan ツール。 |
docs/docker-environment.md |
Docker 環境の詳細。 |
docs/gutenberg-investigation.md |
Gutenberg 移植可否の調査。 |
docs/block-editor-media-and-layout.md |
ブロックエディタ: 画像アップロードとレイアウト整合性。 |
GPL-2.0-or-later。WordPress は GNU 一般公衆利用許諾契約書で配布されており、 本派生物も同じライセンスに従う。