Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore: Setup SQLite database integration without creating wp-content/db.php #1382

Merged
merged 5 commits into from
May 14, 2024

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented May 13, 2024

What is this PR doing?

Related to #1379

Loads the SQLite database integration without creating a drop-in wp-content/db.php plugin. Instead, it leans on the auto_prepend_file PHP option to provide a fake global $wpdb variable. This prevents WordPress from trying to connect to MySQL. The first time that $wpdb is used for reading or a method call, it loads the actual SQLite database integration.

Follow-up work

Use the same SQLite setup method in the web version of Playground. This could happen either when a non-minified WordPress build is used or, for simplicity, always if we remove the SQLite integration plugin from the minified build.

Testing instructions

Run bun packages/playground/cli/src/cli.ts server --login and confirm the server starts without any database errors.

Test coverage coming as a part of the larger boot protocol discussion, see #1379.

@adamziel adamziel added [Type] Exploration An exploration that may or may not result in mergable code [Package][@wp-playground] CLI labels May 13, 2024
@brandonpayton
Copy link
Member

Nice idea!

@adamziel adamziel force-pushed the setup-sqlite-integration-without-creating-db-php branch from cc65960 to ba99209 Compare May 14, 2024 09:52
@adamziel adamziel marked this pull request as ready for review May 14, 2024 09:58
"packages/playground/wordpress/**/*.ts",
"packages/playground/wordpress/package.json"
]
"lintFilePatterns": ["packages/playground/wordpress/**/*.ts"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically unrelated, but this PR introduces a few dependencies that trigger an eslint warning – let's just get it in as a part of this PR.

@adamziel adamziel merged commit 0b05edf into trunk May 14, 2024
5 checks passed
@adamziel adamziel deleted the setup-sqlite-integration-without-creating-db-php branch May 14, 2024 10:12
@adamziel adamziel restored the setup-sqlite-integration-without-creating-db-php branch May 14, 2024 10:15
@adamziel adamziel mentioned this pull request May 15, 2024
adamziel added a commit that referenced this pull request May 15, 2024
Prevents creating a `wp-config.php` file in WordPress document root. Instead, creates it one level higher as WordPress falls back to loading it from there.

Related to #1398. Similar to #1382 and #1401.

## Testing instructions

Run `bun packages/playground/cli/src/cli.ts server --login` and confirm it loads an installed WordPress.
adamziel added a commit that referenced this pull request May 15, 2024
Prevents creating a `wp-config.php` file in WordPress document root.
Instead, creates it one level higher as WordPress falls back to loading
it from there.

Related to
#1398. Similar
to #1382 and
#1401.

## Testing instructions

Run `bun packages/playground/cli/src/cli.ts server --login` and confirm
it loads an installed WordPress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package][@wp-playground] CLI [Type] Exploration An exploration that may or may not result in mergable code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants